Skip to content

Commit ce30fd0

Browse files
Copilotweswigham
andcommitted
Add else clause to handle empty blocks in using for-of transform
Co-authored-by: weswigham <[email protected]>
1 parent 606bc4b commit ce30fd0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/compiler/transformers/esnext.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,9 @@ export function transformESNext(context: TransformationContext): (x: SourceFile
331331
factory.createBlock([node.statement], /*multiLine*/ true);
332332
statements.push(wrappedStatement);
333333
}
334+
else {
335+
statements.push(...(isBlock(node.statement) ? node.statement.statements : [node.statement]))
336+
}
334337

335338
return visitNode(
336339
factory.updateForOfStatement(

0 commit comments

Comments
 (0)