【问题标题】:Enable Visual Studio Cordova Project support TypeScript EMCAScript 6启用 Visual Studio Cordova 项目支持 TypeScript EMCAScript 6
【发布时间】:2016-05-08 18:17:47
【问题描述】:

我想在 VS2015 Cordova 项目中使用 TypeScript 的 async / await 功能。 我在 tsconfig.json 中修改了 "target": "es6"

智能感知没有显示任何错误,但是,在构建项目时,它显示:

错误 TS1311 构建:异步函数仅在面向 ECMAScript 6 及更高版本时可用。

但是我已经在 tsconfig.json 中把 target 改成了 es6

我还应该在哪里进行配置才能使构建工作?

谢谢。

【问题讨论】:

    标签: typescript visual-studio-2015 taco


    【解决方案1】:

    tsconfig.json 某些项目类型的文件未被拾取。 TypeScript 1.8 的工作已经完成,as you can read here:

    TypeScript 1.8 允许在所有项目类型中使用 tsconfig.json 文件。

    如果您是 download the 1.8 beta from the announcement page(或等待 1.8 版本),则应尊重您的 tsconfig.json 选项。


    但是,当您打开该功能时,请记住以下几点:

    如果添加 tsconfig.json 文件,则不会编译不属于该上下文的 TypeScript 文件。

    因此,您可能希望确保您的所有项目文件都包含在您的 tsconfig.json 中,无论是明确地还是通过使用 "exclude" 字段。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-23
      • 2014-06-18
      • 1970-01-01
      • 2014-09-26
      相关资源
      最近更新 更多