相关疑难解决方法(0)

AngularJS 2.0编译为ES6

我可以在我的关于AngularJS 2.0 TypeScript Intellij想法(或webstorm) - ES6导入语法的 Stackoverflow答案中使用AngularJS 2.0 5分钟快速入门.IntelliJ IDEA 14.1.4

然而,这似乎是针对编译TypeScriptEcmaScript 5.

我想看看我是否可以AngularJS 2.0 Typescript编译EcmaScript 6.

问题1:当我将TypeScript编译器更改为目标时ES6...

IntelliJ TypeScript编译器

我开始收到TypeScript编译器错误:

Error: TS1204: Cannot compile modules into 'commonjs', 'amd', 'system', or 'umd' 
when targeting 'ES6' or higher.
Run Code Online (Sandbox Code Playgroud)

我可以通过删除--module "amd" TypeScript编译器选项来解决它.

这确实提出了一个问题:没有指定amd,使用什么样的模块格式ES6

问题2:

修改TypeScript编译器选项后,它们显示如下:

IntelliJ TypeScript编译器

我开始收到以下错误:

Error TS2300: Duplicate identifier 'Promise'
Run Code Online (Sandbox Code Playgroud)

TypeScript错误TS2300:重复标识符'承诺'

谁看过这个吗?我怀疑它与AngularJS 2.0 Quickstart指定ES-6 Promise有关,它在全球范围内安装,但无法弄清楚如何解决它.

非常感谢你提前.

typescript ecmascript-6 angular

8
推荐指数
3
解决办法
6836
查看次数

标签 统计

angular ×1

ecmascript-6 ×1

typescript ×1