// Type definitions for redux-form v4.0.3 // Project: https://github.com/erikras/redux-form // Definitions by: Daniel Lytkin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// /// /// declare module 'redux-form' { import { Component, SyntheticEvent, FormEventHandler } from 'react'; import { Dispatch, ActionCreator, Reducer } from 'redux'; export type FieldValue = any; export type FormData = {[fieldName:string]: FieldValue}; export interface FieldProp { /** * true if this field currently has focus. It will only work if you are * passing onFocus to your input element. */ active: boolean; /** * An alias for value only when value is a boolean. Provided for * convenience of destructuring the whole field object into the props of a * form element. */ checked?: boolean; /** * true if the field value has changed from its initialized value. * Opposite of pristine. */ dirty: boolean; /** * The error for this field if its value is not passing validation. Both * synchronous and asynchronous validation errors will be reported here. */ error?: string; /** * The value for this field as supplied in initialValues to the form. */ initialValue: FieldValue; /** * true if the field value fails validation (has a validation error). * Opposite of valid. */ invalid: boolean; /** * The name of the field. It will be the same as the key in the fields * Object, but useful if bundling up a field to send down to a specialized * input component. */ name: string; /** * A function to call when the form field loses focus. It expects to * either receive the React SyntheticEvent or the current value of the * field. */ onBlur(eventOrValue:SyntheticEvent|FieldValue):void; /** * A function to call when the form field is changed. It expects to either * receive the React SyntheticEvent or the new value of the field. * @param eventOrValue */ onChange(eventOrValue:SyntheticEvent|FieldValue):void; /** * A function to call when the form field receives a 'dragStart' event. * Saves the field value in the event for giving the field it is dropped * into. */ onDragStart():void; /** * A function to call when the form field receives a drop event. */ onDrop():void; /** * A function to call when the form field receives focus. */ onFocus():void; /** * An alias for onChange. Provided for convenience of destructuring the * whole field object into the props of a form element. Added to provide * out-of-the-box support for Belle components' onUpdate API. */ onUpdate():void; /** * true if the field value is the same as its initialized value. Opposite * of dirty. */ pristine: boolean; /** * true if the field has been touched. By default this will be set when * the field is blurred. */ touched: boolean; /** * true if the field value passes validation (has no validation errors). * Opposite of invalid. */ valid: boolean; /** * The value of this form field. It will be a boolean for checkboxes, and * a string for all other input types. */ value: FieldValue; /** * true if this field has ever had focus. It will only work if you are * passing onFocus to your input element. */ visited: boolean; } export interface ReduxFormProps { /** * The name of the currently active (with focus) field. */ active?: string; /** * A function that may be called to initiate asynchronous validation if * asynchronous validation is enabled. */ asyncValidate?: Function; /** * true if the asynchronous validation function has been called but has not * yet returned. */ asyncValidating?: boolean; /** * Destroys the form state in the Redux store. By default, this will be * called for you in componentWillUnmount(). */ destroyForm?():void; /** * true if the form data has changed from its initialized values. Opposite * of pristine. */ dirty?: boolean; /** * A generic error for the entire form given by the _error key in the * result from the synchronous validation function, the asynchronous * validation, or the rejected promise from onSubmit. */ error?: string; /** * The form data, in the form { field1: , field2: }. The * field objects are meant to be destructured into your input component as * props, e.g. . Each field Object has * the following properties: */ fields?: {[field:string]: FieldProp}; /** * A function meant to be passed to
or to *