From a35f1a9c2564557aea9bca4abb8db5f820a7ad79 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 24 Dec 2021 15:03:41 +0100 Subject: build: add a typescript declaration file for MDX I need to inform Typescript than I am exporting a meta constant from MDX files. --- mdx.d.ts | 7 +++++++ src/ts/types/app.ts | 6 ++++++ 2 files changed, 13 insertions(+) create mode 100644 mdx.d.ts 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; -- cgit v1.2.3