From ca052d62e5240c82038f39f7745fad9fe50adf30 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Tue, 28 Mar 2023 12:07:20 +0200 Subject: [PATCH] fix(babel): transform all arrow functions with block syntax --- src/loader/babel.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/loader/babel.ts b/src/loader/babel.ts index 22964c0..9aab2b7 100644 --- a/src/loader/babel.ts +++ b/src/loader/babel.ts @@ -30,9 +30,9 @@ const babelPluginUntyped: PluginItem = function ( const newDeclaration = t.functionDeclaration( declaration.id, declaration.init.params, - t.isLiteral(declaration.init.body) - ? t.blockStatement([t.returnStatement(declaration.init.body)]) - : (declaration.init.body as t.BlockStatement) + t.isBlockStatement(declaration.init.body) + ? (declaration.init.body as t.BlockStatement) + : t.blockStatement([t.returnStatement(declaration.init.body)]) ); newDeclaration.returnType = declaration.init.returnType; p.replaceWith(newDeclaration);