Skip to content

Restrict spreading for unknown Type with non object constraint #32969

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
Aug 19, 2019

Conversation

collin5
Copy link
Contributor

@collin5 collin5 commented Aug 19, 2019

Fixes #30851

@collin5
Copy link
Contributor Author

collin5 commented Aug 19, 2019

cc @orta

Copy link
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
Contributor Author

collin5 commented Aug 19, 2019

Done. Thank you.

@orta
Copy link
Contributor

orta commented Aug 19, 2019

Thanks!

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.

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