declare module 'redux' { /* S = State A = Action D = Dispatch R = Promise response */ 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 PromiseAction = (dispatch: ReduxDispatch, getState: () => S) => Promise; declare export type PayloadAction = (dispatch: ReduxDispatch, getState: () => S) => R; declare export type ThunkDispatch = (action: ThunkAction) => void; declare export type AsyncDispatch = (action: AsyncAction) => Promise; declare export type PromiseDispatch = (action: PromiseAction) => Promise; declare export type PayloadDispatch = (action: PayloadAction) => R; declare export type PlainDispatch = DispatchAPI; /* NEW: Dispatch is now a combination of these different dispatch types */ declare export type ReduxDispatch = PlainDispatch & ThunkDispatch & AsyncDispatch & PromiseDispatch & PayloadDispatch; declare export type MiddlewareAPI = { dispatch: ReduxDispatch; getState(): S; }; declare export type Middleware = (api: MiddlewareAPI) => (next: PlainDispatch) => (PlainDispatch | (action: A) => Promise); 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; }