How do I transpile TypeScript to ES6?

前端 未结 4 717
甜味超标
甜味超标 2020-12-29 03:27

Basically I need to be able to write TypeScript code in my IDE (this introduces great ease to development), compile it to ES6 and then apply babel.js (as all br

4条回答
  •  醉话见心
    2020-12-29 03:51

    You can use typescript to write pure ES6 and then transpile to ES3 or ES5. Since typescript is ES6 plus goodies.

    See it as using Less to write your css, you can write pure CSS in a less file and it will compile just fine.

    For typescript 1.8 language spec:

    TypeScript is a syntactic sugar for JavaScript. TypeScript syntax is a superset of ECMAScript 2015 (ES2015) syntax. Every JavaScript program is also a TypeScript program.

    TypeScript syntax includes all features of ECMAScript 2015, including classes and modules, and provides the ability to translate these features into ECMAScript 3 or 5 compliant code.

提交回复
热议问题