I have a project with several tsconfig.json files in different directories. Usually, VS Code uses each tsconfig.json only for the directory it's in.
When I git commit
, I use Husky to run Eslint on the changed files. Eslint uses @typescript-eslint/parser
. After the code commits, I get a ton of Typescript errors in VS Code. Restarting the TS server fixes it, but it's slow for a few minutes (I think it's rebuilding the TS cache?).
I think what's happening is when Eslint runs, it uses one (or more) of the tsconfig.json files, depending on the changed files' location. Then, VS Code somehow detects that a specific tsconfig.json was used, then it uses it for my whole project. I want VS Code to continue using the tsconfig.json files it detected, rather than picking up the tsconfig.json used by Eslint.
What are some things I can try to prevent this? Is there a way to temporarily disable VS Code's TS server while I'm committing code? Or is there a proper way to prevent VS Code from using a tsconfig.json file incorrectly?
Troubleshooting# If you find IntelliSense has stopped working, the language service may not be running. Try restarting VS Code and this should solve the issue. If you are still missing IntelliSense features after installing a language extension, open an issue in the repository of the language extension.
IntelliSense. IntelliSense shows you intelligent code completion, hover information, and signature help so that you can write code more quickly and correctly. VS Code provides IntelliSense for individual TypeScript files as well as TypeScript tsconfig. json projects.
I found the issue:
There are .d.ts
files that are included in multiple tsconfig.json
s. There are some type definitions in different .d.ts
files that override each other, so import order matters. For unknown reasons, after I git commit
, VS Code imports them in a different order.
I fixed it by no longer overriding definitions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With