如何将TypeScript转换为ES6? [英] How do I transpile TypeScript to ES6?

查看:1483
本文介绍了如何将TypeScript转换为ES6?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我需要能够在我的IDE中编写TypeScript代码(这极大地简化了开发过程),将其编译为ES6,然后应用babel.js(因为所有浏览器均不支持大多数ES6)才能得到结果ES5脚本.

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 browsers doesn't support most ES6) to get the resulting ES5 scripts.

这可能吗?我该如何实现?

Is this possible? How can I achieve this?

推荐答案

是.

您可以将TypeScript编译器定位到ES6.

You can target TypeScript compiler to ES6.

例如,将其添加到您的命令行参数:

For example add this to your command line args:

--target es6

这篇关于如何将TypeScript转换为ES6?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆