Re:Announcing TypeScript 2.0 Beta
by jsheard on Monday July 11, 2016 @01:46PM
(#12072830)
In the meantime you can use async with TypeScripts ES6 emitter, which transforms async into generators, then run the output through Babel to transform the generators into plain old ES3/ES5. It's messy but it works.
[ Parent
| on HN ]
Re:Announcing TypeScript 2.0 Beta
by tomduncalf on Monday July 11, 2016 @05:46PM
(#12074969)
If anyone is interested in this setup, I wrote a blog post recently about setting up Typescript with Webpack and React which describes how to set it up so that the Typescript output passes through Babel: http://blog.tomduncalf.com/posts/setting-up-typescript-and-r...
thanks it's very useful, as I now I doubt async/await will ever land in TS.
Re:Announcing TypeScript 2.0 Beta
by moosingin3space on Monday July 11, 2016 @01:54PM
(#12072897)
How hard is it to automate this and what impact on build times does it have?
It's not hard to automate with raw gulp or webpack, but it does add a significant amount of time to compilation. It roughly doubled our incremental compile times. My team decided it wasn't worth it, but it's possible that a cleverer person could decrease the overhead.
Re:Announcing TypeScript 2.0 Beta
by moosingin3space on Monday July 11, 2016 @02:47PM
(#12073298)
I ask because I'm debating between trialing TypeScript or Elm for a personal project (I primarily work in Rust and Go on the backend/infrastructure), and iteration times are important when trying to get a frontend UI "just right".
You could just use TypeScripts ES6 output directly during development, using a browser that supports ES6 natively, then add Babel to the build chain for public builds that need to work on older browsers.
Re:Announcing TypeScript 2.0 Beta
by moosingin3space on Monday July 11, 2016 @02:57PM
(#12073393)
Do I generally need to use prerelease browsers for ES6 support? Sorry, it's been a long time since I've been on the frontend.
The stable versions of Chrome, Firefox and Edge all support ES6 generators. Safari stable doesn't support them yet but the tech preview does.
It takes about 20 min. It's very easy to get TS to output ES6 (a single line in a config file). It's very easy to get Babel to output ES5 from ES6.
The only thing that might be time-consuming is setting your paths if you don't already have a plan for keeping things separate.