Skip to content
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

Object literal with spread property does not correctly overwrite properties #981

Closed
samwgoldman opened this issue Oct 24, 2015 · 5 comments

Comments

@samwgoldman
Copy link
Member

var o1 = { foo: 0 };
var o2 = { ...o1, foo: "" };
var foo = o2.foo;

foo is number | string, instead of string.

@samwgoldman
Copy link
Member Author

Hunting/blaming around the source makes me think @mroch might have some upcoming changes/wip here?

@chenglou
Copy link

Any news on this?

@calebmer calebmer added the bug label Jul 19, 2017
@adimit
Copy link

adimit commented Oct 29, 2018

See also: #6108, #6800, and probably many more; the problem has been cropping up quite a bit and cause erroneous typing rejections when the object types aren't inferred.

@villesau
Copy link
Contributor

@samwgoldman made a PR that fixes this: #7298

@nmote
Copy link
Contributor

nmote commented Oct 25, 2019

This has the expected behavior on master

@nmote nmote closed this as completed Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants