-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Wrong type infer for spread arrays #31809
Comments
...wait, is that even a legal thing to do? Spreading an array into an object like that? |
It works. In that case, you got |
Yeah, arrays are just objects like almost everything else in JS, of course that would work. Brainfart on my part, ignore my stupidity. 😄 |
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
TypeScript Version: 3.6.0-dev.20190606
Search Terms:
spread, array
Code
Expected behavior:
a
doesn't haveslice
propertyActual behavior:
a
hasslice
property forArray
type.Playground Link:
https://www.typescriptlang.org/play/#src=const%20a%20%3D%20%7B%0D%0A%20%20...%5B1%2C%202%2C%203%5D%2C%0D%0A%7D%3B%0D%0Aa.slice%20%2F%2F%20%3D%3D%3D%20undefined%20actually!%0D%0Aconsole.log(a.slice)%3B
Related Issues:
The text was updated successfully, but these errors were encountered: