4 ms·
This states TypeScript is layered on top of ES6. I did not believe that to be true. Is there some meta-bug or other location tracking the TypeScript move to ES6
by apaprocki 12y ago
This states TypeScript is layered on top of ES6. I did not believe that to be true. Is there some meta-bug or other location tracking the TypeScript move to ES6? I was under the impression there were still a number of bugs that prevent fully using TS with ES6. (Maybe I'm wrong and someone can fill me in :))
- flyingmutant 12y agoThere is an ES6 label for tracking these issues: https://github.com/Microsoft/TypeScript/labels/ES6 https://github.com/Microsoft/TypeScript/labels/ES6
- tinganho 12y agoI'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 12y 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 12y agoYou can compile .ts to ES6 .js and then use babel to compile it to ES5 .js.
- egeozcan 12y agoDoesn't it error-out with the unsupported syntax, for example, generators?
- katabatic 12y 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.
- nawitus 12y agoCheck the roadmap: https://github.com/Microsoft/TypeScript/wiki/Roadmap https://github.com/Microsoft/TypeScript/wiki/Roadmap It's true that there's not too many ES6 features implemented yet, but the 1.5 release will bring a lot of new ES6 features, and it's right around the corner.
- frik 12y agoTypeScript devs pushed their idioms to get it into ES6. Introducing optional typing to ES6/7 would be a good idea, but other C#/Java inspired syntax like "class" are a bit off-putting, if one loves the lean JS5 syntax. After all, JavaScript has prototype-based inheritance, so the new "class" keyword is weird (even if it's just syntactic sugar): http://en.wikipedia.org/wiki/Prototype-based_programming http://en.wikipedia.org/wiki/Prototype-based_programming
- tracker1 12y agoEven with prototype based inheritance I tend to avoid it all together in JS. Preferring to use generic object instances, with function based modules that can be composed (Ramda, ReactiveJS, etc) that works out being much better and easier to reason with in practice in my opinion. I agree that the class syntax seems a bit weird, but it isn't bad... It's a lot better than ES4/AS3 syntax in my mind, though ES7 (TypeScript/AtScript) seem to be moving in that direction.
- frik 12y agoYour are right. A little nick pick about TypeScript and I hope that other dislike its influence to ES6/7 too: Microsoft's mastermind behind C# and TypeScript: Anders Hejlsberg was the original author of Turbo Pascal and the chief architect of Delphi. In 1996, Hejlsberg left Borland and joined Microsoft. One of his first achievements was the J++ programming language. Since 2000, he has been the lead architect of the team developing the language C#. In 2012 Hejlsberg announced his new project TypeScript—a superset of JavaScript. I sincerely hope he stays away from ES7 - I don't like his syntax preferences. (ES4/AS3 syntax was already weird as hell, and good that it failed.) ES5/JavaScript 5 was so great and lean - so refreshing coming from C++/Java/C#. TypeScript feels a bit like a Trojan horse that emerges as ES7. As the linked article says "TypeScript: Is basically ECMAScript 6 plus optional type annotations." Or the other way around, they turned the beloved ES5 to Hejlsberg's TypeScript. So don't destroy ES7.