Skip to content

Typing constants from MDX files #2316

Closed Answered by wooorm
mirhamasala asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@mirhamasala
Comment options

@wooorm
Comment options

@mirhamasala
Comment options

Answer selected by mirhamasala
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants