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: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中时才将配置设置应用于文件部分. [有关tsconfig.json的更多信息]
因此,配置必须包含所有项目文件(或者,如果您具有应用程序的多个部分,则可以包含多个tsconfig.json文件).否则,打字稿服务将使用文件的默认打字稿选项.
首选解决方案
您的 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"->使用TypeScript服务"中禁用Typescript服务集成. /p>
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屋!