@@ -92,11 +92,15 @@ namespace ts {
9292 // { a, ...o, b } => __assign({a}, o, {b});
9393 // If the first element is a spread element, then the first argument to __assign is {}:
9494 // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2)
95- const objects = chunkObjectLiteralElements ( node . properties ) ;
96- if ( objects . length && objects [ 0 ] . kind !== SyntaxKind . ObjectLiteralExpression ) {
97- objects . unshift ( createObjectLiteral ( ) ) ;
95+ if ( forEach ( node . properties , p => p . kind === SyntaxKind . SpreadAssignment ) ) {
96+ const objects = chunkObjectLiteralElements ( node . properties ) ;
97+ if ( objects . length && objects [ 0 ] . kind !== SyntaxKind . ObjectLiteralExpression ) {
98+ objects . unshift ( createObjectLiteral ( ) ) ;
99+ }
100+
101+ return aggregateTransformFlags ( createCall ( createIdentifier ( "__assign" ) , undefined , objects ) ) ;
98102 }
99- return createCall ( createIdentifier ( "__assign" ) , undefined , objects ) ;
103+ return visitEachChild ( node , visitor , context ) ;
100104 }
101105
102106 /**
@@ -235,7 +239,7 @@ namespace ts {
235239 visitEachChild ( node . body , visitor , context ) ;
236240 const func = setOriginalNode (
237241 createArrowFunction (
238- /* modifiers*/ undefined ,
242+ node . modifiers ,
239243 /*typeParameters*/ undefined ,
240244 visitNodes ( node . parameters , visitor , isParameter ) ,
241245 /*type*/ undefined ,
@@ -256,7 +260,7 @@ namespace ts {
256260 visitEachChild ( node . body , visitor , context ) ;
257261 return setOriginalNode (
258262 createFunctionExpression (
259- /* modifiers*/ undefined ,
263+ node . modifiers ,
260264 node . asteriskToken ,
261265 name ,
262266 /*typeParameters*/ undefined ,
0 commit comments