Skip to content

Restrict spreading for unknown Type with non object constraint#32969

Merged
orta merged 2 commits into
microsoft:masterfrom
collin5:b30851-2
Aug 19, 2019
Merged

Restrict spreading for unknown Type with non object constraint#32969
orta merged 2 commits into
microsoft:masterfrom
collin5:b30851-2

Conversation

@collin5
Copy link
Copy Markdown
Contributor

@collin5 collin5 commented Aug 19, 2019

Fixes #30851

@collin5
Copy link
Copy Markdown
Contributor Author

collin5 commented Aug 19, 2019

cc @orta

Copy link
Copy Markdown
Contributor

@orta orta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - can you humor me and add one extra test here:

function f26(x: {}, y: unknown, z: any) {
let o1 = { a: 42, ...x }; // { a: number }
let o2 = { a: 42, ...x, ...y }; // unknown
let o3 = { a: 42, ...x, ...y, ...z }; // any
}

Specifically for the any passing? e.g.

let o4 = { a: 42, ...z };

Then I'm happy to merge 👍

@orta orta self-assigned this Aug 19, 2019
@collin5
Copy link
Copy Markdown
Contributor Author

collin5 commented Aug 19, 2019

Done. Thank you.

@orta
Copy link
Copy Markdown
Contributor

orta commented Aug 19, 2019

Thanks!

@orta orta merged commit 634beb5 into microsoft:master Aug 19, 2019
@collin5 collin5 deleted the b30851-2 branch August 19, 2019 23:46
@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.

Object spreading restrictions are inconsistent "Spread types may only be created from object types."

2 participants