export type InitialFormState = { fields?: InitialFields; validateOn?: "change" | "blur" | "all"; resetOptions?: { keepDirty?: boolean; keepTouched?: boolean; keepErrors?: boolean; }; }; export type FormState = { fields: Fields; validateOn: "change" | "blur" | "all"; resetOptions: { keepDirty: boolean; keepTouched: boolean; keepErrors: boolean; }; }; export type InitialField = { value: Value; error?: null | string; validators?: Validators; }; export type InitialFields = { [x: string]: InitialField; }; export type Field = { value: Value; error: null | string; validators: Validators; isDirty: boolean; isTouched: boolean; }; export type Fields = { [x: string]: Field; }; export type Validator = (v: string) => null | string | Promise; export type Validators = { [x: string]: Validator; }; export type Value = any; export type Values = { [x: string]: Value; }; export type Error = string | null; export type Errors = { [x: string]: Error; }; export declare const useForm: (initialForm?: InitialFormState) => { formState: FormState; register: (name: string) => any; setValue: (name: string, value: Value) => void; setError: (name: string, error: string) => void; getFormValues: () => Values; getValue: (name: string) => any; getFormErrors: () => Errors; getError: (name: string) => string | null; validate: (name: string, value: Value) => Promise; handleChange: (name: string, value: Value) => void; handleBlur: (name: string) => void; validateForm: () => Promise; handleReset: () => void; handleSubmit: (e: any, onSubmit: (values: Values) => void, onError?: ((values: Values) => void) | undefined) => Promise; }; export default useForm; //# sourceMappingURL=useForm.d.ts.map