Adding 'undocumented' parameter to selectors.

This commit is contained in:
Maddi Joyce
2018-06-12 17:06:39 +10:00
parent 3b8b13474e
commit f8ffc07b18
3 changed files with 18 additions and 13 deletions
+12 -8
View File
@@ -7,14 +7,11 @@
// Alex Young <https://github.com/alsiola>
// Anton Novik <https://github.com/tehbi4>
// Huw Martin <https://github.com/huwmartin>
// Maddi Joyce <https://github.com/maddijoyce>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import {
ComponentClass,
StatelessComponent,
ReactElement
} from "react";
import { ComponentClass, StatelessComponent, ReactElement } from "react";
export type FieldType = "Field" | "FieldArray";
@@ -23,7 +20,7 @@ export interface ErrorOther<T = void> {
}
export type FormErrors<FormData = {}, T = void> = {
[P in keyof FormData]?: ReactElement<any> | string | ErrorOther<T>;
[P in keyof FormData]?: ReactElement<any> | string | ErrorOther<T>
};
export interface WarningOther<T = void> {
@@ -31,7 +28,7 @@ export interface WarningOther<T = void> {
}
export type FormWarnings<FormData = {}, T = void> = {
[P in keyof FormData]?: ReactElement<any> | string | WarningOther<T>;
[P in keyof FormData]?: ReactElement<any> | string | WarningOther<T>
};
export interface RegisteredFieldState {
@@ -39,7 +36,14 @@ export interface RegisteredFieldState {
type: FieldType;
}
export type Omit<T, K extends keyof T> = Pick<T, ({ [P in keyof T]: P } & { [P in K]: never } & { [x: string]: never, [x: number]: never })[keyof T]>;
export type Omit<T, K extends keyof T> = Pick<
T,
({ [P in keyof T]: P } &
{ [P in K]: never } & {
[x: string]: never;
[x: number]: never;
})[keyof T]
>;
export * from "./lib/reduxForm";
export * from "./lib/Field";
+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;
+4 -4
View File
@@ -1,8 +1,8 @@
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 const getFormValues: DataSelector;
export const getFormInitialValues: DataSelector;