mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Add new option "libReplacement" (#60829)
This commit is contained in:
@@ -3937,6 +3937,17 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
|
||||
const existing = resolvedLibProcessing?.get(libFileName);
|
||||
if (existing) return existing;
|
||||
|
||||
if (options.libReplacement === false) {
|
||||
const result: LibResolution = {
|
||||
resolution: {
|
||||
resolvedModule: undefined,
|
||||
},
|
||||
actual: combinePaths(defaultLibraryPath, libFileName),
|
||||
};
|
||||
(resolvedLibProcessing ??= new Map()).set(libFileName, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (structureIsReused !== StructureIsReused.Not && oldProgram && !hasInvalidatedLibResolutions(libFileName)) {
|
||||
const oldResolution = oldProgram.resolvedLibReferences?.get(libFileName);
|
||||
if (oldResolution) {
|
||||
|
||||
Reference in New Issue
Block a user