简体   繁体   English

类型检查无法与.ts文件上的VsCode一起使用

[英]Typechecking not working with VsCode on .ts files

My environment: 我的环境:

  • Visual Code: 1.27.2 可视代码:1.27.2
  • typescript: 3.1.1 打字稿:3.1.1
  • tslint: 5.11.0 tslint:5.11.0

I am writing this simple erroneous of code in a file called server.ts : 我在一个名为server.ts的文件中编写了这个简单的错误代码:

let isDone: boolean = "done"

After running tsc I am getting the compiler error i expect to see: 运行tsc我得到了编译器错误,我希望看到:

src/server.ts:1:5 - error TS2322: Type '1' is not assignable to type 'boolean'.

However, looking at the problems pane of Vscode does not warn me of this error. 但是,查看Vscode的问题窗格不会警告我该错误。 there are no problems reported and no error are being highlighed on the editor. 没有报告任何问题,并且在编辑器上没有出现任何错误。

Is type checking supported in anyway in Vscode? 在Vscode中仍然支持类型检查吗?

解决方法是打开VS Code中的typescript.validate.enable设置,该设置默认情况下处于启用状态,但已以某种方式被关闭。

暂无
暂无

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

相关问题 VsCode 不使用单引号格式化 TS/JS 文件 - VsCode not formatting TS/JS files with single quotes 非 js/ts 文件的 vscode“智能感知”和“转到定义” - vscode "Intellisense" and "Go to definition" for not js/ts files 从 Js 切换到 Ts 后,VSCode 导入不再像以前那样工作 - VSCode imports are not working as they used to after switching from Js to Ts // @ ts-check停止在当前版本的vscode中工作 - //@ts-check stops working in the current version of vscode 类型检查在常规 JS 文件中的 VSCode 中引发错误 - Typechecking throws error in VSCode in regular JS-File 如何在 VSCode 中的同一项目中的 .ts 文件和 .js 文件上运行 typescript-eslint - How to run typescript-eslint on .ts files and eslint on .js files in the same project in VSCode 关闭 .JS /.JSX 文件的 VSCode Typescript 错误并为.TS /.TSX 文件保留它们? - Turn off VSCode Typescript Errors for .JS / .JSX files & keep them for .TS / .TSX files? 如何清除 VSCODE 中的“Type annotations can only be used in TypeScript files.ts(8010)”错误 - How to Clear this "Type annotations can only be used in TypeScript files.ts(8010)" error in VSCODE vscode:摆脱 js 和 ts 文件中的消息:“导出的标识符应该有注释或未导出” - vscode: get rid of message in js and ts files: 'exported identifier should have comment or be unexported' 如何仅对其他非 TS 文件中的特定对象进行 TypeScript 类型检查? - How do I get TypeScript typechecking only for specific objects in an otherwise non-TS file?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM