Make getLocalSymbolForExportDefault look harder for an export

Look for a symbol that has a `.localSymbol` property instead of blindly
using the first one.

Fixes #37829.
This commit is contained in:
Eli Barzilay
2020-07-29 11:41:58 -04:00
parent b601487905
commit a320e1b554
5 changed files with 39 additions and 1 deletions

View File

@@ -4769,7 +4769,11 @@ namespace ts {
}
export function getLocalSymbolForExportDefault(symbol: Symbol) {
return isExportDefaultSymbol(symbol) ? symbol.declarations[0].localSymbol : undefined;
if (!isExportDefaultSymbol(symbol)) return undefined;
for (const decl of symbol.declarations) {
if (decl.localSymbol) return decl.localSymbol;
}
return undefined;
}
function isExportDefaultSymbol(symbol: Symbol): boolean {