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

[v5] Upstream @types/mdx doesn't support React v19 yet #462

Open
mwskwong opened this issue May 23, 2024 · 2 comments
Open

[v5] Upstream @types/mdx doesn't support React v19 yet #462

mwskwong opened this issue May 23, 2024 · 2 comments

Comments

@mwskwong
Copy link

mwskwong commented May 23, 2024

Describe the bug

Regarding the latest release of v5, which claimed to support React 19, please note that @types/mdx, a dependency of @mdx-js/mdx and @mdx-js/react, is still accessing the global JSX namespace, which now needs to be imported from react in React 19. Ref: https://react.dev/blog/2024/04/25/react-19-upgrade-guide#the-jsx-namespace-in-typescript

As such, we must patch @types/mdx to support React 19 for now. e.g.

diff --git a/node_modules/@types/mdx/types.d.ts b/node_modules/@types/mdx/types.d.ts
index 498bb69..030a05f 100644
--- a/node_modules/@types/mdx/types.d.ts
+++ b/node_modules/@types/mdx/types.d.ts
@@ -1,3 +1,5 @@
+import { type JSX } from 'react'
+
 // Internal helper types
 
 /**

Reproduction

N/A

next-mdx-remote version

v5.0.0

@dstaley dstaley pinned this issue May 23, 2024
@dstaley
Copy link
Contributor

dstaley commented May 23, 2024

Thank you for reporting this! This is technically a "issue" (using that term loosely) with MDX and a as-of-yet unreleased version of React. The change from React to use their own JSX namespace will have wide reaching implications, particularly for libraries like MDX that work in several non-React JSX ecosystems. It will likely take time for everything upstream to settle, but it's my current belief that this won't require any changes on the next-mdx-remote side.

Gonna leave this open and pinned so that others can benefit from the patch you shared. Thanks again!

@akarabach
Copy link

@mwskwong @dstaley How do you do it on CI ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants