Skip to content

Commit ee30798

Browse files
authored
Merge pull request #26603 from minestarks/release-3.0-undefinedprogram
Port #25835 to release-3.0
2 parents d222c95 + 07da121 commit ee30798

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/compiler/resolutionCache.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ namespace ts {
5252
getGlobalCache?(): string | undefined;
5353
writeLog(s: string): void;
5454
maxNumberOfFilesToIterateForInvalidation?: number;
55-
getCurrentProgram(): Program;
55+
getCurrentProgram(): Program | undefined;
5656
}
5757

5858
interface DirectoryWatchesOfFailedLookup {
@@ -497,7 +497,8 @@ namespace ts {
497497
}
498498

499499
function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions: ResolutionWithFailedLookupLocations[], name: string) {
500-
const updateResolution = resolutionHost.getCurrentProgram().getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name) ?
500+
const program = resolutionHost.getCurrentProgram();
501+
const updateResolution = program && program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name) ?
501502
setRefCountToUndefined : watchFailedLookupLocationOfResolution;
502503
resolutions.forEach(updateResolution);
503504
}

0 commit comments

Comments
 (0)