Pass in information for the module name resolution when resolutions from file are partially used (#49738)

* Test showing wrong resolution is returned because of incorrect mode calculation
Test for #48229

* Pass in information for the module name resolution when resolutions from file are partially used
Fixes #48229

* Make the resolution info complete
This commit is contained in:
Sheetal Nandi
2022-11-07 11:51:04 -08:00
committed by GitHub
parent fa4b49d541
commit 7b0df1ff99
14 changed files with 559 additions and 97 deletions
+6 -1
View File
@@ -7193,6 +7193,11 @@ namespace ts {
/* @internal */
export type HasChangedAutomaticTypeDirectiveNames = () => boolean;
export interface ModuleResolutionInfo {
names: readonly StringLiteralLike[];
reusedNames: readonly StringLiteralLike[] | undefined;
}
export interface CompilerHost extends ModuleResolutionHost {
getSourceFile(fileName: string, languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined;
getSourceFileByPath?(fileName: string, path: Path, languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined;
@@ -7213,7 +7218,7 @@ namespace ts {
* If resolveModuleNames is implemented then implementation for members from ModuleResolutionHost can be just
* 'throw new Error("NotImplemented")'
*/
resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[];
resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile, resolutionInfo?: ModuleResolutionInfo): (ResolvedModule | undefined)[];
/**
* Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it
*/