ES6 Generator support
This can be broken down to 3 areas:
- basic (parser) support, even if we lose typechecking locally
- Typechecking support
- Transpiling like facebook/regenerator or Traceur, for targeting ES3/ES5.
Any timelines on this?
@piotrwitek I understand as much. The million dollar question now is: How?
I'm looking for a more TypeScript generic method than the somewhat questionable programmatic use in plugin-typescript for JSPM, where errors are apparently ignored. If there's an option somewhere that enables this, then at least it's a flaky strategy that I've chosen myself.
@kdalgaard I have not tried it but I think the tsc option is --noEmitOnError = false, which is the default. I think even if tsc will yell at you and exit with error it will still emit what it can. I guess plugin-typescript does the same but without yelling at you or exiting with error.
@jonaskello Can't seem to get it to work. Maybe something with my Webpack setup or trouble with TSLint...
How do you all become aware of actual script errors, if everything is output anyway?
@kdalgaard I can describe my workflow if it helps. In my previous project I used webpack. Everything was compiled, type-checked and bundled in-memory using webpacks dev-server, and then it hit the browser. So when it hit the browser I was sure it compiled and was type-checked. In the beginning this was really fast. Now that project has grown, initial webpack build takes 36263ms and incremental takes 16981ms. So for my current project I decided to try jspm instead. Not sure if it is any better, but at least it is different :-). So I found @piotrwitek's jspm starter and did not really understand how that worked because it is so different from the webpack flow. Then I finally understood. You have to realise that code is not compiled, not type-checked and not bundled before hitting the browser. It is simply just transpiled, bascially it just strips the type information without caring about it. This makes it possible to have JS hitting the browser fast which makes it possible to make changes in TS and iterate really fast. But I had the same question as you, how do I know if there is a compile error? Well, you have to have a second place where you do that. For example you can use atom with the plugin that incrementially compiles and type-checks. Or you can simply use any editor and just run tsc --watch in the termial, which is what I do. So what I finally realised was that compiling/type-checking could be a separate concern to getting the JS into the browser. Granted this is very different from how webpack works and you have unlearn a bit. And of course this is not the only workflow for TS in jspm, it is just the one I have currently adopted.
@jonaskello Thanks for the explanation. I would expect Webpack to continue being fast due to hot module replacement, but I don't know...
@DanielRosenwasser @jonaskello As demonstrated by fast-async you don't need generators to support async/await, promises are enough. Please don't despair and implement async/await for es5 in typescript.. The the only thing that is blocking me to switch.
@sheerun This issue it not about async/await. It is about generator functions. AFAIK async/await -> ES5 is already implemented in ts@next. Async/await is great if you are taking a imperative approach but IMO not useful if you are using a functional approach to side-effects such as redux-saga.
@sheerun What @jonaskello said.
Now that #5595 has landed, is there any chance this issue can make it back onto the roadmap?
Looks like there is a chance: https://github.com/Microsoft/TypeScript/pull/12346