UNPKG

form-tool

Version:

Create quickly and robustly with form hooks

28 lines (27 loc) 803 B
import { TOnChangeInput } from 'index'; import { FormEvent } from 'react'; /** Interfaces TS */ export declare type IArgsSubmit = { event: FormEvent | any; action?: () => Promise<any>; actionOnError?: (res: any) => void; actionOfSuccess?: (error: any) => void; validationOnError?: () => void; }; export declare type TOptions<T, Y> = { dataForm: T; errorForm: Y; setForcedError: (errors: Y) => void; setForcedData: (data: T) => void; errorSubmit: boolean; calledSubmit: boolean; validationSubmitHooks: (elements: HTMLInputElement[]) => { errorForm: T; isError: boolean; }; }; export declare type IResponseHooks<T, Y> = [ (e: TOnChangeInput) => void, (args: IArgsSubmit) => void, TOptions<T, Y> ];