简体   繁体   English

更新依赖项后,如何让我的 Visual Studio Code IDE 更新类型?

[英]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.我正在使用 yarn 来处理我的项目,我正在为我的 IDE 使用 Visual Studio Code。

So I'm working on 2 projects and one of the projects is a dependency for the other project.所以我正在处理 2 个项目,其中一个项目是另一个项目的依赖项。 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?它不会更新 IDE 上的类型,除非我重新启动 IDE。有什么方法可以解决这个问题而不必重新启动 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.在我正在处理的主项目中,这个属性会给我一个错误,说它不存在,除非我重新启动我的 IDE,但是,我有时通过手动打开 nodemodule 来让它工作。

There is a command to "TypeScript: Restart TypeScript Server".有一个命令“TypeScript:重启 TypeScript 服务器”。 I've found this to help solve a multitude of problems.我发现这有助于解决许多问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM