import { createStore, applyMiddleware, Store as ReduxStore, Dispatch as ReduxDispatch, } from "redux"; import thunk, { ThunkAction as _ThunkAction, ThunkDispatch as _ThunkDispatch, } from "redux-thunk"; import reducers, { State } from "../reducers"; import { Action } from "../actions"; export type ThunkAction = _ThunkAction; type ThunkDispatch = _ThunkDispatch; export type Dispatch = ReduxDispatch & ThunkDispatch; interface Store extends ReduxStore { dispatch: Dispatch; } export function makeStore(): Store { const middlewares = [thunk]; return createStore(reducers, applyMiddleware(...middlewares)); }