-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Iterators (ES6) #1900
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
Comments
Also, when we do generators, we have to support |
I've made each of the bullet points into a task list item so that we can check these off and keep appropriate track of them. |
Iterables and Iterator types are addressed by #2083 |
ES6 level |
@ahejlsberg I have a question that may be relevant here, though it is not required. Should spread elements support contextual typing? By this I mean two things:
My gut says that this is not necessary. The only reason I bring it up is that Number 2 above could make type argument inference stronger. |
Actually, thinking about this more, I think it would make things more fluid and actually make things more consistent. |
My plan for spread and destructuring is as follows:
For array destructuring (both binding and assignment varieties), we will type each destructuring array element in the following way when target is ES6:
The key difference between the two is that destructuring prefers the numerically named properties of the parent type, whereas the spread argument doesn't care about them. Note that the type rules for ES3/ES5 don't change, the above are just the type rules for ES6. |
eagerly waiting for this feature to use on io.js. Any tentative release date ? |
@corporatepiyush, the only thing left for 'for...of' loops is #2308. Once that's in, you can use those loops. Type checking for iterate on spread / iterate on destructuring is planned for the next release (TypeScript 1.5). |
To your second question, yes this will be supported for in ES3/5 but only for arrays. Except that in ES5, 'for...of' works on strings too. |
'for...of' loops are now fully supported, so feel free to start using them. |
Awesome thanks 👍 |
The spread and destructuring aspects of this feature are covered by #2498 |
This is done now. The only remaining item for iterators is yield* but that is more of a generators thing. |
Creating an issue to track work on iterators. This includes:
The text was updated successfully, but these errors were encountered: