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 1
1
import compose from './compose'
2
2
import { Middleware, MiddlewareAPI } from './types/middleware'
3
3
import { 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'
5
10
import { Reducer } from './types/reducers'
6
11
7
12
/**
@@ -55,11 +60,11 @@ export default function applyMiddleware<Ext, S = any>(
55
60
export default function applyMiddleware(
56
61
...middlewares: Middleware[]
57
62
): StoreEnhancer<any> {
58
- return (createStore: StoreCreator ) => <S, A extends AnyAction>(
63
+ return (createStore: StoreEnhancerStoreCreator ) => <S, A extends AnyAction>(
59
64
reducer: Reducer<S, A>,
60
- ...args: any[]
65
+ preloadedState?: PreloadedState<S>
61
66
) => {
62
- const store = createStore(reducer, ...args )
67
+ const store = createStore(reducer, preloadedState )
63
68
let dispatch: Dispatch = () => {
64
69
throw new Error(
65
70
'Dispatching while constructing your middleware is not allowed. ' +
You can’t perform that action at this time.
0 commit comments