【问题标题】:Mismatch between VS Code intellisense and TypeScript compilationVS Code 智能感知和 TypeScript 编译不匹配
【发布时间】:2018-01-13 17:37:56
【问题描述】:

当两者都使用相同的 TypeScript 版本时,VS Code 是否可以显示 TypeScript 编译器未捕获的错误?

我的 VS Code 安装使用的是 TypeScript 2.6.2 版。我看到智能感知在我的一个代码文件中检测到错误'Parameter ... implicitly has an 'any' type,但是当我运行 tsc 编译器时,没有错误。

这种行为似乎突然开始了;前一刻代码编辑器是干净的,然后下一刻它在某些行下面有所有这些红线。

【问题讨论】:

  • 可能是tslint(代码样式)错误,而不是语法错误。你的项目中有tslint.json吗?
  • @cubrr 不,我的项目中没有 tslint.json
  • 我假设 vscode 使用 tsconfig.json 文件。如果您的tsc 进程读取的是tsconfig.build.json,则您可能希望查看"noImplicitAny" compiler option 的不匹配。
  • 是的,我认为是 tsconfig.json 和 tsconfig.build.json 不匹配

标签: javascript typescript visual-studio-code intellisense


【解决方案1】:

这是由于 tsconfig.json 和 tsconfig.build.json 不匹配

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-12-08
    • 1970-01-01
    • 1970-01-01
    • 2018-12-01
    • 2017-06-06
    • 2022-10-05
    • 2016-02-15
    • 2018-09-16
    相关资源
    最近更新 更多