Skip to content

Commit

Permalink
Use assertion instead of type cast
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Feb 1, 2021
1 parent 2bd5084 commit bea6378
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/babel-traverse/src/path/modification.ts
Expand Up @@ -132,13 +132,12 @@ export function insertAfter(
let { scope } = this;

if (scope.path.isPattern()) {
t.assertExpression(node);

this.replaceWith(
t.callExpression(
t.arrowFunctionExpression([], this.node as t.Expression),
[],
),
t.callExpression(t.arrowFunctionExpression([], node), []),
);
(this.get("callee.body") as NodePath<t.Expression>).insertAfter(nodes);
(this.get("callee.body") as NodePath).insertAfter(nodes);
return [this];
}

Expand Down

0 comments on commit bea6378

Please sign in to comment.