Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

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

Appearance settings

Map stale empty object type in union into fresh empty object type after spread is complete#34839

Merged
weswigham merged 2 commits into
microsoft:mastermicrosoft/TypeScript:masterfrom
weswigham:fix-spread-unfresheningweswigham/TypeScript:fix-spread-unfresheningCopy head branch name to clipboard
Nov 21, 2019
Merged

Map stale empty object type in union into fresh empty object type after spread is complete#34839
weswigham merged 2 commits into
microsoft:mastermicrosoft/TypeScript:masterfrom
weswigham:fix-spread-unfresheningweswigham/TypeScript:fix-spread-unfresheningCopy head branch name to clipboard

Conversation

@weswigham

Copy link
Copy Markdown
Member

Fixes #34690

In the example given, false | { foo: Record<never, never> } is mapped into {} | { foo: Record<never, never> } by the spread operator, except the {} isn't a fresh literal object type - it's just the plain ole stale vanilla empty object type used globally throughout the checker. This change maps that stale empty object into a brand new fresh empty object, as occurs in the non-union spread case.

@weswigham weswigham merged commit a6d44aa into microsoft:master Nov 21, 2019
jablko pushed a commit to jablko/TypeScript that referenced this pull request Nov 21, 2019
…er spread is complete (microsoft#34839)

* Map stale empty object type in union into fresh empty object type after spread is complete

* Accept minor baseline diff
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Circular record cannot be assigned an empty record

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.