如何在 VSCode 中禁用 TypeScript 警告?

我暂时不使用 TypeScript,只使用带有 bel 的 ES6。
我没有在 Node _ module中安装 TypeScript。

每次我打开一个工作区,VSCode 都会给我一个特别的警告。

\node_modules\typescript\lib没有指向有效的 服务员安装。回到绑定的 TypeScript 版本。

我怎样才能摆脱这些警告? 或者我应该更换编辑器,以便感到平静?

77627 次浏览

TypeScript and JavaScript validation can be turned off in VS Code with these two settings:

"typescript.validate.enable": false,
"javascript.validate.enable": false,

I was having a similar problem. I had an incorrect setting for typescript.tsdk in my user settings:

"typescript.tsdk": null

To fix it, you can either set the location to a valid location:

"typescript.tsdk": "/usr/local/lib/node_modules/typescript/lib",

or just remove the line from your settings if are not using Typescript.

If you need more detail, I found the VSCode docs to be very concise and easy to understand.

If you want to modify a setting, open the settings option (there is a new settings editor by the time I am writing this) and search for the setting you want to modify. I was attempting to change the typescript validation, but I wasn't allowed as the document was read only. If you hover over the setting, you get a pen on the left of the setting. If you right click on the pen, it will give you the option of true or false, as for my case I was targeting "typescript.validate.enable". I changed it to false, which in turn, VS code copied the code into the right of the screen with the new value. In short, the left is the settings.json file. On the right, you have the user-settings.json. You are only allowed to modify the user settings and the user setting can override any settings in the main settings.json file. -Kf

enter image description here

  1. open the command palette : CTRL + SHIFT + P

  2. open the file settings.json :

enter image description here

  1. add these 2 lines of code:

    "typescript.validate.enable": false,
    "javascript.validate.enable": false,
    

As per here, you can disable built-in extensions in VSCode now. In the Extensions tab on the left (Ctrl+Shift+X), search for @builtin + JavaScript / TypeScript. Then click the little gear icon next to an Extension and click Disable.

I disabled TypeScript and JavaScript Language Features (there is a JavaScript Language Basics Extension) and TypeScript Language Basics.

In my case it was caused because there was extension that used vscode.typescript-language-features extension.

I still wanted javascript errors to be shown so "javascript.validate.enable": false, wasn't an option.

By disabling the extension "VueDX" that was using the @builtin extension it fixed the issue and still shows javascript syntax errors.

You can search all the typescript extensions by searching on @builtin typescript