mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-26 10:43:51 -05:00
Support element access aliases: exports["x"] = x (#40514)
This commit is contained in:
committed by
GitHub
parent
eee799fe0c
commit
9c99870058
@@ -2408,7 +2408,7 @@ namespace ts {
|
||||
|| node.kind === SyntaxKind.ExportSpecifier
|
||||
|| node.kind === SyntaxKind.ExportAssignment && exportAssignmentIsAlias(<ExportAssignment>node)
|
||||
|| isBinaryExpression(node) && getAssignmentDeclarationKind(node) === AssignmentDeclarationKind.ModuleExports && exportAssignmentIsAlias(node)
|
||||
|| isPropertyAccessExpression(node)
|
||||
|| isAccessExpression(node)
|
||||
&& isBinaryExpression(node.parent)
|
||||
&& node.parent.left === node
|
||||
&& node.parent.operatorToken.kind === SyntaxKind.EqualsToken
|
||||
@@ -2803,7 +2803,7 @@ namespace ts {
|
||||
return getTargetOfAliasLikeExpression(expression, dontRecursivelyResolve);
|
||||
}
|
||||
|
||||
function getTargetOfPropertyAccessExpression(node: PropertyAccessExpression, dontRecursivelyResolve: boolean): Symbol | undefined {
|
||||
function getTargetOfAccessExpression(node: AccessExpression, dontRecursivelyResolve: boolean): Symbol | undefined {
|
||||
if (!(isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === SyntaxKind.EqualsToken)) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -2836,8 +2836,9 @@ namespace ts {
|
||||
return resolveEntityName((node as ShorthandPropertyAssignment).name, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, /*ignoreErrors*/ true, dontRecursivelyResolve);
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
return getTargetOfPropertyAssignment(node as PropertyAssignment, dontRecursivelyResolve);
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
return getTargetOfPropertyAccessExpression(node as PropertyAccessExpression, dontRecursivelyResolve);
|
||||
return getTargetOfAccessExpression(node as AccessExpression, dontRecursivelyResolve);
|
||||
default:
|
||||
return Debug.fail();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user