refactor: move @babel/helper-get-function-arity to ts (#12414)
* refactor: move @babel/helper-get-function-arity to ts * Review comments * chore: add flow interface
This commit is contained in:
parent
3266d2679a
commit
5e4b85ab1c
@ -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;
|
||||
}
|
||||
|
||||
@ -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)) {
|
||||
Loading…
x
Reference in New Issue
Block a user