mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 01:49:57 -05:00
Fix error on duplicate commonjs exports (#40545)
* Fix error on duplicate commonjs exports Previously, the code missed setting the parent pointer for the lhs access expression. Also add declaration emit of element access expressions, missed in my previous PR. * Switch to excludes=None, add test case CommonJS exports have None excludes, but still have an error issued by the checker. This is the previous behaviour even though it would be nice to add some exclusions.
This commit is contained in:
committed by
GitHub
parent
c493d077a3
commit
ec36d73e7a
@@ -2810,8 +2810,8 @@ namespace ts {
|
||||
if (symbol) {
|
||||
const isAlias = isAliasableExpression(node.right) && (isExportsIdentifier(node.left.expression) || isModuleExportsAccessExpression(node.left.expression));
|
||||
const flags = isAlias ? SymbolFlags.Alias : SymbolFlags.Property | SymbolFlags.ExportValue;
|
||||
const excludeFlags = isAlias ? SymbolFlags.AliasExcludes : SymbolFlags.None;
|
||||
declareSymbol(symbol.exports!, symbol, node.left, flags, excludeFlags);
|
||||
setParent(node.left, node);
|
||||
declareSymbol(symbol.exports!, symbol, node.left, flags, SymbolFlags.None);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6831,6 +6831,7 @@ namespace ts {
|
||||
break;
|
||||
case SyntaxKind.BinaryExpression:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
// Could be best encoded as though an export specifier or as though an export assignment
|
||||
// If name is default or export=, do an export assignment
|
||||
// Otherwise do an export specifier
|
||||
|
||||
Reference in New Issue
Block a user