Skip to content

JSX is still not transformed to React.createElement when inside spread with target >=ES2018Β #55858

@bob-difronzo

Description

@bob-difronzo

πŸ”Ž Search Terms

JSX, spread, React.createElement

πŸ•— Version & Regression Information

Issue is first seen in 5.1.6, and forward to 5.2.2 and the current nightly version.

⏯ Playground Link

https://www.typescriptlang.org/play?target=5&ts=5.2.2#code/DwYQ9gtgDgBATgSwOYAsAuBeA3sAJggNwD4APYAen2IF8YsA6RrGAdzjADskAuGPQ0hSpFq1ckQCwAKCA

πŸ’» Code

<Comp right={<div>x</div>} {...{ wrong: <div>x</div>}}/>

πŸ™ Actual behavior

React.createElement(Comp, { right: React.createElement("div", null, "x"), wrong: <div>x</div> });

πŸ™‚ Expected behavior

React.createElement(Comp, { right: React.createElement("div", null, "x"), wrong: React.createElement("div", null, "x") });

Additional information about the issue

The same bug seems to have been fixed in #54425, but only when the target is ES2017 or below. When target is set to ES2018 or above the issue still exists.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions