Fix #3912: emit declaration for binding elements correctelly

This commit is contained in:
Mohamed Hegazy
2015-07-28 14:30:27 -07:00
parent fe51b456d8
commit 7f49375f3e
5 changed files with 55 additions and 4 deletions

View File

@@ -1501,11 +1501,8 @@ namespace ts {
// emit : declare function foo({y: [a, b, c]}: { y: [any, any, any] }) void;
writeTextOfNode(currentSourceFile, bindingElement.propertyName);
write(": ");
// If bindingElement has propertyName property, then its name must be another bindingPattern of SyntaxKind.ObjectBindingPattern
emitBindingPattern(<BindingPattern>bindingElement.name);
}
else if (bindingElement.name) {
if (bindingElement.name) {
if (isBindingPattern(bindingElement.name)) {
// If it is a nested binding pattern, we will recursively descend into each element and emit each one separately.
// In the case of rest element, we will omit rest element.