Skip to content

MDX import not working in Create React App with Typescript #1592

Answered by ChristianMurphy
janrembold asked this question in Q&A
Discussion options

You must be logged in to vote

This is noted in the TypeScript guide.
Docs for version 1 https://github.com/mdx-js/mdx/blob/master/docs/advanced/typescript.mdx

declare module '*.mdx' {
  let MDXComponent: (props: any) => JSX.Element
  export default MDXComponent
}

Docs for version 2 https://mdxjs.com/advanced/typescript

For React with MDX 2:

/// <reference types="@mdx-js/loader" />

For Vue with MDX 2:

/// <reference types="@mdx-js/vue-loader" />

Replies: 6 comments 13 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@janrembold

This comment was marked as disruptive content.

@JounQin
Comment options

@janrembold

This comment was marked as off-topic.

@janrembold
Comment options

@ChristianMurphy
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@janrembold
Comment options

@ChristianMurphy
Comment options

@janrembold
Comment options

@janrembold
Comment options

@teauxfu
Comment options

Answer selected by ChristianMurphy
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ChristianMurphy
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
🙋 no/question This does not need any changes
6 participants
Converted from issue

This discussion was converted from issue #1591 on July 06, 2021 09:19.