Merge pull request #26472 from maddijoyce/@pr/redux-form-getFormState

Redux Form - Adding 'undocumented' parameter to selectors.
This commit is contained in:
Paul van Brenk
2018-06-26 10:48:32 -07:00
committed by GitHub
3 changed files with 9 additions and 7 deletions
+1 -1
View File
@@ -8,9 +8,9 @@
// Anton Novik <https://github.com/tehbi4>
// Huw Martin <https://github.com/huwmartin>
// Tim de Koning <https://github.com/reggino>
// Maddi Joyce <https://github.com/maddijoyce>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import {
ComponentClass,
StatelessComponent,
+2 -1
View File
@@ -20,6 +20,7 @@ import {
export type FormSubmitHandler<FormData = {}, P = {}> =
(values: FormData, dispatch: Dispatch<any>, props: P) => void | FormErrors<FormData> | Promise<any>;
export type GetFormState = (state: any) => FormStateMap;
export interface SubmitHandler<FormData = {}, P = {}> {
(
submit: FormSubmitHandler<FormData, P>,
@@ -105,7 +106,7 @@ export interface ConfigProps<FormData = {}, P = {}> {
destroyOnUnmount?: boolean;
enableReinitialize?: boolean;
forceUnregisterOnUnmount?: boolean;
getFormState?(state: any): FormStateMap;
getFormState?: GetFormState;
immutableProps?: string[];
initialValues?: Partial<FormData>;
keepDirtyOnReinitialize?: boolean;
+6 -5
View File
@@ -1,8 +1,9 @@
import { FormErrors } from "../index";
import { FormErrors, GetFormState } from "../index";
export type DataSelector<FormData = {}, State = {}> = (formName: string) => (state: State) => FormData;
export type ErrorSelector<FormData = {}, State = {}> = (formName: string) => (state: State) => FormErrors<FormData>;
export type BooleanSelector<State = {}> = (formName: string) => (state: State) => boolean;
export type DataSelector<FormData = {}, State = {}> = (formName: string, getFormState?: GetFormState) => (state: State) => FormData;
export type ErrorSelector<FormData = {}, State = {}> = (formName: string, getFormState?: GetFormState) => (state: State) => FormErrors<FormData>;
export type BooleanSelector<State = {}> = (formName: string, getFormState?: GetFormState) => (state: State) => boolean;
export type NamesSelector<State = {}> = (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;