【问题标题】:How to make Visual Studio Code show really all TypeScript type errors?如何让 Visual Studio Code 真正显示所有 TypeScript 类型错误?
【发布时间】:2019-08-02 18:51:24
【问题描述】:

在我的 TypeScript/React 项目中,“react-scripts start”显示了在我的 Visual Studio Code IDE 中未内联显示的类型错误。 大多数类型错误实际上是内联显示的,但不是全部。 这可能是什么原因?如何让 Visual Studio Code 直接显示所有错误?

VS Code 设置“typescript.validate.enable”设置为 true

我的 tsconfig.json:

{
  ...
  "compilerOptions": {
    ....
    "noImplicitAny": true,
    "strictBindCallApply": true,
    "strictFunctionTypes": true,
    "strictPropertyInitialization": true,
    "strictNullChecks": true,
    ...
  }
  ...
}

【问题讨论】:

    标签: typescript visual-studio-code


    【解决方案1】:

    我不太确定这是否是您问题的解决方案,但对我来说,当 VSCODE 运行在与您的构建不同的版本上时,我经常遇到您所描述的问题。

    在右上角,您可以选择要在 Visual Studio Code 中使用的版本:

    只需单击版本号(图像中的 3.0.3)并从您的工作区中选择版本,而不是 vscode 中安装的最新版本!

    【讨论】:

      猜你喜欢
      • 2017-05-25
      • 1970-01-01
      • 2017-04-13
      • 2022-07-13
      • 1970-01-01
      • 1970-01-01
      • 2017-12-05
      • 1970-01-01
      • 2019-10-09
      相关资源
      最近更新 更多