mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-24 20:44:53 -05:00
Fix crash on addImportFromExportedSymbol with default exported symbol (#52694)
This commit is contained in:
committed by
GitHub
parent
7fb6c99c19
commit
7612a3afc7
@@ -3959,8 +3959,12 @@ function needsNameFromDeclaration(symbol: Symbol) {
|
||||
return !(symbol.flags & SymbolFlags.Transient) && (symbol.escapedName === InternalSymbolName.ExportEquals || symbol.escapedName === InternalSymbolName.Default);
|
||||
}
|
||||
|
||||
function getDefaultLikeExportNameFromDeclaration(symbol: Symbol) {
|
||||
return firstDefined(symbol.declarations, d => isExportAssignment(d) ? tryCast(skipOuterExpressions(d.expression), isIdentifier)?.text : undefined);
|
||||
function getDefaultLikeExportNameFromDeclaration(symbol: Symbol): string | undefined {
|
||||
return firstDefined(symbol.declarations, d =>
|
||||
isExportAssignment(d)
|
||||
? tryCast(skipOuterExpressions(d.expression), isIdentifier)?.text
|
||||
: tryCast(getNameOfDeclaration(d), isIdentifier)?.text
|
||||
);
|
||||
}
|
||||
|
||||
function getSymbolParentOrFail(symbol: Symbol) {
|
||||
|
||||
Reference in New Issue
Block a user