Skip to content

fix: use React.ReactElement as render return type for React 19 - #629

Merged
hustcc merged 1 commit into
hustcc:masterfrom
Sam-Razavi:fix/react-19-jsx-namespace
Nov 6, 2026
Merged

hustcc merged 1 commit into
hustcc:masterfrom
Sam-Razavi:fix/react-19-jsx-namespace

Conversation

@Sam-Razavi

Copy link
Copy Markdown
Contributor

Fixes #628

@types/react 19 removed the global JSX namespace, but the published core.d.ts declares render(): JSX.Element. Projects on React 19 with skipLibCheck: false get:

core.d.ts(55,15): error TS2503: Cannot find namespace 'JSX'.

This changes the return type to React.ReactElement, which exists in both the @types/react 17 this repo uses and in 19.

Tested by compiling the declarations before and after and using them from a project on @types/react 19.3 and TypeScript 5.9: one error before, none after. The repo's tsc, eslint, prettier and jest (13/13) all pass, and the compiled JS is identical.

@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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 from JSX.Element to React.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

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 94.737%. remained the same — Sam-Razavi:fix/react-19-jsx-namespace into hustcc:master

@hustcc
hustcc merged commit f59dd3f into hustcc:master Nov 6, 2026
3 checks passed
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

Successfully merging this pull request may close these issues.

React 19 类型错误:找不到命名空间“JSX”

4 participants