diff --git a/packages/babel-plugin-transform-parameters/src/rest.ts b/packages/babel-plugin-transform-parameters/src/rest.ts index 6abd1abc4c7c..e3d04d747844 100644 --- a/packages/babel-plugin-transform-parameters/src/rest.ts +++ b/packages/babel-plugin-transform-parameters/src/rest.ts @@ -325,16 +325,13 @@ export default function convertFunctionRest(path: NodePath) { } } - let rest = (node.params.pop() as t.RestElement).argument as - | t.Pattern - | t.Identifier; + let rest = restPath.node; + node.params.pop(); // This returns 'rest' if (t.isPattern(rest)) { const pattern = rest; rest = scope.generateUidIdentifier("ref"); - console.log(Object.keys(t.getBindingIdentifiers(pattern))); - const declar = t.variableDeclaration("let", [ t.variableDeclarator(pattern, rest), ]);