【问题标题】:Visual Studio 2019 typescript: Intellisense reports errors that are not errorsVisual Studio 2019 打字稿:Intellisense 报告非错误的错误
【发布时间】:2021-10-05 02:01:50
【问题描述】:

这些错误突然出现在错误列表选项卡中:

但它们并没有出现在文件本身中,一切都按预期工作,即使是 F12。


package.json 中的@types/node(还有 vue、vue-property-decorator 等)。

使用TypeScript 2.9

tsconfig.json

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "strictPropertyInitialization": false,
    "emitDecoratorMetadata": true,
    "allowSyntheticDefaultImports": true,
    "downlevelIteration": true,
    "removeComments": true,
    "moduleResolution": "node",
    "target": "es6",
    "sourceMap": true,
    "skipLibCheck": true,
    "skipDefaultLibCheck": true,
    "noImplicitAny": false
  },
    "exclude": [
      "bin",
      "node_modules"
    ]
}

我错过了什么吗?

【问题讨论】:

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


    【解决方案1】:

    那些是打字稿编译错误。

    您是否使用外部工具(如 webpack)来编译 typescript?如果是这样,通过将以下内容添加到项目的 csproj 文件中来禁用打字稿编译(但保留智能感知):

    <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
    

    【讨论】:

      猜你喜欢
      • 2020-11-22
      • 2021-08-01
      • 2022-10-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-02
      • 2021-04-16
      • 2015-08-04
      相关资源
      最近更新 更多