diff --git a/packages/language-server/src/plugins/typescript/service.ts b/packages/language-server/src/plugins/typescript/service.ts index c581eadf0..5f2571e75 100644 --- a/packages/language-server/src/plugins/typescript/service.ts +++ b/packages/language-server/src/plugins/typescript/service.ts @@ -719,8 +719,13 @@ async function createLanguageService( dirty = false; + if (!oldProgram) { + changedFilesForExportCache.clear(); + return; + } + for (const fileName of changedFilesForExportCache) { - const oldFile = oldProgram?.getSourceFile(fileName); + const oldFile = oldProgram.getSourceFile(fileName); const newFile = program?.getSourceFile(fileName); // file for another tsconfig