4 ms·
I'm using TypeScript everyday, so I might can give a good answer to your question. They have just finished support for ES6 modules, template string, let/const e
by tinganho 11y ago
I'm using TypeScript everyday, so I might can give a good answer to your question. They have just finished support for ES6 modules, template string, let/const etc. ES6 classes have been supported for a long time and most of the syntax sugar of ES6 I can think of is supported. On top of that, they are about to release v1.5 the big thing there is support for decorators.
What is not so good with TypeScript is that they have a rule of not polyfilling things. So if you want any new ES6 methods for array/string etc. You would need to polyfill them yourself.
- nothrabannosir 11y agoMe too, and I can't help but feel this paints an overly rosy picture of the state of ES6 in TS. Truth is: it's coarse and minimal. See the status here: http://kangax.github.io/compat-table/es6/ http://kangax.github.io/compat-table/es6/ The column below "babel" is what you would get when you program raw ES6 and transpile using Babel. The column below TypeScript is, unfortunately, what we are currently dealing with. Many lacking features. So far, 1.5 doesn't look like it will bridge this gap substantially.
- nawitus 11y agoYou can compile .ts to ES6 .js and then use babel to compile it to ES5 .js.
- egeozcan 11y agoDoesn't it error-out with the unsupported syntax, for example, generators?
- katabatic 11y agoYes, however some features in TypeScript are only supported when targeting ES6 (such as "const"), so there's still some value in double-transpiling from TypeScript -> ES6 -> ES5 (I'm doing that on a couple of projects). That may have changed somewhat in the TS 1.5 alpha - they're supporting more features on the ES5 target than they did in 1.4. But yes, you still can't use ES6 features that TS doesn't know about.