mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Check for definedness on the pattern's type.
This commit is contained in:
@@ -12362,7 +12362,8 @@ namespace ts {
|
||||
node.parent.parent.kind === SyntaxKind.ObjectBindingPattern &&
|
||||
node === (<BindingElement>node.parent).propertyName) {
|
||||
let typeOfPattern = getTypeAtLocation(node.parent.parent);
|
||||
let propertyDeclaration = getPropertyOfType(typeOfPattern, (<Identifier>node).text);
|
||||
let propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, (<Identifier>node).text);
|
||||
|
||||
if (propertyDeclaration) {
|
||||
return propertyDeclaration;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user