Skip to content

Commit 6074b3e

Browse files
committed
Consistently error on more than one 'export default'
1 parent 3f0cfe3 commit 6074b3e

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/compiler/binder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,11 +531,11 @@ module ts {
531531
case SyntaxKind.ExportAssignment:
532532
if ((<ExportAssignment>node).expression.kind === SyntaxKind.Identifier) {
533533
// An export default clause with an identifier exports all meanings of that identifier
534-
declareSymbol(container.symbol.exports, container.symbol, <Declaration>node, SymbolFlags.Alias, SymbolFlags.AliasExcludes);
534+
declareSymbol(container.symbol.exports, container.symbol, <Declaration>node, SymbolFlags.Alias, SymbolFlags.PropertyExcludes | SymbolFlags.AliasExcludes);
535535
}
536536
else {
537537
// An export default clause with an expression exports a value
538-
declareSymbol(container.symbol.exports, container.symbol, <Declaration>node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
538+
declareSymbol(container.symbol.exports, container.symbol, <Declaration>node, SymbolFlags.Property, SymbolFlags.PropertyExcludes | SymbolFlags.AliasExcludes);
539539
}
540540
bindChildren(node, 0, /*isBlockScopeContainer*/ false);
541541
break;

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ module ts {
613613
return resolveEntityName(<Identifier>node.expression, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace);
614614
}
615615

616-
function getTargetOfImportDeclaration(node: Declaration): Symbol {
616+
function getTargetOfAliasDeclaration(node: Declaration): Symbol {
617617
switch (node.kind) {
618618
case SyntaxKind.ImportEqualsDeclaration:
619619
return getTargetOfImportEqualsDeclaration(<ImportEqualsDeclaration>node);
@@ -640,7 +640,7 @@ module ts {
640640
if (!links.target) {
641641
links.target = resolvingSymbol;
642642
let node = getDeclarationOfAliasSymbol(symbol);
643-
let target = getTargetOfImportDeclaration(node);
643+
let target = getTargetOfAliasDeclaration(node);
644644
if (links.target === resolvingSymbol) {
645645
links.target = target || unknownSymbol;
646646
}

src/compiler/utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ module ts {
848848
node.kind === SyntaxKind.NamespaceImport ||
849849
node.kind === SyntaxKind.ImportSpecifier ||
850850
node.kind === SyntaxKind.ExportSpecifier ||
851-
node.kind === SyntaxKind.ExportAssignment;
851+
node.kind === SyntaxKind.ExportAssignment && (<ExportAssignment>node).expression.kind === SyntaxKind.Identifier;
852852
}
853853

854854
export function getClassBaseTypeNode(node: ClassDeclaration) {

0 commit comments

Comments
 (0)