aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2021-12-24 15:03:41 +0100
committerArmand Philippot <git@armandphilippot.com>2021-12-24 15:09:38 +0100
commita35f1a9c2564557aea9bca4abb8db5f820a7ad79 (patch)
tree7f5778231988410883e5899b050043b2cd40a84b
parent57ea3b5afcd60fb129396afb4946d9f1013fb291 (diff)
build: add a typescript declaration file for MDX
I need to inform Typescript than I am exporting a meta constant from MDX files.
-rw-r--r--mdx.d.ts7
-rw-r--r--src/ts/types/app.ts6
2 files changed, 13 insertions, 0 deletions
diff --git a/mdx.d.ts b/mdx.d.ts
new file mode 100644
index 0000000..b77b39d
--- /dev/null
+++ b/mdx.d.ts
@@ -0,0 +1,7 @@
+declare module '*.mdx' {
+ import { Meta } from '@ts/types/app';
+
+ let MDXComponent: (props: any) => JSX.Element;
+ export default MDXComponent;
+ export const meta: Meta;
+}
diff --git a/src/ts/types/app.ts b/src/ts/types/app.ts
index e1d8917..a8c552d 100644
--- a/src/ts/types/app.ts
+++ b/src/ts/types/app.ts
@@ -83,6 +83,12 @@ export type Heading = {
title: string;
};
+export type Meta = {
+ title: string;
+ publishedOn: string;
+ updatedOn: string;
+};
+
export type PageInfo = {
endCursor: string;
hasNextPage: boolean;