File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/compiler/transformers Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -317,8 +317,11 @@ export function transformESNext(context: TransformationContext): (x: SourceFile
317317 const usingVarStatement = factory . createVariableStatement ( /*modifiers*/ undefined , usingVarList ) ;
318318
319319 // Wrap the original loop body in an additional block scope to handle shadowing
320- // Don't create an extra block if the original statement is empty
321- const isEmptyBlock = isBlock ( node . statement ) && node . statement . statements . length === 0 ;
320+ // Don't create an extra block if the original statement is empty or contains only empty statements
321+ const isEmptyBlock = isBlock ( node . statement ) && (
322+ node . statement . statements . length === 0 ||
323+ node . statement . statements . every ( stmt => stmt . kind === SyntaxKind . EmptyStatement )
324+ ) ;
322325 const shouldWrapInBlock = ! isEmptyBlock ;
323326
324327 const statements : Statement [ ] = [ usingVarStatement ] ;
You can’t perform that action at this time.
0 commit comments