File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 11import compose from './compose'
22import { Middleware , MiddlewareAPI } from './types/middleware'
33import { AnyAction } from './types/actions'
4- import { StoreEnhancer , StoreCreator , Dispatch } from './types/store'
4+ import {
5+ StoreEnhancer ,
6+ Dispatch ,
7+ PreloadedState ,
8+ StoreEnhancerStoreCreator
9+ } from './types/store'
510import { Reducer } from './types/reducers'
611
712/**
@@ -55,11 +60,11 @@ export default function applyMiddleware<Ext, S = any>(
5560export default function applyMiddleware (
5661 ...middlewares : Middleware [ ]
5762) : StoreEnhancer < any > {
58- return ( createStore : StoreCreator ) => < S , A extends AnyAction > (
63+ return ( createStore : StoreEnhancerStoreCreator ) => < S , A extends AnyAction > (
5964 reducer : Reducer < S , A > ,
60- ... args : any [ ]
65+ preloadedState ?: PreloadedState < S >
6166 ) => {
62- const store = createStore ( reducer , ... args )
67+ const store = createStore ( reducer , preloadedState )
6368 let dispatch : Dispatch = ( ) => {
6469 throw new Error (
6570 'Dispatching while constructing your middleware is not allowed. ' +
You can’t perform that action at this time.
0 commit comments