1 | import type { Reducer, ReducersMapObject, Middleware, Action, AnyAction, StoreEnhancer, Store, Dispatch, PreloadedState, CombinedState } from 'redux';
|
2 | import type { EnhancerOptions as DevToolsOptions } from './devtoolsExtension';
|
3 | import type { ThunkMiddlewareFor, CurriedGetDefaultMiddleware } from './getDefaultMiddleware';
|
4 | import type { DispatchForMiddlewares, NoInfer } from './tsHelpers';
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | export declare type ConfigureEnhancersCallback = (defaultEnhancers: readonly StoreEnhancer[]) => StoreEnhancer[];
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | export interface ConfigureStoreOptions<S = any, A extends Action = AnyAction, M extends Middlewares<S> = Middlewares<S>> {
|
17 | |
18 |
|
19 |
|
20 |
|
21 | reducer: Reducer<S, A> | ReducersMapObject<S, A>;
|
22 | |
23 |
|
24 |
|
25 |
|
26 | middleware?: ((getDefaultMiddleware: CurriedGetDefaultMiddleware<S>) => M) | M;
|
27 | /**
|
28 | * Whether to enable Redux DevTools integration. Defaults to `true`.
|
29 | *
|
30 | * Additional configuration can be done by passing Redux DevTools options
|
31 | */
|
32 | devTools?: boolean | DevToolsOptions;
|
33 | /**
|
34 | * The initial state, same as Redux's createStore.
|
35 | * You may optionally specify it to hydrate the state
|
36 | * from the server in universal apps, or to restore a previously serialized
|
37 | * user session. If you use `combineReducers()` to produce the root reducer
|
38 | * function (either directly or indirectly by passing an object as `reducer`),
|
39 | * this must be an object with the same shape as the reducer map keys.
|
40 | */
|
41 | preloadedState?: PreloadedState<CombinedState<NoInfer<S>>>;
|
42 | /**
|
43 | * The store enhancers to apply. See Redux's `createStore()`.
|
44 | * All enhancers will be included before the DevTools Extension enhancer.
|
45 | * If you need to customize the order of enhancers, supply a callback
|
46 | * function that will receive the original array (ie, `[applyMiddleware]`),
|
47 | * and should return a new array (such as `[applyMiddleware, offline]`).
|
48 | * If you only need to add middleware, you can use the `middleware` parameter instead.
|
49 | */
|
50 | enhancers?: StoreEnhancer[] | ConfigureEnhancersCallback;
|
51 | }
|
52 | declare type Middlewares<S> = ReadonlyArray<Middleware<{}, S>>;
|
53 | /**
|
54 | * A Redux store returned by `configureStore()`. Supports dispatching
|
55 | * side-effectful _thunks_ in addition to plain actions.
|
56 | *
|
57 | * @public
|
58 | */
|
59 | export interface EnhancedStore<S = any, A extends Action = AnyAction, M extends Middlewares<S> = Middlewares<S>> extends Store<S, A> {
|
60 | /**
|
61 | * The `dispatch` method of your store, enhanced by all its middlewares.
|
62 | *
|
63 | * @inheritdoc
|
64 | */
|
65 | dispatch: DispatchForMiddlewares<M> & Dispatch<A>;
|
66 | }
|
67 | /**
|
68 | * A friendly abstraction over the standard Redux `createStore()` function.
|
69 | *
|
70 | * @param config The store configuration.
|
71 | * @returns A configured Redux store.
|
72 | *
|
73 | * @public
|
74 | */
|
75 | export declare function configureStore<S = any, A extends Action = AnyAction, M extends Middlewares<S> = [ThunkMiddlewareFor<S>]>(options: ConfigureStoreOptions<S, A, M>): EnhancedStore<S, A, M>;
|
76 | export {};
|
77 |
|
\ | No newline at end of file |