Search code examples
reactjstypescriptredux-form

What is InjectedFormProps in redux-form?


I am working on React-TypeScript project that is using Redux Form.

One of the component is using InjectedFormProps in Type Definition.

const Container: React.SFC<Props & InjectedFormProps<{}, Props>> = (props: Props & InjectedFormProps<{}, Props>) => {


return <> </>;

}

Can someone explain in detail what InjectedFormProps does under the hood?


Solution

  • https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/redux-form/v7/lib/reduxForm.d.ts

    export interface InjectedFormProps<FormData = {}, P = {}, ErrorType = string> {
        anyTouched: boolean;
        array: InjectedArrayProps;
        asyncValidate(): void;
        asyncValidating: string | boolean;
        autofill(field: string, value: any): void;
        blur(field: string, value: any): void;
        change(field: string, value: any): void;
        clearAsyncError(field: string): void;
        destroy(): void;
        dirty: boolean;
        error: ErrorType;
        form: string;
        handleSubmit: SubmitHandler<FormData, P, ErrorType>;
        initialize(data: Partial<FormData>): void;
        initialized: boolean;
        initialValues: Partial<FormData>;
        invalid: boolean;
        pristine: boolean;
        reset(): void;
        submitFailed: boolean;
        submitSucceeded: boolean;
        submitting: boolean;
        touch(...field: string[]): void;
        untouch(...field: string[]): void;
        valid: boolean;
        warning: any;
        registeredFields: { [name: string]: RegisteredField };
    }