-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Spread operator doesn't work for arrays #573
Comments
This idiom is kinda useless in the simple case, but it is useful in "array-like" objects.
With Babel REPL. (Note that this requires Babel polyfill in chrome, because of the use of Array.from.) |
Very easy to repro. Seems like a bug to me. Thanks for the report! |
No problem! I report the bugs as I encounter them in real code :D |
related? class Person{
name: string;
constructor(name){
this.name = name
}
}
var map: Map<string, Person> = new Map([
['bob', new Person('bob')],
['tim', new Person('tim')],
]);
var count = [...map.values()].filter(p => (p.name=='bob')).length /Users/michael/Tutorials/node/clickforce_es6/src/Test.js |
@mdausmann I would guess so. I just found this bug myself when trying to use it in favor of splice, e.g.: |
still a bug! |
It works on my copy (at least the current github version) |
Right, this should be fixed in 0.17.0. 89b5aa6 was the commit that fixed this. |
I can open another issue for this, if you'd like. But from reading into Spread it should work on iterables, so in that case it should work for a |
@wldcordeiro there is already an open issue for that—on mobile so I can't find it now. |
Progress is being made here: #1668 |
This code doesn't typecheck
This is how it works with babel.
Flow just returns
(Spread operator is marked here #560 as done, so I am adding it as a separate issue)
The text was updated successfully, but these errors were encountered: