在 vsCode 中缺少 tsconfig.json 文件和实验装饰器警告

Missing tsconfig.json file and Experimental Decorators warning in vsCode

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.

我已经尝试了此处接受的答案中的说明:

但是我的 tsconfig.json 文件已经有 "experimentalDecorators": true.

我也试过关闭并重新打开 visual studio code、单击文件树上的 refresh 按钮、Reload Window 命令等令人作呕的操作。 我认为我的问题可能在于我在文件结构中的任何地方都看不到 tsconfig.json(所以也许 Angular 也看不到)。我相信它确实存在,因为我确实看到 tsconfig.app.json 并且此文件有一个 link 到 tsconfig.json,我可以 ctrl + click 跟随 tsconfig.json 文件。

如何找到 tsconfig.json and/or 的位置,使其与我的开发团队的其他成员一样出现在与 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"
  ]
}  

我的(missing/invisible)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"
    ]
  }
}

啊 - 知道了。我意识到我在文件树的最高级别看不到 node_modules 文件夹,也看不到 tsconfig.json。我不小心指示 vsCode 只打开 src 文件夹,而不是 src 和 node_modules.

的父文件夹

我打开了一个新的 vscode window,关闭了旧的并确保当我点击文件 --> 打开文件夹时,我指向包含 src 和 [=21= 的父文件夹].这也是tsconfig.json存在的水平,这就是为什么我之前看不到它的原因。

智能感知错误消失了,我想是因为 Angular 现在可以实际看到 tsconfig.json(已经有 "experimentalDecorators":true)。