简体   繁体   English

在VSCode中编辑JavaScript文件时出现TypeScript错误

[英]TypeScript errors while editing JavaScript file in VSCode

Just out of the blue, I've been experiencing weird TypeScript errors in my pure JavaScript files. 出乎意料的是,我在纯JavaScript文件中遇到了奇怪的TypeScript错误。 I don't use TypeScript at all, so I have no idea where this came from. 我根本不使用TypeScript,所以我不知道它来自哪里。 Perhaps I mashed my keyboard and something was enabled? 也许我混搭了键盘并且启用了某些功能? Not sure. 不确定。

Things to note: 注意事项:

  • Nothing referring to TypeScript in my User preferences 在我的用户首选项中没有提及TypeScript
  • The language mode is JavaScript 语言模式是JavaScript

For example, I'm receiving an error [ts] '$var1' is declared but its value is never read. 例如,我收到错误[ts] '$var1' is declared but its value is never read. on hover of a variable that has been declared, just not referenced. 将鼠标悬停在已声明但未引用的变量上。 It also washes out the variable color, which is quite annoying. 它还会洗掉可变的颜色,这很烦人。

两个变量。一个被引用 悬停错误消息

Here are the extensions I'm using: 这是我正在使用的扩展名:

  • Debugger for Chrome Chrome调试器
  • Document This 记录此
  • One Dark Pro 一个黑暗的职业
  • PHP DocBlocker PHP DocBlocker
  • PHP IntelliSense PHP智能感知
  • phpfmt - PHP formatter phpfmt-PHP格式化程序
  • SCSS IntelliSense SCSS智能感知
  • WordPress Snippet WordPress片段

If someone could point me in the right direction I would really appreciate it. 如果有人能指出正确的方向,我将不胜感激。 This is a minor issue, but it's really annoying. 这是一个小问题,但确实很烦人。

As pointed out in the comments, this seems to be an update to VS Code "Highlight unused variables and imports". 正如评论中指出的那样,这似乎是对VS代码“突出显示未使用的变量和导入”的更新。

Here is more info about this release and feature in particular: https://code.visualstudio.com/updates/v1_24#_highlight-unused-variables-and-imports 以下是有关此版本和功能的更多信息,特别是: https : //code.visualstudio.com/updates/v1_24#_highlight-unused-variables-and-imports

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

相关问题 VSCode 中 JavaScript 文件中的 TypeScript 错误 - TypeScript error inside JavaScript file in VSCode 在 Vscode 中编辑 Typescript 文件中的 css 代码时,所有文本都是红色的,我该如何解决? - When editing css code within a Typescript file in Vscode all the text is red, how do i fix this? 停止VSCode在文件重命名时将javascript导入转换为打字稿缓存 - Stop VSCode converting javascript imports to typescript cache on file rename VSCode中的TypeScript错误:“无法写入文件'x',因为它将覆盖输入文件。” - TypeScript errors in VSCode: “Cannot write file 'x' because it would overwrite input file.” hover 中的 VSCode Javascript/Typescript 命名空间 - VSCode Javascript/Typescript namespaces in hover vscode中的JavaScript和打字稿共享片段 - JavaScript and typescript shared snippets in vscode 使用 JavaScript 编辑 XML 文件? - Editing an XML file with JavaScript? 编辑javascript时使用emacs进行重构 - Refactoring with emacs while editing javascript 如何在 JavaScript/VSCode/TypeScript 中声明 setter 的类型? - How to declare the type of a setter in JavaScript/VSCode/TypeScript? NodeJS (JavaScript/TypeScript) - 读取 Parquet 文件时出错 - NodeJS (JavaScript/TypeScript) - Error while reading Parquet file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM