From 23553bb9db2373355bd969209475d7baca8dec7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Sat, 6 Jan 2024 09:53:11 +0100 Subject: [PATCH] `getWithAlternativeContainers` for all containers --- src/compiler/checker.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e28cc8ff79bd8..f3db4943cbfac 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -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);