File tree 1 file changed +4
-10
lines changed
src/compiler/transformers
1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ namespace ts {
159
159
}
160
160
161
161
function chunkObjectLiteralElements ( elements : ReadonlyArray < ObjectLiteralElementLike > ) : Expression [ ] {
162
- let chunkObject : ObjectLiteralElementLike [ ] ;
162
+ let chunkObject : ObjectLiteralElementLike [ ] | undefined ;
163
163
const objects : Expression [ ] = [ ] ;
164
164
for ( const e of elements ) {
165
165
if ( e . kind === SyntaxKind . SpreadAssignment ) {
@@ -171,15 +171,9 @@ namespace ts {
171
171
objects . push ( visitNode ( target , visitor , isExpression ) ) ;
172
172
}
173
173
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 ) ) ;
183
177
}
184
178
}
185
179
if ( chunkObject ) {
You can’t perform that action at this time.
0 commit comments