WebStorm 2016.3 error: Experimental support for decorators is a feature that is subject to change in a future release
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 部分时才将配置设置应用于文件。 [More info about 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
选项):
注意: 如果您不喜欢新行为,您可以在 "File | Settings | Languages & Frameworks | TypeScript" -> "Use TypeScript service".[=14 中禁用打字稿服务集成=]
也适用于 WebStorm 2020.1.2。谢谢
- 打开文件 -> 设置 -> 语言和框架 -> Typescript
- 在选项输入中添加
--experimentalDecorators --moduleResolution mode
点击右下角的应用按钮
您好,已更新到最新的 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 文件)。否则打字稿服务使用文件的默认打字稿选项。
首选方案
你的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
选项):
注意: 如果您不喜欢新行为,您可以在 "File | Settings | Languages & Frameworks | TypeScript" -> "Use TypeScript service".[=14 中禁用打字稿服务集成=]
也适用于 WebStorm 2020.1.2。谢谢
- 打开文件 -> 设置 -> 语言和框架 -> Typescript
- 在选项输入中添加
--experimentalDecorators --moduleResolution mode
点击右下角的应用按钮