@@ -39,9 +39,33 @@ interface IProduce {
39
39
): (currentState: S, a: A, b: B, c: C, ...extraArgs: any[]) => S;
40
40
}
41
41
42
+ interface IProduceWithPatches {
43
+ /**
44
+ * Like `produce`, but instead of just returning the new state,
45
+ * a tuple is returned with [nextState, patches, inversePatches]
46
+ *
47
+ * Like produce, this function supports currying
48
+ */
49
+ <S: Base>(
50
+ currentState: S,
51
+ recipe: (draftState: S) => S | void
52
+ ): [S, Patch[], Patch[]];
53
+ // curried invocations with inital state
54
+ <S: Base, A = void, B = void, C = void>(
55
+ recipe: (draftState: S, a: A, b: B, c: C, ...extraArgs: any[]) => S | void,
56
+ initialState: S
57
+ ): (currentState: S | void, a: A, b: B, c: C, ...extraArgs: any[]) => [S, Patch[], Patch[]];
58
+ // curried invocations without inital state
59
+ <S: Base, A = void, B = void, C = void>(
60
+ recipe: (draftState: S, a: A, b: B, c: C, ...extraArgs: any[]) => S | void
61
+ ): (currentState: S, a: A, b: B, c: C, ...extraArgs: any[]) => [S, Patch[], Patch[]];
62
+ }
63
+
42
64
declare export var produce: IProduce
43
65
declare export default IProduce
44
66
67
+ declare export var produceWithPatches: IProduceWithPatches
68
+
45
69
declare export var nothing: typeof undefined
46
70
47
71
declare export var immerable: Symbol
0 commit comments