@@ -770,8 +770,11 @@ namespace ts.codefix {
770770 const defaultExport = checker . tryGetMemberInModuleExports ( InternalSymbolName . Default , moduleSymbol ) ;
771771 if ( defaultExport ) {
772772 const localSymbol = getLocalSymbolForExportDefault ( defaultExport ) ;
773- if ( ( localSymbol && localSymbol . escapedName === symbolName || moduleSymbolToValidIdentifier ( moduleSymbol , context . compilerOptions . target ) === symbolName )
774- && checkSymbolHasMeaning ( localSymbol || defaultExport , currentTokenMeaning ) ) {
773+ if ( (
774+ localSymbol && localSymbol . escapedName === symbolName ||
775+ getEscapedNameForExportDefault ( defaultExport ) === symbolName ||
776+ moduleSymbolToValidIdentifier ( moduleSymbol , context . compilerOptions . target ) === symbolName
777+ ) && checkSymbolHasMeaning ( localSymbol || defaultExport , currentTokenMeaning ) ) {
775778 // check if this symbol is already used
776779 const symbolId = getUniqueSymbolId ( localSymbol || defaultExport , checker ) ;
777780 symbolIdActionMap . addActions ( symbolId , getCodeActionForImport ( moduleSymbol , { ...context , kind : ImportKind . Default } ) ) ;
@@ -784,6 +787,23 @@ namespace ts.codefix {
784787 const symbolId = getUniqueSymbolId ( exportSymbolWithIdenticalName , checker ) ;
785788 symbolIdActionMap . addActions ( symbolId , getCodeActionForImport ( moduleSymbol , { ...context , kind : ImportKind . Named } ) ) ;
786789 }
790+
791+ function getEscapedNameForExportDefault ( symbol : Symbol ) : __String | undefined {
792+ const declarations = symbol . declarations ;
793+ if ( length ( declarations ) > 0 ) {
794+ const declaration = declarations [ 0 ] ;
795+ if ( isExportAssignment ( declaration ) ) {
796+ if ( isIdentifier ( declaration . expression ) ) {
797+ return declaration . expression . escapedText ;
798+ }
799+ }
800+ else if ( isExportSpecifier ( declaration ) ) {
801+ if ( declaration . propertyName ) {
802+ return declaration . propertyName . escapedText ;
803+ }
804+ }
805+ }
806+ }
787807 } ) ;
788808
789809 return symbolIdActionMap . getAllActions ( ) ;
0 commit comments