Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(48556): never cannot be spread into object, but it can be spread into JSX props #48570

Merged
merged 1 commit into from
Apr 21, 2022

Conversation

a-tarasyuk
Copy link
Contributor

Fixes #48556

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Apr 5, 2022
Copy link
Member

@sandersn 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 sandersn merged commit d71dd1d into microsoft:main Apr 21, 2022
Jack-Works pushed a commit to Jack-Works/TypeScript that referenced this pull request Apr 22, 2022
@DanielRosenwasser DanielRosenwasser added the Breaking Change Would introduce errors in existing code label Apr 26, 2022
@DanielRosenwasser
Copy link
Member

This 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.

@nandorojo
Copy link

nandorojo commented May 25, 2022

Can you still spread a nullable object onto JSX/objects?

@DanielRosenwasser
Copy link
Member

I believe so

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Breaking Change Would introduce errors in existing code For Backlog Bug PRs that fix a backlog bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

never cannot be spread into object, but it can be spread into JSX props
6 participants