Skip to content

Commit

Permalink
fix(babel): transform all arrow functions with block syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Mar 28, 2023
1 parent afa8dac commit ca052d6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/loader/babel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ca052d6

Please sign in to comment.