mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
Merge pull request #20664 from RyanCavanaugh/clearResolutionCache
Clear the module resolution cache when new @types appear
This commit is contained in:
commit
65e92c624b
@ -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…
x
Reference in New Issue
Block a user