Merge pull request #20664 from RyanCavanaugh/clearResolutionCache
Clear the module resolution cache when new @types appear
This commit is contained in:
commit
65e92c624b
2 changed files with 4 additions and 2 deletions
|
@ -1009,7 +1009,7 @@ namespace ts.projectSystem {
|
|||
installer.installAll(/*expectedCount*/ 1);
|
||||
});
|
||||
|
||||
it("cached unresolved typings are not recomputed if program structure did not change", () => {
|
||||
it("should recompute resolutions after typings are installed", () => {
|
||||
const host = createServerHost([]);
|
||||
const session = createSession(host);
|
||||
const f = {
|
||||
|
@ -1051,7 +1051,7 @@ namespace ts.projectSystem {
|
|||
session.executeCommand(changeRequest);
|
||||
host.checkTimeoutQueueLengthAndRun(2); // This enqueues the updategraph and refresh inferred projects
|
||||
const version2 = proj.getCachedUnresolvedImportsPerFile_TestOnly().getVersion();
|
||||
assert.equal(version1, version2, "set of unresolved imports should not change");
|
||||
assert.notEqual(version1, version2, "set of unresolved imports should change");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -547,9 +547,11 @@ namespace ts.server {
|
|||
}
|
||||
switch (response.kind) {
|
||||
case ActionSet:
|
||||
project.resolutionCache.clear();
|
||||
this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typeAcquisition, response.unresolvedImports, response.typings);
|
||||
break;
|
||||
case ActionInvalidate:
|
||||
project.resolutionCache.clear();
|
||||
this.typingsCache.deleteTypingsForProject(response.projectName);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue