最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

visual studio code - Disable TypeScript Analyzing on vsCode tsserver on specific path - Stack Overflow

programmeradmin4浏览0评论

I'm not sure whether this is an issue with VS Code or TypeScript.

How can I disable auto-analysis of .ts and .tsx files in a specific folder to stop receiving error and warning notifications?

The exclude option in tsconfig.json doesn't seem to work.

For example, even if there are syntax errors or unused values, files located under the specified path should not display any warnings or errors.

I'm not sure whether this is an issue with VS Code or TypeScript.

How can I disable auto-analysis of .ts and .tsx files in a specific folder to stop receiving error and warning notifications?

The exclude option in tsconfig.json doesn't seem to work.

For example, even if there are syntax errors or unused values, files located under the specified path should not display any warnings or errors.

Share Improve this question asked 2 days ago reaver loverreaver lover 6748 silver badges23 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

There are two solutions I know of:

Solution No. 1

Probably this is not what you are looking for but you can disable TypeScript validation for the entire workspace by adding the following to your .vscode/settings.json:

{
  "typescript.validate.enable": false
}

Solution No. 2

To ignore TypeScript checking for specific files, add the following comment at the top of each file you want to exclude:

// @ts-nocheck

If you want to ignore TypeScript checking on these files permanently, adding this comment to each file is straightforward. However, if you prefer to toggle TypeScript checking on and off, consider writing a script that automatically adds or removes the comment from any .{ts,tsx} files within specified folders.

If you're interested, I can provide an example of how the script would look in TypeScript and Node.js.

发布评论

评论列表(0)

  1. 暂无评论