fix(48556): never cannot be spread into object, but it can be spread into JSX props by a-tarasyuk · Pull Request #48570 · microsoft/TypeScript
Navigation Menu
{{ message }}
microsoft / TypeScript Public
- Notifications You must be signed in to change notification settings
- Fork 13.3k
Merged
fix(48556): never cannot be spread into object, but it can be spread into JSX props#48570
sandersn merged 1 commit intomicrosoft:mainfrom
fix(48556): never cannot be spread into object, but it can be spread into JSX props#48570
sandersn merged 1 commit intomicrosoft:mainfrom
Conversation
sandersn approved these changes Apr 21, 2022
Copy link
Member
sandersn
left a comment
sandersn
left a comment
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is right, but while I'm looking at it, it's kind of strange that object literals return errorType whereas JSX literals try to build up typeToIntersect as a place to hold non-spreadable types. I would think that both kinds of literals would behave the same.
sandersn
merged commit
d71dd1d
into
microsoft:main
Jack-Works pushed a commit to Jack-Works/TypeScript that referenced this pull request
Apr 22, 2022
DanielRosenwasser
added
the
Breaking Change
label
Apr 26, 2022Copy link
Member
DanielRosenwasser
commented
Apr 26, 2022
DanielRosenwasser commented
Apr 26, 2022This breaks spreading unknown and never into a JSX element. Users may now see
Spread types may only be created from object types.
In JSX spreads.
Jessidhia reviewed May 13, 2022
tests/baselines/reference/jsxExcessPropsAndAssignability.errors.txt
Show resolved
Hide resolved
tests/baselines/reference/jsxExcessPropsAndAssignability.errors.txt Show resolved Hide resolved
a-tarasyuk
mentioned this pull request
Copy link
Can you still spread a nullable object onto JSX/objects?
Copy link
Member
DanielRosenwasser
commented
May 25, 2022
DanielRosenwasser commented
May 25, 2022I believe so
microsoft
locked as resolved and limited conversation to collaborators
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 subscribe to this conversation on GitHub. Already have an account? Sign in.