Skip to content

Commit

Permalink
❤️ improve types of Controller's onChange and onBlur (react-hook-form…
Browse files Browse the repository at this point in the history
  • Loading branch information
susisu authored Mar 7, 2020
1 parent 98d5914 commit 89dd86f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const Controller = <
return data;
};

const eventWrapper = (event: EventFunction) => (...arg: any) =>
const eventWrapper = (event: EventFunction) => (...arg: any[]) =>
setValue(name, commonTask(event(arg)), shouldValidate());

const handleChange = (event: any) => {
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export type FormValuesFromErrors<Errors> = Errors extends FieldErrors<
? FormValues
: never;

export type EventFunction = (args: any) => any;
export type EventFunction = (args: any[]) => any;

export type Control<FormValues extends FieldValues = FieldValues> = {
register<Element extends FieldElement = FieldElement>(): (
Expand Down

0 comments on commit 89dd86f

Please sign in to comment.