type Thunk = (dispatch: any, getState?: any) => T; type ThunkOrValue = T | Thunk; type ReduxDispatchPropsType = { [x in keyof T]: (...args: any) => any; }; /** * A generic type that represents the type of mapDispatchToProps in a way that is compatible with Thunks. * The type parameter should be an object where all values are functions (ie the normal ReduxDispatchProps type). * MapDispatchType transforms the passed in ReduxDispatchProps so that for each function the value assigned can * either be a function of the expected type OR the thunk form of the function. * For example, if ReduxDispatchProps is { pushNotification: (notification: object) => Promise }, * MapDispatchType allows either * { pushNotification: (notification: object) => Promise } * OR * { pushNotification: (notification: object) => (dispatch: any, getState?: any) => Promise }. */ export type MapDispatchType> = { [x in keyof T]: (...args: Parameters) => ThunkOrValue>; }; export {};