Fix incorrect lib condition again! (#58945)

This commit is contained in:
Sheetal Nandi
2024-06-20 13:18:39 -07:00
committed by GitHub
parent ef079c9dd3
commit beb375a9ca
14 changed files with 496 additions and 37 deletions

View File

@@ -2777,7 +2777,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
return true;
}
if (!options.noLib) {
if (options.noLib) {
return false;
}
@@ -2788,7 +2788,11 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
return equalityComparer(file.fileName, getDefaultLibraryFileName());
}
else {
return some(options.lib, libFileName => equalityComparer(file.fileName, resolvedLibReferences!.get(libFileName)!.actual));
return some(options.lib, libFileName => {
// We might not have resolved lib if one of the root file included contained no-default-lib = true
const resolvedLib = resolvedLibReferences!.get(libFileName);
return !!resolvedLib && equalityComparer(file.fileName, resolvedLib.actual);
});
}
}