import { AnyAction , applyMiddleware , createStore , Middleware , Reducer , Store } from 'redux' ; let composeWithDevTools ; if ( process . env . NODE_ENV === 'development' ) { try { composeWithDevTools = require ( 'redux-devtools-extension' ) . composeWithDevTools ; } catch ( e ) { console . warn ( 'You may want: redux-devtools-extension(https://github.com/zalmoxisus/redux-devtools-extension)' ) ; } } export const configureStore = ( reducers , middlewares , initialState ? ) : Store < any , AnyAction > => { let store ; if ( composeWithDevTools ) { composeWithDevTools = require ( 'redux-devtools-extension' ) . composeWithDevTools ; store = createStore ( reducers , initialState , composeWithDevTools ( applyMiddleware ( ... middlewares ) ) ) ; } else { store = createStore ( reducers , initialState , applyMiddleware ( ... middlewares ) ) ; } return store ; } ;