[英]Missing tsconfig.json file and Experimental Decorators warning in vsCode
In Angular 6.0.3
( global Angular CLI v6.0.8
, local Angular CLI v6.0.7
) I'm suddenly getting intellisense errors on every component that I open: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
在
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 support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
I've tried the instructions from the accepted answer here: Experimental decorators warning in TypeScript compilation 我在这里尝试了接受的答案中的说明: TypeScript编译中的实验装饰器警告
But my tsconfig.json file already had "experimentalDecorators": true
. 但是我的tsconfig.json文件已经具有
"experimentalDecorators": true
。
I've also tried closing and re-opening visual studio code
, clicking the refresh
button on the file tree, Reload Window
command etc etc ad nauseum. 我也尝试过关闭和重新打开
visual studio code
,单击文件树上的refresh
按钮, Reload Window
命令等,等等。 I think my issue may lie in the fact that I can't see tsconfig.json
anywhere in my file structure (so perhaps neither can Angular). 我认为我的问题可能在于我的文件结构中的任何地方都看不到
tsconfig.json
(所以Angular可能也看tsconfig.json
)。 I believe it does exist because I do see tsconfig.app.json
and this file has a link to tsconfig.json
which I can ctrl + click
to follow to the tsconfig.json
file. 我相信它确实存在,因为我确实看到了
tsconfig.app.json
并且此文件具有指向tsconfig.json
的链接,我可以tsconfig.json
ctrl + click
以跟随至tsconfig.json
文件。
How can I find the location of tsconfig.json
and/or make it appear at the same file level as tsconfig.app.json
like the rest of my dev team has? 我如何才能找到
tsconfig.json
的位置和/或使其像其他开发团队一样与tsconfig.app.json
出现在同一文件级别?
My tsconfig.app.json
file: 我的
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"
]
}
My (missing/invisible) tsconfig.json
file: 我的(遗失/不可见)
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"
]
}
}
Ah - got it. 啊-知道了 I realized I couldn't see the
node_modules
folder at the highest level of my file tree, nor tsconfig.json
. 我意识到我在文件树的最高层看不到
node_modules
文件夹,也看tsconfig.json
。 I had accidentally directed vsCode to open only the src folder, rather than the parent folder of src and node_modules. 我意外地指示vsCode仅打开src文件夹,而不打开src和node_modules的父文件夹。
I opened a new vscode window, closed the old and made sure when I clicked file --> open folder, I pointed to the parent folder containing both src and node_modules. 我打开一个新的vscode窗口,关闭旧的窗口,并确保在单击文件->打开文件夹时,我指向包含src和node_modules的父文件夹。 This is also the level where tsconfig.json exists, which is why I couldn't see it prior.
这也是tsconfig.json所在的级别,这就是为什么我之前看不到它的原因。
The intellisense errors went away, I assume because Angular can now actually see tsconfig.json (which already had "experimentalDecorators": true). 我认为,Intellisense错误消失了,因为Angular现在可以实际看到tsconfig.json(它已经具有“ experimentalDecorators”:true)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.