diff --git a/src/harness/unittests/typingsInstaller.ts b/src/harness/unittests/typingsInstaller.ts index 77c7f8e17f3..a84520095a4 100644 --- a/src/harness/unittests/typingsInstaller.ts +++ b/src/harness/unittests/typingsInstaller.ts @@ -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"); }); }); diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index a5b09c6a63f..b147a5c3e92 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -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; }