ES6作为angularjs或angular2的打字稿目标编译器选项 [英] ES6 as the typescript target compiler option for angularjs or angular2

查看:86
本文介绍了ES6作为angularjs或angular2的打字稿目标编译器选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 angularjs 应用程序的编译器选项如下.如果我将目标更改为 es6 ,是否应该使用其他任何软件包再次将 es6 转换为 es5 ?

The compiler option for my angularjs application is as below. Should I use any other package to transpile es6 to es5 again if I change the target to es6?

    {
      "compilerOptions": {
        "target": "es5", // Change this to es6
        "module": "commonjs",
        "sourceMap": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "removeComments": false,
        "noImplicitAny": false,
        "outDir": "./wwwroot/app/"
      },
      "exclude": [
        "node_modules",
        "wwwroot"
      ]
    }

推荐答案

定位ES5当前是基线要求

*根据 ES6兼容性表:

*According to The ES6 Compatibility Table:

  • class不支持

  • Chrome(最新)
  • Android(最新)

注意:这只是最新信息.许多可提供明显好处的ES6功能仅在最新的浏览器版本中实现.即几乎不存在向后兼容性.

浏览器不完全支持使用ES6可能会更好地描述其他用例.

There are likely other use cases that would be better described using ES6 that aren't fully supported by browser.

简而言之,在可预见的将来,您应该将ES5作为目标,直到浏览器有机会追赶.

In short, you should target ES5 for the foreseeable future until browsers have a chance to catch up.

这篇关于ES6作为angularjs或angular2的打字稿目标编译器选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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