ES6 generators/iterators and for..of

Topics: Code Checkins, Language Specification
Jan 25, 2013 at 4:54 PM

User @rbuckton sent a pull request for ES6 generators/iterators and a for..of implementation way back at the beginning of December (the 1st in fact) - has anyone noticed? I thought this might have gotten more attention. Is there something wrong with the implementation? The emitted javascript? Some dissonance with the roadmap?

http://typescript.codeplex.com/SourceControl/network/forks/rbuckton/Iterators

Coordinator
Jan 25, 2013 at 5:38 PM

We're looking into supporting generators after 1.0 is release.  The focus on 1.0 is on getting the type system to where we can model the kinds of types and structures we see in popular JavaScript libraries.  We'll continue to grow TypeScript after 1.0 with features that make the language easier to use, and we'll also use that time to continue aligning with ES6 features (which will probably include features like generators/iterators).

Apr 7 at 5:06 AM
Can we revisit this now that 1.0 is out?
May 7 at 7:43 PM
Without generators support, there would be no future in using TypeScript IMHO. I hope it gets to be implemented.
Coordinator
May 8 at 5:34 PM
We're heavily involved in looking through the proposed ES6 spec and adopting it as it gets finalized into TypeScript (one example: https://typescript.codeplex.com/discussions/543598). We haven't gotten to generators, yet, but they're definitely on the docket.
Jun 18 at 2:50 AM
In all of your replies/posts on supporting ES6 you've only really mentioned a few features of ES6 (e.g. generics and modules). Will there be a point in the future where we will be able to compile to ES6 and use things like generators?

I.e. I'm talking about being able to write:
function * mygenerator() {
    var x = 1;
    while (true) {
        yield x;
        x += x;
    }
}
Without typescript errors.

I don't expect TypeScript to try and fancily compile the generator function so that it works with older versions of JavaScript, I just want typing support for my ES6 projects.
Developer
Jun 19 at 2:02 AM
We intend for TypeScript to continue to fulfill the purpose of being a typed superset of JavaScript so you can expect whatever is in ES6 to end up in TypeScript in some form at some point.