【发布时间】:2019-07-07 21:29:23
【问题描述】:
在Angular 6.0.3(global Angular CLI v6.0.8,local Angular CLI v6.0.7)中,我突然在打开的每个组件上都遇到了智能感知错误:Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
我在这里尝试了接受答案中的说明:Experimental decorators warning in TypeScript compilation
但我的 tsconfig.json 文件已经有 "experimentalDecorators": true。
我也尝试过关闭和重新打开visual studio code,单击文件树上的refresh 按钮,Reload Window 命令等等等等。
我认为我的问题可能在于我在文件结构中的任何地方都看不到tsconfig.json(所以也许Angular也看不到)。我相信它确实存在,因为我确实看到了tsconfig.app.json,并且这个文件有一个指向tsconfig.json 的链接,我可以通过ctrl + click 跟随tsconfig.json 文件。
我怎样才能找到tsconfig.json 的位置和/或使它与我的开发团队的其他成员一样出现在与tsconfig.app.json 相同的文件级别?
我的tsconfig.app.json 文件:
{
"extends": "../tsconfig.json", //I can ctrl + click here to go to tsconfig.json
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"types": []
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}
我的(丢失/不可见)tsconfig.json 文件:
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}
【问题讨论】:
-
如果您可以使用 ctrl+click 跟随文件,那么 IDE 可能决定不显示它。您能否从文件系统中确认该文件确实存在?
-
您是否尝试过您链接的问题中的任何其他答案(不仅仅是接受的)?您可能应该从那里开始。
-
@fridoo 是的,我做到了。其他的要么与我无关,要么不起作用。我尝试将
"typescript.tsdk": "node_modules/typescript/lib"添加到 settings.json 无济于事。实际上,在重新启动时 vscode 警告我node_modules/typescript/lib不是有效路径。
标签: angular typescript visual-studio-code intellisense tsconfig