Skip to content

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

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 21, 2019

Conversation

weswigham
Copy link
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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