angular - WebStorm 2016.3 错误 : Experimental support for decorators is a feature that is subject to change in a future release

标签 angular meteor typescript phpstorm webstorm

您好,已更新到最新的 WebStorm,我现在收到此错误:

Error:(52, 14) TS1219:Experimental support for decorators 
is a feature that is subject to change in a future release. 
Set the 'experimentalDecorators' option to remove this warning.

但是在我的 tsConfig 中 experimentalDecorators 被设置为 true:

{
  "version": "1.5.0",
  "compilerOptions": {
    //...,
    "experimentalDecorators": true,   // <======== HERE
    //...,
  },
  "files": [
    //...
  ],
  "exclude": [ "node_modules" ]
}

最佳答案

WS2016.3 仅当文件包含在“files”或“include”tsconfig.json 部分时,才将配置设置应用于文件。 [ More info about tsconfig.json ]

因此配置必须包含所有项目文件(或者如果您有应用程序的多个部分,您可以有多个 tsconfig.json 文件)。否则 typescript 服务使用文件的默认 typescript 选项。

首选解决方案

你的 tsconfig.json 应该是:

{
  "version": "1.5.0",
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "noImplicitAny": false,
    "removeComments": true,
    "noLib": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true, 
    "sourceMap": true,
    "listFiles": true,
    "isolatedModules": false,
    "moduleResolution": "node",
    "suppressImplicitAnyIndexErrors": true
  },
  "include": [
    "typings/thera/thera.d.ts",
    "typings/browser.d.ts",
    "typings/main.d.ts",
    "typings/meteor.d.ts",
    "typings/meteor_server.d.ts",
    "your_app_directory/**/*" 
  ],
  "exclude": [ "node_modules" ],
  "compileOnSave":false //not required but is suggested for meteor projects
}

另一种解决方案

您可以在 TypeScript 设置中指定默认选项(如果您不想自动编译,则应取消选中 track changes 选项):

TypeScript Settings

注意:如果您不喜欢新行为,您可以在“文件 | 设置 | 语言和框架 | TypeScript” -> “使用 TypeScript 服务”中禁用 TypeScript 服务集成。

关于angular - WebStorm 2016.3 错误 : Experimental support for decorators is a feature that is subject to change in a future release,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40728785/

相关文章:

java - 如何在 Angular post 方法中传递 json 数组以及如何在 Api 中获取该数组?

meteor :ReferenceError:未定义帐户

angular - 更新到 Angular 10 错误 : Failed to parse "tsconfig.json" as JSON AST Object

html - 格式化数据 block

javascript - meteor :更改点击链接的类别

meteor - 为什么 Meteor 方法要放在 models.js 文件中?

TypeScript:Promise.all 不处理联合类型

css - 使用 Typescript 和 ReactJs 处理样式

unit-testing - Angular 2 单元测试组件,模拟 ContentChildren

angular - 如何将多个文件从 Angular 作为 FormData 发送到 Spring Boot 作为 MultipartFile[]?