@@ -609,7 +609,7 @@ namespace ts.codefix {
609609 const exported = getDefaultLikeExportWorker ( importingFile , moduleSymbol , checker , compilerOptions ) ;
610610 if ( ! exported ) return undefined ;
611611 const { symbol, kind } = exported ;
612- const info = getDefaultExportInfoWorker ( symbol , moduleSymbol , checker , compilerOptions ) ;
612+ const info = getDefaultExportInfoWorker ( symbol , checker , compilerOptions ) ;
613613 return info && { symbol, kind, ...info } ;
614614 }
615615
@@ -645,7 +645,7 @@ namespace ts.codefix {
645645 return allowSyntheticDefaults ? ImportKind . Default : ImportKind . CommonJS ;
646646 }
647647
648- function getDefaultExportInfoWorker ( defaultExport : Symbol , moduleSymbol : Symbol , checker : TypeChecker , compilerOptions : CompilerOptions ) : { readonly symbolForMeaning : Symbol , readonly name : string } | undefined {
648+ function getDefaultExportInfoWorker ( defaultExport : Symbol , checker : TypeChecker , compilerOptions : CompilerOptions ) : { readonly symbolForMeaning : Symbol , readonly name : string } | undefined {
649649 const localSymbol = getLocalSymbolForExportDefault ( defaultExport ) ;
650650 if ( localSymbol ) return { symbolForMeaning : localSymbol , name : localSymbol . name } ;
651651
@@ -659,23 +659,21 @@ namespace ts.codefix {
659659 // but we can still offer completions for it.
660660 // - `aliased.parent` will be undefined if the module is exporting `globalThis.something`,
661661 // or another expression that resolves to a global.
662- return getDefaultExportInfoWorker ( aliased , aliased . parent , checker , compilerOptions ) ;
662+ return getDefaultExportInfoWorker ( aliased , checker , compilerOptions ) ;
663663 }
664664 }
665665
666666 if ( defaultExport . escapedName !== InternalSymbolName . Default &&
667667 defaultExport . escapedName !== InternalSymbolName . ExportEquals ) {
668668 return { symbolForMeaning : defaultExport , name : defaultExport . getName ( ) } ;
669669 }
670- return { symbolForMeaning : defaultExport , name : moduleSymbolToValidIdentifier ( moduleSymbol , compilerOptions . target ) } ;
670+ return { symbolForMeaning : defaultExport , name : getNameForExportedSymbol ( defaultExport , compilerOptions . target ) } ;
671671 }
672672
673673 function getNameForExportDefault ( symbol : Symbol ) : string | undefined {
674674 return symbol . declarations && firstDefined ( symbol . declarations , declaration => {
675675 if ( isExportAssignment ( declaration ) ) {
676- if ( isIdentifier ( declaration . expression ) ) {
677- return declaration . expression . text ;
678- }
676+ return tryCast ( skipOuterExpressions ( declaration . expression ) , isIdentifier ) ?. text ;
679677 }
680678 else if ( isExportSpecifier ( declaration ) ) {
681679 Debug . assert ( declaration . name . text === InternalSymbolName . Default , "Expected the specifier to be a default export" ) ;
0 commit comments