简体   繁体   English

VS Code 不对打字稿文件进行类型检查

[英]VS Code not doing type checking on typescript files

I'm trying to convert an existing codebase from flowtype to typescript, but VS Code will not report type errors in .ts files as expected.我正在尝试将现有代码库从 flowtype 转换为 typescript,但 VS Code 不会按预期报告.ts文件中的类型错误。

在此处输入图片说明

Running tsc works as expected:运行tsc按预期工作:

在此处输入图片说明

  • I installed typescript and tslint as npm devDependencies .我安装了typescripttslint为NPM devDependencies
  • I added a <root>/tsconfig.json file.我添加了一个<root>/tsconfig.json文件。
  • I added a test file in <root>/frontend/ts-example.ts with types that should fail very badly.我在<root>/frontend/ts-example.ts添加了一个测试文件,其类型应该会非常失败。
  • Tried adding "typescript.validate.enable": true to my settings.json but it complained that was an unsupported setting.尝试添加"typescript.validate.enable": true到我的settings.json但它抱怨这是一个不受支持的设置。

What could I be missing here?我会在这里错过什么?

Welp, uh...咳咳……

I had the "TypeScript and JavaScript Language Features" extension disabled in my workspace.我在我的工作区中禁用了“TypeScript 和 JavaScript 语言功能”扩展。

Yep, that'll do it...是的,这样就可以了...

In case anyone in the future is as stupid as I am, check: VS Code Extensions > Disabled.如果将来有人像我一样愚蠢,请检查:VS Code Extensions > Disabled。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM