import { MutableRefObject } from "react"; import type { FieldInstance } from "../field/types"; import type { FieldArrayInstance } from "../field-array/types"; import type { AutoPath } from "ts-toolbelt/out/Function/AutoPath"; import type { Path } from "ts-toolbelt/out/Object/Path"; import type { Split } from "ts-toolbelt/out/String/Split"; import { MapDeep } from "./advanced-types"; export type ErrorsMap> = Record extends T ? Record : MapDeep; export interface FormInstance> { formFieldsRef: MutableRefObject< Array | FieldArrayInstance> >; recomputeErrors: () => void; recomputeIsDirty: () => void; recomputeIsTouched: () => void; recomputeFormValue: () => void; recomputeIsValidating: () => void; errors: string[]; errorsMap: ErrorsMap; submit: () => Promise; value: Partial; reset: () => void; isValid: boolean; setIsTouched: (val: boolean) => void; isTouched: boolean; setIsDirty: (val: boolean) => void; isDirty: boolean; isValidating: boolean; isSubmitted: boolean; setIsSubmitted: (val: boolean) => void; getFieldValue( val: string ): FieldInstance | FieldArrayInstance | undefined; getFieldValue( val: AutoPath ): Path> extends infer R ? FieldInstance | FieldArrayInstance | undefined : never; deleteField: (name: string) => void; onChangeListenerRefs: MutableRefObject void)[]>>; onBlurListenerRefs: MutableRefObject void)[]>>; onMountListenerRefs: MutableRefObject void)[]>>; }