diff --git a/src/applyMiddleware.ts b/src/applyMiddleware.ts index f735843252..b0275f64f5 100644 --- a/src/applyMiddleware.ts +++ b/src/applyMiddleware.ts @@ -1,7 +1,12 @@ import compose from './compose' import { Middleware, MiddlewareAPI } from './types/middleware' import { AnyAction } from './types/actions' -import { StoreEnhancer, StoreCreator, Dispatch } from './types/store' +import { + StoreEnhancer, + Dispatch, + PreloadedState, + StoreEnhancerStoreCreator +} from './types/store' import { Reducer } from './types/reducers' /** @@ -55,11 +60,11 @@ export default function applyMiddleware( export default function applyMiddleware( ...middlewares: Middleware[] ): StoreEnhancer { - return (createStore: StoreCreator) => ( + return (createStore: StoreEnhancerStoreCreator) => ( reducer: Reducer, - ...args: any[] + preloadedState?: PreloadedState ) => { - const store = createStore(reducer, ...args) + const store = createStore(reducer, preloadedState) let dispatch: Dispatch = () => { throw new Error( 'Dispatching while constructing your middleware is not allowed. ' +