可以将TypeScript编译为ES6代码吗? [英] Can TypeScript compile to ES6 code?
本文介绍了可以将TypeScript编译为ES6代码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
基本上,我需要在我的IDE中写入 TypeScript
(这很容易开发),将其编译为 ES6
(不久的将来的js),然后应用 babel.js
(因为所有浏览器都不支持大多数ES6)来获得最终的ES5脚本。 >
这是可能的还是如何实现相同的结果?
解决方案
是。
您可以将TypeScript编译器定位到ES6。
例如将其添加到命令行args: p>
- 目标es6
Basically I need to be able to write TypeScript
in my IDE (this introduces great ease to development), compile it to ES6
( near future of js ) and then apply babel.js
(as all browsers doesn't support most ES6) to get the resulting ES5 scripts.
Is this possible or how can I achieve the same result?
解决方案
Yes.
You can target TypeScript compiler to ES6.
For example add this to your command line args:
--target es6
这篇关于可以将TypeScript编译为ES6代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文