Skip to content

Commit a5a7169

Browse files
author
Kanchalai Tanglertsampan
committed
Address PR
1 parent 7b525ea commit a5a7169

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/compiler/binder.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -358,16 +358,13 @@ namespace ts {
358358
}
359359
else {
360360
// This is to properly report an error in the case "export default { }" is after export default of class declaration or function declaration.
361-
for (const declaration of symbol.declarations) {
362-
// Error on multiple export default in the following case:
363-
// 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default
364-
// 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers)
365-
if ((declaration.flags & NodeFlags.Default) ||
366-
(declaration.kind === SyntaxKind.ExportAssignment && !(<ExportAssignment>node).isExportEquals)) {
361+
// Error on multiple export default in the following case:
362+
// 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default
363+
// 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers)
364+
if (symbol.declarations && symbol.declarations.length &&
365+
(isDefaultExport || (node.kind === SyntaxKind.ExportAssignment && !(<ExportAssignment>node).isExportEquals))) {
367366
message = Diagnostics.A_module_cannot_have_multiple_default_exports;
368-
break;
369-
}
370-
}
367+
}
371368
}
372369
}
373370

0 commit comments

Comments
 (0)