Skip to content

Commit

Permalink
refactor: move @babel/helper-get-function-arity to ts (babel#12414)
Browse files Browse the repository at this point in the history
* refactor: move @babel/helper-get-function-arity to ts

* Review comments

* chore: add flow interface
  • Loading branch information
JLHwung authored and nicolo-ribaudo committed Dec 2, 2020
1 parent a26f4ef commit c13853b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions lib/babel-packages.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ declare module "@babel/helper-optimise-call-expression" {
optional: boolean
): BabelNodeCallExpression | BabelNodeOptionalCallExpression;
}

declare module "@babel/helper-get-function-arity" {
declare export default function helperGetFunctionArity(
node: BabelNodeFunction
): number;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as t from "@babel/types";

export default function (node): number {
const params: Array<Object> = node.params;
export default function (node: t.Function): number {
const params = node.params;
for (let i = 0; i < params.length; i++) {
const param = params[i];
if (t.isAssignmentPattern(param) || t.isRestElement(param)) {
Expand Down

0 comments on commit c13853b

Please sign in to comment.