mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-09 07:55:10 -05:00
Allow semantic operations to be performed on property names.
Provide the property symbol of the type being destructured when referring to the property name.
This commit is contained in:
@@ -12352,10 +12352,21 @@ namespace ts {
|
||||
return getSymbolOfNode(node.parent);
|
||||
}
|
||||
|
||||
if (node.kind === SyntaxKind.Identifier && isInRightSideOfImportOrExportAssignment(<Identifier>node)) {
|
||||
return node.parent.kind === SyntaxKind.ExportAssignment
|
||||
? getSymbolOfEntityNameOrPropertyAccessExpression(<Identifier>node)
|
||||
: getSymbolOfPartOfRightHandSideOfImportEquals(<Identifier>node);
|
||||
if (node.kind === SyntaxKind.Identifier) {
|
||||
if (isInRightSideOfImportOrExportAssignment(<Identifier>node)) {
|
||||
return node.parent.kind === SyntaxKind.ExportAssignment
|
||||
? getSymbolOfEntityNameOrPropertyAccessExpression(<Identifier>node)
|
||||
: getSymbolOfPartOfRightHandSideOfImportEquals(<Identifier>node);
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.BindingElement &&
|
||||
node.parent.parent.kind === SyntaxKind.ObjectBindingPattern &&
|
||||
node === (<BindingElement>node.parent).propertyName) {
|
||||
let typeOfPattern = getTypeAtLocation(node.parent.parent);
|
||||
let propertyDeclaration = getPropertyOfType(typeOfPattern, (<Identifier>node).text);
|
||||
if (propertyDeclaration) {
|
||||
return propertyDeclaration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (node.kind) {
|
||||
|
||||
Reference in New Issue
Block a user