Fix React emit for spread attributes when they are the first attribute

This commit is contained in:
Ryan Cavanaugh
2015-06-19 11:30:34 -07:00
parent b0750c25b2
commit 388e73f49f
5 changed files with 19 additions and 5 deletions

View File

@@ -1178,6 +1178,11 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
let haveOpenedObjectLiteral = false;
for (var i = 0; i < attrs.length; i++) {
if (attrs[i].kind === SyntaxKind.JsxSpreadAttribute) {
// If this is the first argument, we need to emit a {} as the first argument
if(i === 0) {
write('{}, ');
}
if (haveOpenedObjectLiteral) {
write('}');
haveOpenedObjectLiteral = false;