WebStorm 2016.3 错误:对装饰器的实验性支持是一项功能,在未来版本中可能会发生变化 [英] WebStorm 2016.3 error: Experimental support for decorators is a feature that is subject to change in a future release
问题描述
更新到最新的 WebStorm,我现在收到此错误:
Error:(52, 14) TS1219: 对装饰器的实验支持是一项在未来版本中可能会更改的功能.设置 'experimentalDecorators' 选项以删除此警告.
但是在我的 tsConfig experimentalDecorators
中设置为 true:
<代码>{"版本": "1.5.0",编译器选项":{//...,"experimentalDecorators": true,//<======== 这里//...,},文件":[//...],排除":[节点模块"]}
WS2016.3 仅当文件包含在 'files' 或 'include' tsconfig.json 中时,才将配置设置应用于文件部分.[
注意:如果您不喜欢新行为,您可以在文件 | 设置 | 语言和框架 | TypeScript"->使用 TypeScript 服务"中禁用打字稿服务集成.
Hi updated to latest WebStorm and I'm now getting this error:
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.
But in my tsConfig experimentalDecorators
are set to true:
{
"version": "1.5.0",
"compilerOptions": {
//...,
"experimentalDecorators": true, // <======== HERE
//...,
},
"files": [
//...
],
"exclude": [ "node_modules" ]
}
WS2016.3 applies config settings to a file only if the file is included in 'files' or 'include' tsconfig.json section. [More info about tsconfig.json]
So the config must include all project files (or if you have several parts of the app you can have several tsconfig.json files). Otherwise typescript service uses default typescript options for the file.
Preferred solution
Your tsconfig.json should be:
{
"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
}
Another solution
You can specify default options in the TypeScript settings (track changes
option should be unchecked if you don't want auto compilation):
Note: If you don't like the new behaviour you can disable the typescript service integration in "File | Settings | Languages & Frameworks | TypeScript" -> "Use TypeScript service".
这篇关于WebStorm 2016.3 错误:对装饰器的实验性支持是一项功能,在未来版本中可能会发生变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!