Skip to content

[lexical-extension] Fix: Remove JSX dependency from DecoratorTextNode#8328

Merged
etrepum merged 1 commit intofacebook:mainfrom
etrepum:claude/remove-jsx-decorator-node-00De8
Apr 10, 2026
Merged

[lexical-extension] Fix: Remove JSX dependency from DecoratorTextNode#8328
etrepum merged 1 commit intofacebook:mainfrom
etrepum:claude/remove-jsx-decorator-node-00De8

Conversation

@etrepum
Copy link
Copy Markdown
Collaborator

@etrepum etrepum commented Apr 10, 2026

Description

DecoratorTextNode previously extended DecoratorNode<JSX.Element>, which pulled in a type-only import type {JSX} from 'react' in @lexical/extension. @lexical/extension does not declare a dependency on React, so this coupled a framework-agnostic package to React's JSX types for no runtime reason.

This PR changes DecoratorTextNode to extend DecoratorNode<unknown> and removes the JSX import. Subclasses (e.g. EntityNode, DateTimeNode) can still return JSX.Element from their own decorate() overrides because any value is assignable to null | unknown. The corresponding .flow declaration is updated to match (DecoratorTextNode extends DecoratorNode<mixed>, no longer generic).

DecoratorTextNode could be generic itself, but there's basically no value to having any DecoratorNode use a generic since $isDecoratorNode is unsound and effectively just casts to whatever since there's no runtime reflection of this generic that it could use to verify the intended host environment. We should really just deprecate all DecoratorNode generics.

Closes #8325

Test plan

Existing tests and type check should still work (including react decorator subclasses of DecoratorTextNode).

Change DecoratorTextNode to extend DecoratorNode<unknown> instead of
DecoratorNode<JSX.Element>, removing the dependency on React's JSX
types from @lexical/extension which has no React dependency declared.

Fixes facebook#8325
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 10, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Apr 10, 2026 2:59pm
lexical-playground Ready Ready Preview, Comment Apr 10, 2026 2:59pm

Request Review

@etrepum etrepum added this pull request to the merge queue Apr 10, 2026
Merged via the queue into facebook:main with commit c983f4d Apr 10, 2026
41 checks passed
@etrepum etrepum deleted the claude/remove-jsx-decorator-node-00De8 branch April 11, 2026 19:20
@etrepum etrepum mentioned this pull request Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: react required as Dependency for @lexical/extension

3 participants