diff --git a/types/redux-form/v6/lib/actionTypes.d.ts b/types/redux-form/v6/lib/actionTypes.d.ts index ce1ba5d208..02b47849d3 100644 --- a/types/redux-form/v6/lib/actionTypes.d.ts +++ b/types/redux-form/v6/lib/actionTypes.d.ts @@ -20,6 +20,7 @@ export interface ActionTypes { INITIALIZE: string; REGISTER_FIELD: string; RESET: string; + RESET_SECTION: string; SET_SUBMIT_FAILED: string; SET_SUBMIT_SUCCEEDED: string; START_ASYNC_VALIDATION: string; diff --git a/types/redux-form/v6/lib/actions.d.ts b/types/redux-form/v6/lib/actions.d.ts index 7e7ea5762a..67638a2784 100644 --- a/types/redux-form/v6/lib/actions.d.ts +++ b/types/redux-form/v6/lib/actions.d.ts @@ -84,14 +84,22 @@ export function destroy(...form: string[]): FormAction; export function focus(form: string, field: string): FormAction; /** - * Sets the initial values in the form with which future data values will be compared to calculate dirty and pristine. - * The data parameter may contain deep nested array and object values that match the shape of your form fields. - * If the keepDirty parameter is true, the values of the currently dirty fields will be retained to avoid overwriting - * user edits. + * Sets the initial values in the form with which future data values will be compared to calculate dirty and pristine. + * + * If the keepDirty parameter is true, the values of currently dirty fields will be retained to avoid overwriting user edits. + * + * If the keepSubmitSucceeded parameter is true, it will not clear the submitSucceeded flag if it is set. + * + * If the updateUnregisteredFields parameter is true, it will update every initialValue if still pristine instead of only + * registered fields. Highly recommended, defaults to false because of non-breaking backwards compatibility. + * + * If the keepValues parameter is true, it will keep the old values and initial values. */ interface InitializeOptions { keepDirty: boolean; keepSubmitSucceeded: boolean; + updateUnregisteredFields: boolean; + keepValues: boolean; } export function initialize(form: string, data: any, keepDirty?: boolean | InitializeOptions, options?: InitializeOptions): FormAction; @@ -106,6 +114,11 @@ export function registerField(form: string, name: string, type: FieldType): Form */ export function reset(form: string): FormAction; +/** + * Resets the values in the form sections back to the values past in with the most recent initialize action. + */ +export function resetSection(form: string, ...sections: string[]): FormAction; + /** * Flips the asyncValidating flag true */ diff --git a/types/redux-form/v6/lib/reduxForm.d.ts b/types/redux-form/v6/lib/reduxForm.d.ts index 53ad871c0c..2900137019 100644 --- a/types/redux-form/v6/lib/reduxForm.d.ts +++ b/types/redux-form/v6/lib/reduxForm.d.ts @@ -518,6 +518,11 @@ export interface StrictFormProps { */ reset(): void; + /** + * Resets the form sections to the initialValues. It will be pristine after reset. + */ + resetSection(...sections: string[]) : void; + /** * Whether or not your form is currently submitting. This prop will only * work if you have passed an onSubmit function that returns a promise. It