Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note on broken react runtime types #2383

Merged
merged 3 commits into from
Oct 25, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/migrating/v3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ You will get a runtime error if these features are used in MDX without
If you passed the `useDynamicImport` option before, remove it, the behavior
is now the default.

Note that you may get a TypeScript error saying `Property 'Fragment' is missing in type`.
This is [because `react/jsx-runtime` does not export its types](https://github.com/orgs/mdx-js/discussions/1862#discussioncomment-1824570).
To remediate this, do:

```typescript

// @ts-expect-error: the automatic react runtime is untyped.
const result = await run(compiled, { ...runtime, baseUrl: import.meta.url });
```
wooorm marked this conversation as resolved.
Show resolved Hide resolved

## Use the automatic JSX runtime

If you use the classic runtime, switch to the automatic runtime.
Expand Down