Kiril
Kiril

Reputation: 40395

Hide both ts and tsx generated JS files in Visual Studio Code

This question has previously been asked for hiding .js and .js.map files, when there is a .ts file with the same basename. The answer is that you set your VS Code settings to exclude "**/*.js": {"when": "$(basename).ts"}.

However, I'm wondering how I can hide the .js files when the basename is either .ts or .tsx. I need VS Code to check for either extension.

Essentially I need to have both "**/*.js": {"when": "$(basename).ts"} and "**/*.js": {"when": "$(basename).tsx"}. Any ideas on how to get that done?

Upvotes: 1

Views: 1388

Answers (1)

alefragnani
alefragnani

Reputation: 3313

You can do that with a bit of a trick, as mentioned in VS Code documentation.

To exclude JavaScript files generated from both .ts and .tsx source files, use this expression:

"**/*.js": { "when": "$(basename).ts" }, "**/**.js": { "when": "$(basename).tsx" }

There is an open issue tracking a similar request, but no ETA at the moment.

Upvotes: 7

Related Questions