fix(48556): never cannot be spread into object, but it can be spread into JSX props by a-tarasyuk · Pull Request #48570 · microsoft/TypeScript

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Conversation

@a-tarasyuk

Copy link

Contributor

Fixes #48556

knpwrs and TheFanatr reacted with hooray emoji

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

a-tarasyuk and TheFanatr reacted with thumbs up emoji a-tarasyuk and TheFanatr reacted with eyes emoji

@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

edited

Loading

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

@DanielRosenwasser

Copy link

Member

I believe so

@microsoft microsoft locked as resolved and limited conversation to collaborators

Oct 22, 2025

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@sandersn sandersn sandersn approved these changes

+1 more reviewer

@Jessidhia Jessidhia Jessidhia left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

Breaking Change

Would introduce errors in existing code

For Backlog Bug

PRs that fix a backlog bug

Projects

PR Backlog

Archived in project

Milestone

No milestone

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

@a-tarasyuk @DanielRosenwasser @nandorojo @Jessidhia @sandersn @typescript-bot