File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,26 +73,26 @@ export interface IProduce {
7373 * @param {Function } patchListener - optional function that will be called with all the patches produced here
7474 * @returns {any } a new state, or the initial state if nothing was modified
7575 */
76- < S = any , R = never > (
77- currentState : S ,
78- recipe : ( this : Draft < S > , draft : Draft < S > ) => void | R ,
76+ < State , Result = any > (
77+ currentState : State ,
78+ recipe : ( this : Draft < State > , draft : Draft < State > ) => Result ,
7979 listener ?: PatchListener
80- ) : R
80+ ) : void extends Result ? State : Result
8181
8282 /** Curried producer with an initial state */
83- < S = any , R = never > (
84- recipe : ( this : Draft < S > , draft : Draft < S > ) => void | R ,
85- defaultBase : S
86- ) : ( base : S | undefined ) => R
83+ < State , Result = any > (
84+ recipe : ( this : Draft < State > , draft : Draft < State > ) => void | Result ,
85+ defaultBase : State
86+ ) : ( base : State | undefined ) => void extends Result ? State : Result
8787
8888 /** Curried producer with no initial state */
89- < S = any , R = never , Args extends any [ ] = any [ ] > (
89+ < State , Result = any , Args extends any [ ] = any [ ] > (
9090 recipe : (
91- this : Draft < S > ,
92- draft : Draft < S > ,
91+ this : Draft < State > ,
92+ draft : Draft < State > ,
9393 ...extraArgs : Args
94- ) => void | R
95- ) : ( base : S , ...extraArgs : Args ) => R
94+ ) => void | Result
95+ ) : ( base : State , ...extraArgs : Args ) => void extends Result ? State : Result
9696}
9797
9898export const produce : IProduce
You can’t perform that action at this time.
0 commit comments