@@ -98,18 +98,18 @@ namespace ts.codefix {
9898 symbolToken : Node | undefined ,
9999 preferences : UserPreferences ,
100100 ) : { readonly moduleSpecifier : string , readonly codeAction : CodeAction } {
101- const exportInfos = getAllReExportingModules ( exportedSymbol , checker , allSourceFiles ) ;
101+ const exportInfos = getAllReExportingModules ( exportedSymbol , symbolName , checker , allSourceFiles ) ;
102102 Debug . assert ( exportInfos . some ( info => info . moduleSymbol === moduleSymbol ) ) ;
103103 // We sort the best codefixes first, so taking `first` is best for completions.
104104 const moduleSpecifier = first ( getNewImportInfos ( program , sourceFile , exportInfos , compilerOptions , getCanonicalFileName , host , preferences ) ) . moduleSpecifier ;
105105 const ctx : ImportCodeFixContext = { host, program, checker, compilerOptions, sourceFile, formatContext, symbolName, getCanonicalFileName, symbolToken, preferences } ;
106106 return { moduleSpecifier, codeAction : first ( getCodeActionsForImport ( exportInfos , ctx ) ) } ;
107107 }
108- function getAllReExportingModules ( exportedSymbol : Symbol , checker : TypeChecker , allSourceFiles : ReadonlyArray < SourceFile > ) : ReadonlyArray < SymbolExportInfo > {
108+ function getAllReExportingModules ( exportedSymbol : Symbol , symbolName : string , checker : TypeChecker , allSourceFiles : ReadonlyArray < SourceFile > ) : ReadonlyArray < SymbolExportInfo > {
109109 const result : SymbolExportInfo [ ] = [ ] ;
110110 forEachExternalModule ( checker , allSourceFiles , moduleSymbol => {
111111 for ( const exported of checker . getExportsOfModule ( moduleSymbol ) ) {
112- if ( skipAlias ( exported , checker ) === exportedSymbol ) {
112+ if ( exported . escapedName === InternalSymbolName . Default || exported . name === symbolName && skipAlias ( exported , checker ) === exportedSymbol ) {
113113 const isDefaultExport = checker . tryGetMemberInModuleExports ( InternalSymbolName . Default , moduleSymbol ) === exported ;
114114 result . push ( { moduleSymbol, importKind : isDefaultExport ? ImportKind . Default : ImportKind . Named } ) ;
115115 }
0 commit comments