diff --git a/types/redux-form/index.d.ts b/types/redux-form/index.d.ts index 336ab9ade4..6ba9b9e0f6 100644 --- a/types/redux-form/index.d.ts +++ b/types/redux-form/index.d.ts @@ -8,9 +8,9 @@ // Anton Novik // Huw Martin // Tim de Koning +// Maddi Joyce // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 - import { ComponentClass, StatelessComponent, diff --git a/types/redux-form/lib/reduxForm.d.ts b/types/redux-form/lib/reduxForm.d.ts index 128845f08f..07f8e197ca 100644 --- a/types/redux-form/lib/reduxForm.d.ts +++ b/types/redux-form/lib/reduxForm.d.ts @@ -20,6 +20,7 @@ import { export type FormSubmitHandler = (values: FormData, dispatch: Dispatch, props: P) => void | FormErrors | Promise; +export type GetFormState = (state: any) => FormStateMap; export interface SubmitHandler { ( submit: FormSubmitHandler, @@ -105,7 +106,7 @@ export interface ConfigProps { destroyOnUnmount?: boolean; enableReinitialize?: boolean; forceUnregisterOnUnmount?: boolean; - getFormState?(state: any): FormStateMap; + getFormState?: GetFormState; immutableProps?: string[]; initialValues?: Partial; keepDirtyOnReinitialize?: boolean; diff --git a/types/redux-form/lib/selectors.d.ts b/types/redux-form/lib/selectors.d.ts index 4d224b5b82..eea4444275 100644 --- a/types/redux-form/lib/selectors.d.ts +++ b/types/redux-form/lib/selectors.d.ts @@ -1,8 +1,9 @@ -import { FormErrors } from "../index"; +import { FormErrors, GetFormState } from "../index"; -export type DataSelector = (formName: string) => (state: State) => FormData; -export type ErrorSelector = (formName: string) => (state: State) => FormErrors; -export type BooleanSelector = (formName: string) => (state: State) => boolean; +export type DataSelector = (formName: string, getFormState?: GetFormState) => (state: State) => FormData; +export type ErrorSelector = (formName: string, getFormState?: GetFormState) => (state: State) => FormErrors; +export type BooleanSelector = (formName: string, getFormState?: GetFormState) => (state: State) => boolean; +export type NamesSelector = (getFormState?: GetFormState) => (state: State) => string[]; export const getFormValues: DataSelector; export const getFormInitialValues: DataSelector; @@ -12,7 +13,7 @@ export const getFormAsyncErrors: ErrorSelector; export const getFormSyncWarnings: ErrorSelector; export const getFormSubmitErrors: ErrorSelector; export const getFormError: ErrorSelector; -export function getFormNames(state: any): string[]; +export const getFormNames: NamesSelector; export const isDirty: BooleanSelector; export const isPristine: BooleanSelector; export const isValid: BooleanSelector;