Repository navigation
fix: use React.ReactElement as render return type for React 19 - #629
Merged
Merged
Conversation
@types/react 19 removed the global JSX namespace, so the published core.d.ts fails to type check in React 19 projects with skipLibCheck off. Fixes hustcc#628
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the React 19 render return-type compatibility change.
No open issues 🎉
What changed in this PR
Fixes React 19 type compatibility for EChartsReactCore, addressing the missing global JSX namespace reported in #628.
Changes:
- Changes the
render()return type fromJSX.ElementtoReact.ReactElement, which supports both React 17 and React 19 typings. - Leaves runtime behavior unchanged.
| File | Description |
|---|---|
src/core.tsx |
Updates the render return type to avoid relying on the global JSX namespace. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #628
@types/react19 removed the globalJSXnamespace, but the publishedcore.d.tsdeclaresrender(): JSX.Element. Projects on React 19 withskipLibCheck: falseget:This changes the return type to
React.ReactElement, which exists in both the@types/react17 this repo uses and in 19.Tested by compiling the declarations before and after and using them from a project on
@types/react19.3 and TypeScript 5.9: one error before, none after. The repo'stsc, eslint, prettier and jest (13/13) all pass, and the compiled JS is identical.