Typing constants from MDX files #2316
-
Given an MDX file like the one below, how would I type the
I tried adding the types to the
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hoi Mirha! We don’t support TypeScript in MDX, so a But you can type files, the same way TS can type other files. More on how that can work is explained in the MDX types: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/bf97413d7680529146ed26d1f04a74f6e5bf1540/types/mdx/index.d.ts#L10. Does that help, and work for you? I notice that isn’t on our site yet (https://mdxjs.com/docs/getting-started/#types). Probably a good idea to have something there. |
Beta Was this translation helpful? Give feedback.
Hoi Mirha!
We don’t support TypeScript in MDX, so a
type
in a file won’t work, it’s markdown + JS(X).But you can type files, the same way TS can type other files. More on how that can work is explained in the MDX types: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/bf97413d7680529146ed26d1f04a74f6e5bf1540/types/mdx/index.d.ts#L10. Does that help, and work for you?
I notice that isn’t on our site yet (https://mdxjs.com/docs/getting-started/#types). Probably a good idea to have something there.