gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 17:02:29 24 4
gpt4 key购买 nike

您好,已更新到最新的 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com