import { createStore , compose , applyMiddleware , AnyAction } from 'redux' ; import thunk , { ThunkDispatch , ThunkMiddleware } from 'redux-thunk' ; import { createMemoryHistory } from 'history' ; import { routerMiddleware } from 'connected-react-router' ; import { createRootReducer , RootState } from './reducers' ; export const history = createMemoryHistory ( ) ; declare module 'react-redux' { interface DefaultRootState extends RootState { } function useDispatch ( ) ; } declare module 'typescript-fsa-redux-thunk' { interface DefaultRootState extends RootState { } } const composeEnhancers = process . env . NODE_ENV === 'production' ? compose : Reflect . get ( window , '__REDUX_DEVTOOLS_EXTENSION_COMPOSE__' ) ?? compose ; export const configureStore = ( ) => createStore ( createRootReducer ( history ) , undefined , composeEnhancers ( applyMiddleware ( routerMiddleware ( history ) , thunk as ThunkMiddleware < RootState > ) ) ) ;