@@ -410,13 +410,22 @@ namespace ts {
410410 }
411411 }
412412
413- forEach ( symbol . declarations , declaration => {
414- file . bindDiagnostics . push ( createDiagnosticForNode ( getNameOfDeclaration ( declaration ) || declaration , message , getDisplayName ( declaration ) ) ) ;
415- } ) ;
416413 const declarationName = getNameOfDeclaration ( node ) || node ;
417- const diag = createDiagnosticForNode ( declarationName , message , getDisplayName ( node ) )
414+ const relatedInformation : DiagnosticRelatedInformation [ ] = [ ] ;
415+ forEach ( symbol . declarations , ( declaration , index ) => {
416+ const decl = getNameOfDeclaration ( declaration ) || declaration ;
417+ const diag = createDiagnosticForNode ( decl , message , getDisplayName ( declaration ) ) ;
418+ file . bindDiagnostics . push (
419+ multipleDefaultExports ? addRelatedInfo ( diag , createDiagnosticForNode ( declarationName , index === 0 ? Diagnostics . Another_export_default_is_here : Diagnostics . and_here ) ) : diag
420+ ) ;
421+ if ( multipleDefaultExports ) {
422+ relatedInformation . push ( createDiagnosticForNode ( decl , Diagnostics . The_first_export_default_is_here ) ) ;
423+ }
424+ } ) ;
425+
426+ const diag = createDiagnosticForNode ( declarationName , message , getDisplayName ( node ) ) ;
418427 file . bindDiagnostics . push (
419- multipleDefaultExports ? addRelatedInfo ( diag , createDiagnosticForNode ( declarationName , Diagnostics . This_export_conflicts_with_the_first ) ) : diag
428+ multipleDefaultExports ? addRelatedInfo ( diag , ... relatedInformation ) : diag
420429 ) ;
421430
422431 symbol = createSymbol ( SymbolFlags . None , name ) ;
0 commit comments