一些打字稿错误仅在Visual Studio中的项目构建上显示,而没有显示文本编辑器错误

时间:2020-02-13 01:35:03

标签: typescript visual-studio visual-studio-2019

我正在VS2019中使用一个打字稿文件,并且遇到一个问题,我在运行项目构建时(而不是在保存时)仅在构建输出中看到一些错误。

我也看不到这些错误在文本编辑器中显示为扭曲。我也安装了Microsoft.TypeScript.MSBuild软件包。

尽管noEmitOnError设置为true,但打字稿错误也导致我的构建失败

这是我的tsconfig:

{
  "compileOnSave": true,
  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "ES2015",
    "strict": true,
    "allowJs": true
  },
  "include": [
    "./wwwroot/js/pages/**/*"
  ],
  "exclude": [
    "node_modules"
  ],
  "typeRoots": [
    "./node_modules/@types"
  ]
}

这些是我的npm软件包

  "devDependencies": {
    "@types/jquery": "3.3.32",
    "@types/lodash": "4.14.149",
    "@types/moment": "2.13.0"
  }

这是我的msbuild配置:

<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="3.7.4">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

这是问题的屏幕截图:

No errors in text editor

关于如何解决此问题的任何想法?

更新

我能够通过重新启动PC来解决此问题

0 个答案:

没有答案