declare module 'redux' { /* S = State A = Action D = Dispatch */ declare export type DispatchAPI = (action: A) => A; // old Dispatch needs to stay as it is, because also "react-redux" is using this type declare export type Dispatch }> = DispatchAPI; declare export type ThunkAction = (dispatch: ReduxDispatch, getState: () => S) => void; declare export type AsyncAction = (dispatch: ReduxDispatch, getState: () => S) => Promise; declare export type ThunkDispatch = (action: ThunkAction) => void; declare export type AsyncDispatch = (action: AsyncAction) => Promise; declare export type PlainDispatch}> = DispatchAPI; /* NEW: Dispatch is now a combination of these different dispatch types */ declare export type ReduxDispatch = PlainDispatch & ThunkDispatch & AsyncDispatch; declare export type MiddlewareAPI = { // dispatch: Dispatch; // dispatch: (action: A | ThunkAction) => A | void; // dispatch: PlainDispatch | () => A; // dispatch: ( A | ThunkAction | void ) => void; dispatch: ReduxDispatch; // dispatch: Dispatch; // dispatch: D; getState(): S; }; declare export type Middleware = (api: MiddlewareAPI) => (next: PlainDispatch) => PlainDispatch; declare export type Store> = { // rewrite MiddlewareAPI members in order to get nicer error messages (intersections produce long messages) dispatch: D; getState(): S; subscribe(listener: () => void): () => void; replaceReducer(nextReducer: Reducer): void }; declare export type Reducer = (state: S | void, action: A) => S; declare export type CombinedReducer = (state: $Shape & {} | void, action: A) => S; declare export type StoreCreator> = { (reducer: Reducer, enhancer?: StoreEnhancer): Store; (reducer: Reducer, preloadedState: S, enhancer?: StoreEnhancer): Store; }; declare export type StoreEnhancer> = (next: StoreCreator) => StoreCreator; declare export function createStore(reducer: Reducer, enhancer?: StoreEnhancer): Store; declare export function createStore(reducer: Reducer, preloadedState?: S, enhancer?: StoreEnhancer): Store; declare export function applyMiddleware(...middlewares: Array>): StoreEnhancer; // declare export type ActionCreator = (...args: Array) => A; declare export type ActionCreator = (...args: Array) => any; declare export type ActionCreators = { [key: K]: ActionCreator }; declare export function bindActionCreators, D: ReduxDispatch>(actionCreator: C, dispatch: D): C; declare export function bindActionCreators, D: ReduxDispatch>(actionCreators: C, dispatch: D): C; // declare export function bindActionCreators, D: Dispatch>(actionCreator: C, dispatch: D): C; // declare export function bindActionCreators, D: Dispatch>(actionCreators: C, dispatch: D): C; declare export function combineReducers(reducers: O): CombinedReducer<$ObjMap(r: Reducer) => S>, A>; declare export var compose: $Compose; }