Check for definedness on the pattern's type.

This commit is contained in:
Daniel Rosenwasser
2015-06-25 16:09:59 -04:00
parent a769e6747a
commit 5ee5ae11f9
+2 -1
View File
@@ -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;
}