Fixing TypeScript Intellisense in VSC
I recently had an issue with my installation of Visual Studio Code where Intellisense wasn’t working properly for my TypeScript projects. All of the suggestions I found on StackOverflow or random blogs pointed to changing the tsconfig.json file, but that never worked. At one point I noticed the version of TypeScript VSC was using was a bit out-dated (2.1.5 instead of 3.x). I clicked on the TypeScript version and noticed in the drop down the global install of TypeScript was pointed to the wrong location.
For me, the fix was to modify my VSC settings and remove the “typescript.tsdk” setting. Once I did that, VisualStudio Code then used the correct global install of TypeScript which was on the latest version. The root cause of my issue is that I had added this setting a while ago for some reason and forgot about it.
If, for some reason, removing this setting doesn’t work for you make sure you have the latest TypeScript installed by typing:
npm install -g typescript@latest
If it still doesn’t work for you, I would suggest adding the “typescript.tsdk” into your settings with the correct npm root. You can find this by typing:
npm root -g
Then adding it to your settings like so:
This tip may not work for everyone but it did work for me.