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

前端 未结 6 1891
南笙
南笙 2021-02-01 06:41

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?

6条回答
  •  清酒与你
    2021-02-01 07:06

    TypeScript and Traceur have completely different goals and aren’t comparable in the way you are trying to compare them.

    TypeScript is a superset of EcmaScript that adds strict typing. It includes some features from ES6, but its primary goal is to add strict typing to the language (while aligning with ES6), not to provide ES6 support.

    In contrast, Traceur is a future-EcmaScript to current-EcmaScript compiler. It doesn’t add anything to the language that isn’t already proposed for the next version of EcmaScript.

    If you just want to write EcmaScript 6 today, use Traceur. If you want optional strict typing and all the benefits that go along with that, plus some ES6 features, use TypeScript.

提交回复
热议问题