Skip to content

JSX element is not transformed to React.createElement when inside a spreadΒ #54984

Closed

Description

@EgoziE

Bug Report

πŸ”Ž Search Terms

JSX, spread, React.createElement

πŸ•— Version & Regression Information

5.1

⏯ Playground Link

Playground link with relevant code

πŸ’» 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

Works with version 5.0.4

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

Activity

  1. fatcerberus commented on Jul 12, 2023

    @fatcerberus

    Probably a duplicate of #54411 (see last comment)

  2. marsiancba commented on Jul 13, 2023

    @marsiancba

    Just hit this bug when upgrading to 5.1.
    Also in 5.2.0 beta

  3. added a commit that references this issue on Jul 13, 2023
    54994b2
  4. locked as resolved and limited conversation to collaborators on Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions