Skip to content

Commit

Permalink
Update packages/babel-helper-wrap-function/src/index.ts
Browse files Browse the repository at this point in the history
Co-authored-by: Nicol貌 Ribaudo <nicolo.ribaudo@gmail.com>
  • Loading branch information
liuxingbaoyu and nicolo-ribaudo committed Dec 2, 2023
1 parent 90c926d commit 1719bd2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/babel-helper-wrap-function/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,10 @@ export default function wrapFunction(
const nodeParams = path.node.params;

if (path.isArrowFunctionExpression()) {
let path2;
if (process.env.BABEL_8_BREAKING) {
path2 = path.arrowFunctionToExpression({ noNewArrows });
} else {
let path2 = path.arrowFunctionToExpression({ noNewArrows });
if (!process.env.BABEL_8_BREAKING) {
// arrowFunctionToExpression returns undefined in @babel/traverse < 7.18.10
path2 = path.arrowFunctionToExpression({ noNewArrows }) ?? path;
path2 ??= path;
}
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
node = path2.node as
Expand Down

0 comments on commit 1719bd2

Please sign in to comment.