Skip to navigation

TypeScript

MDX provides typings for many of the core packages.

If you want to improve upon the types, we would love a PR to improve the developer experience for TypeScript users.

Typings for Components and Utilities

  • @mdx-js/mdx
  • @mdx-js/preact
  • @mdx-js/react
  • @mdx-js/runtime
  • @mdx-js/vue
  • remark-mdx

Include types, no additional setup needed.

Typings for MDX imports

React and Webpack

Add an mdx.d.ts file with the below content, and ensure it is included by the tsconfig.json.

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

Vue and Webpack

Add an mdx.d.ts file with the below content, and ensure it is included by the tsconfig.json.

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