typescripttraceur

Should I use Traceur instead of Typescript to target ES5 but be ready for ES6


I'm working on a large code base that could benefit from Typescript, but since eventually the world will be moving to ES6, should I steer the development towards Traceur?

I don't want to change Typescript implementations in order to target ES6 (when is ready), so my feeling now is to go ahead with Traceur.

Can anyone advise?


Solution

  • I definitely do not agree with the opinion that TypeScript and Traceur are so different, TypeScript is ES5 with types and Traceur is just about ES6.

    On the one hand there is an ES6 compatible TypeScript 2.0 in progress. On the other hand there are a couple of features in Traceur marked as experimental in docs, namely types and annotations. And it turns out that types are very similar to the TypeScript types whereas annotations are something irrelevant both to ES6 and TypeScript. So Traceur is more just ES6 and there is already name for that: AtScript. Yes, we have another language extension :-)

    There is a nice slide from Miško Hevery presentation that shows what is really going on here, fully valid as soon as TypeScript 2.0 is released:

    AtScript and TypeScript as ES6 extensions

    So whatever you decide to use, it is important to note: they are subsets, you may write ES5/ES6 JS and it will be valid TypeScript code, you may write TypeScript and it will be valid AtScript code.

    Turning back to your question, I would give the humble advise to start with ES6 using Traceur with experimental features turned off (it is pretty stable now) and extend as needed, because this is not so radical a decision, doesn't lock you in and leaves space to move in the future.

    UPD: At the beginning of the 2015 I would also recommend to pay attention to 6to5 project (renamed to Babel) as an alternative to Traceur. It moves very fast and provides has some nice features, such as readability of generated code and better support for node.js and build systems.