1

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?

Kiril
  • 39,672
  • 31
  • 167
  • 226

1 Answers1

6

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.

alefragnani
  • 2,478
  • 11
  • 16