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 4001fed
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/babel-traverse/src/path/modification.ts
Expand Up @@ -132,11 +132,10 @@ 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);
return [this];
Expand Down

0 comments on commit 4001fed

Please sign in to comment.