File tree Expand file tree Collapse file tree
src/compiler/transformers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ namespace ts {
159159 }
160160
161161 function chunkObjectLiteralElements ( elements : ReadonlyArray < ObjectLiteralElementLike > ) : Expression [ ] {
162- let chunkObject : ObjectLiteralElementLike [ ] ;
162+ let chunkObject : ObjectLiteralElementLike [ ] | undefined ;
163163 const objects : Expression [ ] = [ ] ;
164164 for ( const e of elements ) {
165165 if ( e . kind === SyntaxKind . SpreadAssignment ) {
@@ -171,15 +171,9 @@ namespace ts {
171171 objects . push ( visitNode ( target , visitor , isExpression ) ) ;
172172 }
173173 else {
174- if ( ! chunkObject ) {
175- chunkObject = [ ] ;
176- }
177- if ( e . kind === SyntaxKind . PropertyAssignment ) {
178- chunkObject . push ( createPropertyAssignment ( e . name , visitNode ( e . initializer , visitor , isExpression ) ) ) ;
179- }
180- else {
181- chunkObject . push ( visitNode ( e , visitor , isObjectLiteralElementLike ) ) ;
182- }
174+ chunkObject = append ( chunkObject , e . kind === SyntaxKind . PropertyAssignment
175+ ? createPropertyAssignment ( e . name , visitNode ( e . initializer , visitor , isExpression ) )
176+ : visitNode ( e , visitor , isObjectLiteralElementLike ) ) ;
183177 }
184178 }
185179 if ( chunkObject ) {
You can’t perform that action at this time.
0 commit comments