Switch from JSX.Element to React.JSX.Element#5986
Merged
dylans merged 1 commit intoianstormtaylor:mainfrom Dec 31, 2025
Merged
Conversation
🦋 Changeset detectedLatest commit: 54b4063 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The global JSX namespace has been deprecated for around two and a half years now in favor of using React.JSX, and as of the type declarations for React 19, it's been fully removed. By switching to the new namespace, this package maintains compatibility with React 19.
This was referenced Dec 9, 2025
dylans
approved these changes
Dec 16, 2025
Collaborator
dylans
left a comment
There was a problem hiding this comment.
I'm ok with this for now, but I'd actually like to see us move away from using import React from 'react' and more directly import what we use, but that's a much bigger change.
Contributor
Author
|
Is there anything I can do on my end to encourage merging and releasing this? AFAIK it's the last blocker for us to upgrade. |
This was referenced Dec 31, 2025
Merged
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.
Description
The global JSX namespace has been deprecated for around two and a half years now in favor of using React.JSX, and as of the type declarations for React 19, it's been fully removed. By switching to the new namespace, this package maintains compatibility with React 19.
Without this change, attempting to use React 19 with
slate-reactand TypeScript results in typechecking errors:Issue
N/A
Example
Context
The
React.JSXnamespace was introduced and globalJSXwas deprecated both in DefinitelyTyped/DefinitelyTyped#64464, which was published as v18.2.6 of@types/react(n.b.: version numbers in@types/packages are only loosely connected to upstream version numbers).Since TypeScript is structurally-typed, the types
React.JSX.ElementandJSX.Elementshould be functionally equivalent to the typechecker, so as long as users have a version of@types/reactthat includes both declarations, this should not cause a backwards compatibility issue.Ideally, we would enforce that users had v18.2.6 or later of
@types/react, but given the nature of type dependencies, that's not possible. (There's no way to have a non-dev dependency introduce new dev dependencies). But presumably anyone who is proactively updating this package is also updating their type declarations as well.Checks
yarn test.yarn lint. (Fix errors withyarn fix.)yarn start.)yarn changeset add.)