source: frontend/node_modules/immer/dist/core/immerClass.d.ts

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 2.3 KB
Line 
1import { IProduceWithPatches, IProduce, ImmerState, Drafted, Patch, Objectish, Draft, PatchListener } from "../internal";
2interface ProducersFns {
3 produce: IProduce;
4 produceWithPatches: IProduceWithPatches;
5}
6export declare class Immer implements ProducersFns {
7 useProxies_: boolean;
8 autoFreeze_: boolean;
9 constructor(config?: {
10 useProxies?: boolean;
11 autoFreeze?: boolean;
12 });
13 /**
14 * The `produce` function takes a value and a "recipe function" (whose
15 * return value often depends on the base state). The recipe function is
16 * free to mutate its first argument however it wants. All mutations are
17 * only ever applied to a __copy__ of the base state.
18 *
19 * Pass only a function to create a "curried producer" which relieves you
20 * from passing the recipe function every time.
21 *
22 * Only plain objects and arrays are made mutable. All other objects are
23 * considered uncopyable.
24 *
25 * Note: This function is __bound__ to its `Immer` instance.
26 *
27 * @param {any} base - the initial state
28 * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified
29 * @param {Function} patchListener - optional function that will be called with all the patches produced here
30 * @returns {any} a new state, or the initial state if nothing was modified
31 */
32 produce: IProduce;
33 produceWithPatches: IProduceWithPatches;
34 createDraft<T extends Objectish>(base: T): Draft<T>;
35 finishDraft<D extends Draft<any>>(draft: D, patchListener?: PatchListener): D extends Draft<infer T> ? T : never;
36 /**
37 * Pass true to automatically freeze all copies created by Immer.
38 *
39 * By default, auto-freezing is enabled.
40 */
41 setAutoFreeze(value: boolean): void;
42 /**
43 * Pass true to use the ES2015 `Proxy` class when creating drafts, which is
44 * always faster than using ES5 proxies.
45 *
46 * By default, feature detection is used, so calling this is rarely necessary.
47 */
48 setUseProxies(value: boolean): void;
49 applyPatches<T extends Objectish>(base: T, patches: Patch[]): T;
50}
51export declare function createProxy<T extends Objectish>(immer: Immer, value: T, parent?: ImmerState): Drafted<T, ImmerState>;
52export {};
53//# sourceMappingURL=immerClass.d.ts.map
Note: See TracBrowser for help on using the repository browser.