Skip to content

Commit

Permalink
getWithAlternativeContainers for all containers
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed Jan 6, 2024
1 parent 5ef3a8e commit 4b7ce35
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5626,7 +5626,17 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
return undefined;
}
const containers = mapDefined(candidates, candidate => getAliasForSymbolInContainer(candidate, symbol) ? candidate : undefined);
return containers.length === 1 ? getWithAlternativeContainers(containers[0]) : containers;

let bestContainers: Symbol[] = [];
let alternativeContainers: Symbol[] = [];

for (const container of containers) {
const [bestMatch, ...rest] = getWithAlternativeContainers(container);
bestContainers = append(bestContainers, bestMatch);
alternativeContainers = addRange(alternativeContainers, rest);
}

return concatenate(bestContainers, alternativeContainers);

function getWithAlternativeContainers(container: Symbol) {
const additionalContainers = mapDefined(container.declarations, fileSymbolIfFileSymbolExportEqualsContainer);
Expand Down

0 comments on commit 4b7ce35

Please sign in to comment.