From 8328afe0bbe24ba29339409b2ab8bb4bf0010d58 Mon Sep 17 00:00:00 2001 From: Kamil Wojcik Date: Tue, 16 Oct 2018 17:47:41 +0200 Subject: [PATCH] bugfix (redux-form) Add missing parameter to onChange method (#29636) * - [redux-form] add missing parameter to onChange function * - test added * - fix tests --- types/redux-form/index.d.ts | 1 + types/redux-form/lib/reduxForm.d.ts | 2 +- types/redux-form/redux-form-tests.tsx | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/types/redux-form/index.d.ts b/types/redux-form/index.d.ts index bbddfbd744..dd5572cac0 100644 --- a/types/redux-form/index.d.ts +++ b/types/redux-form/index.d.ts @@ -10,6 +10,7 @@ // Ethan Resnick // Tim de Koning // Maddi Joyce +// Kamil Wojcik // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import { diff --git a/types/redux-form/lib/reduxForm.d.ts b/types/redux-form/lib/reduxForm.d.ts index 5d0d90d7b8..e37214f5d0 100644 --- a/types/redux-form/lib/reduxForm.d.ts +++ b/types/redux-form/lib/reduxForm.d.ts @@ -111,7 +111,7 @@ export interface ConfigProps { initialValues?: Partial; keepDirtyOnReinitialize?: boolean; updateUnregisteredFields?: boolean; - onChange?(values: Partial, dispatch: Dispatch, props: P & InjectedFormProps): void; + onChange?(values: Partial, dispatch: Dispatch, props: P & InjectedFormProps, previousValues: Partial): void; onSubmit?: FormSubmitHandler, ErrorType> | SubmitHandler, ErrorType>; onSubmitFail?( errors: FormErrors | undefined, diff --git a/types/redux-form/redux-form-tests.tsx b/types/redux-form/redux-form-tests.tsx index 3d177a7a8f..fc6e97fb6a 100644 --- a/types/redux-form/redux-form-tests.tsx +++ b/types/redux-form/redux-form-tests.tsx @@ -231,6 +231,14 @@ const testFormWithInitialValuesAndValidationDecorator = reduxForm({ + form: "testWithValidation", + onChange: (values: Partial, + dispatch: Dispatch, + props: TestFormComponentProps & InjectedFormProps, + previousValues: Partial) => {} +}); + type TestProps = {} & InjectedFormProps; const Test = reduxForm({ form : "test"