UNPKG

1.55 kBTypeScriptView Raw
1import { FormErrors, GetFormState } from "../index";
2
3export type DataSelector<FormData = {}, State = {}> = (
4 formName: string,
5 getFormState?: GetFormState,
6) => (state: State) => FormData;
7export type ErrorSelector<FormData = {}, State = {}, ErrorType = string> = (
8 formName: string,
9 getFormState?: GetFormState,
10) => (state: State) => FormErrors<FormData, ErrorType>;
11export type BooleanSelector<State = {}> = (formName: string, getFormState?: GetFormState) => (state: State) => boolean;
12export type NamesSelector<State = {}> = (getFormState?: GetFormState) => (state: State) => string[];
13export type FormOrFieldsBooleanSelector<State = {}> = (
14 formName: string,
15 getFormState?: GetFormState,
16) => (state: State, ...fields: string[]) => boolean;
17
18export const getFormValues: DataSelector;
19export const getFormInitialValues: DataSelector;
20export const getFormSyncErrors: ErrorSelector;
21export const getFormMeta: DataSelector;
22export const getFormAsyncErrors: ErrorSelector;
23export const getFormSyncWarnings: ErrorSelector;
24export const getFormSubmitErrors: ErrorSelector;
25export const getFormError: ErrorSelector;
26export const getFormNames: NamesSelector;
27export const isDirty: FormOrFieldsBooleanSelector;
28export const isPristine: FormOrFieldsBooleanSelector;
29export const isValid: BooleanSelector;
30export const isInvalid: BooleanSelector;
31export const isSubmitting: BooleanSelector;
32export const isAsyncValidating: BooleanSelector;
33export const hasSubmitSucceeded: BooleanSelector;
34export const hasSubmitFailed: BooleanSelector;