From d4dee77cec8106baf14794b9098098345e9086d3 Mon Sep 17 00:00:00 2001 From: Remco Haszing Date: Mon, 17 Nov 2025 14:01:31 +0100 Subject: [PATCH] Document augmentation to make JSX available Previously frameworks used to define a global `JSX` namespace. This is no longer the case. Now users need to define it themselves using module augmentation. --- docs/docs/getting-started.mdx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/docs/getting-started.mdx b/docs/docs/getting-started.mdx index 4a125642d..38707f6a4 100644 --- a/docs/docs/getting-started.mdx +++ b/docs/docs/getting-started.mdx @@ -172,7 +172,16 @@ Our packages are typed with [TypeScript][]. For types to work, the `JSX` namespace must be typed. This is done by installing and using the types of your framework, -such as [`@types/react`][definitely-typed-react]. +such as [`@types/react`][definitely-typed-react], +then augmenting the `mdx/types.js` module. + +```ts twoslash path="example.ts" +import * as React from 'react' + +declare module 'mdx/types.js' { + export import JSX = React.JSX +} +``` To enable types for imported `.mdx`, `.md`, etc., install and use [`@types/mdx`][definitely-typed-mdx].