【发布时间】:2020-04-12 12:19:26
【问题描述】:
我已经在这个警告上搜索了一段时间,并且在我的 tsconfig 文件中设置实验性装饰器似乎并没有消除警告。我正在使用 Angular 进行 Ionic 项目。我使用的 IDE 是 JetBrains 的 webstorm。如果您需要更多信息,请询问。
我的 tsconfig.json 文件:
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": false,
"experimentalDecorators": true,
"allowJs": true,
"emitDecoratorMetadata": true,
"lib": [
"dom",
"es2015"
],
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"target": "es5",
"noUnusedLocals": false,
"noUnusedParameters": false
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules",
"src/**/*.spec.ts",
"src/**/__tests__/*.ts"
],
"compileOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
【问题讨论】:
-
IDE 必须为这些文件使用不同的配置。在多个配置的情况下,Typescript 服务使用最近的
tsconfig.*.json配置当前文件包含在其中,从文件夹扫描文件夹直到项目根目录。如果报告错误的文件包含在某些未启用"experimentalDecorators"的特定配置中,您将看到错误 -
这似乎有效。非常感谢,我会在回答中回顾一下!
标签: typescript warnings webstorm decorator