Search code examples
javascripttypescriptvisual-studio-codeyarnpkg

How do I get my Visual Studio Code IDE to update the types after I update a dependency?


I'm using yarn to handle my project and I'm using Visual Studio Code for my IDE.

So I'm working on 2 projects and one of the projects is a dependency for the other project. Whenever I publish an update of the dependency and then update the main project. It will not update the types on the IDE unless I restart the IDE. Any way to fix this without having to restart the IDE?

For example:

export class Test {
  var a: string;
  var b: string;
  var c: string; <--- lets say I added this property and updated it
}

In the main project, I'm working on, this property will give me an error saying it does not exist unless I restart my IDE, however, I have sometimes got it to work by manually opening the nodemodule.


Solution

  • There is a command to "TypeScript: Restart TypeScript Server". I've found this to help solve a multitude of problems.