将 ng cli 更新到版本 10 后,VS 2019 没有智能感知和验证

mra*_*api 9 visual-studio typescript angular-cli angular visual-studio-2019

我已将我的 .NET core 3.1+Angular 9.1 更新为 Angular 10.0.2,我使用的步骤:

  1. 将 Vs TypeScript 更新为3.9.5
  2. ng update @angular/core @angular/cli

之后 VS 2019 v 16.6.3 没有显示智能感知和验证,项目运行没有问题。如果我在 VS Code 中打开项目一切正常

我发现问题就在我跑完之后 ng update @angular/cli

将项目恢复到 9.1 一切正常

谢谢

小智 17

将项目升级到 Angular 10 后,我遇到了同样的问题。 最新版本的 Visual Studio 2019 似乎没有处理对 tsconfig.json 文件的更改和引入 tsconfig.base.json 的问题。

作为在 VS 2019 中解决此问题之前的一种解决方法,我将 tsconfig.base.json 的内容复制到 tsconfig.json 并注释掉升级后的配置。

我现在有一个看起来像这样的文件,并且恢复了旧功能

/*
  This is a "Solution Style" tsconfig.json file, and is used by editors and TypeScript’s language server to improve development experience.
  It is not intended to be used to perform a compilation.

  To learn more about this file see: https://angular.io/config/solution-tsconfig.

  removed this as causes vs 2019 to fail - the config details are copied from base so when this is sort we can revert

  "files": [],
  "references": [
    {
      "path": "./src/tsconfig.app.json"
    },
    {
      "path": "./src/tsconfig.spec.json"
    },
    {
      "path": "./src/tsconfig.server.json"
    },
    {
      "path": "./e2e/tsconfig.e2e.json"
    }
  ]

*/
{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "module": "esnext",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  },
  "angularCompilerOptions": {
    "enableIvy": true
  }
}
Run Code Online (Sandbox Code Playgroud)