1 | import type { Middleware } from 'redux';
|
2 | /**
|
3 | * The default `isImmutable` function.
|
4 | *
|
5 | * @public
|
6 | */
|
7 | export declare function isImmutableDefault(value: unknown): boolean;
|
8 | export declare function trackForMutations(isImmutable: IsImmutableFunc, ignorePaths: IgnorePaths | undefined, obj: any): {
|
9 | detectMutations(): {
|
10 | wasMutated: boolean;
|
11 | path?: string | undefined;
|
12 | };
|
13 | };
|
14 | declare type IgnorePaths = readonly (string | RegExp)[];
|
15 | declare type IsImmutableFunc = (value: any) => boolean;
|
16 | /**
|
17 | * Options for `createImmutableStateInvariantMiddleware()`.
|
18 | *
|
19 | * @public
|
20 | */
|
21 | export interface ImmutableStateInvariantMiddlewareOptions {
|
22 | /**
|
23 | Callback function to check if a value is considered to be immutable.
|
24 | This function is applied recursively to every value contained in the state.
|
25 | The default implementation will return true for primitive types
|
26 | (like numbers, strings, booleans, null and undefined).
|
27 | */
|
28 | isImmutable?: IsImmutableFunc;
|
29 | /**
|
30 | An array of dot-separated path strings that match named nodes from
|
31 | the root state to ignore when checking for immutability.
|
32 | Defaults to undefined
|
33 | */
|
34 | ignoredPaths?: IgnorePaths;
|
35 | /** Print a warning if checks take longer than N ms. Default: 32ms */
|
36 | warnAfter?: number;
|
37 | ignore?: string[];
|
38 | }
|
39 | /**
|
40 | * Creates a middleware that checks whether any state was mutated in between
|
41 | * dispatches or during a dispatch. If any mutations are detected, an error is
|
42 | * thrown.
|
43 | *
|
44 | * @param options Middleware options.
|
45 | *
|
46 | * @public
|
47 | */
|
48 | export declare function createImmutableStateInvariantMiddleware(options?: ImmutableStateInvariantMiddlewareOptions): Middleware;
|
49 | export {};
|