1 | import type { UnknownAction } from 'redux';
|
2 | import type { ThunkMiddleware } from 'redux-thunk';
|
3 | import type { ActionCreatorInvariantMiddlewareOptions } from './actionCreatorInvariantMiddleware';
|
4 | import type { ImmutableStateInvariantMiddlewareOptions } from './immutableStateInvariantMiddleware';
|
5 | import type { SerializableStateInvariantMiddlewareOptions } from './serializableStateInvariantMiddleware';
|
6 | import type { ExcludeFromTuple } from './tsHelpers';
|
7 | import { Tuple } from './utils';
|
8 | interface ThunkOptions<E = any> {
|
9 | extraArgument: E;
|
10 | }
|
11 | interface GetDefaultMiddlewareOptions {
|
12 | thunk?: boolean | ThunkOptions;
|
13 | immutableCheck?: boolean | ImmutableStateInvariantMiddlewareOptions;
|
14 | serializableCheck?: boolean | SerializableStateInvariantMiddlewareOptions;
|
15 | actionCreatorCheck?: boolean | ActionCreatorInvariantMiddlewareOptions;
|
16 | }
|
17 | export type ThunkMiddlewareFor<S, O extends GetDefaultMiddlewareOptions = {}> = O extends {
|
18 | thunk: false;
|
19 | } ? never : O extends {
|
20 | thunk: {
|
21 | extraArgument: infer E;
|
22 | };
|
23 | } ? ThunkMiddleware<S, UnknownAction, E> : ThunkMiddleware<S, UnknownAction>;
|
24 | export type GetDefaultMiddleware<S = any> = <O extends GetDefaultMiddlewareOptions = {
|
25 | thunk: true;
|
26 | immutableCheck: true;
|
27 | serializableCheck: true;
|
28 | actionCreatorCheck: true;
|
29 | }>(options?: O) => Tuple<ExcludeFromTuple<[ThunkMiddlewareFor<S, O>], never>>;
|
30 | export declare const buildGetDefaultMiddleware: <S = any>() => GetDefaultMiddleware<S>;
|
31 | export {};
|