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