Skip to content

Commit

Permalink
fix(ts): parameter types of curried producers
Browse files Browse the repository at this point in the history
Fixes #288
  • Loading branch information
aleclarson committed Jan 11, 2019
1 parent f820657 commit 89f6443
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/immer.d.ts
Expand Up @@ -88,15 +88,20 @@ export interface IProduce {
listener?: PatchListener
): Produced<Base, Return>

/** Curried producer */
/** Curried producer with a default value */
<Default = any, Base = Default, Rest extends any[] = [], Return = void>(
recipe: (
this: Draft<Base>,
draft: Draft<Base>,
...rest: Rest
) => Return,
defaultBase?: Default
defaultBase: Default
): (base: Base | undefined, ...rest: Rest) => Produced<Base, Return>

/** Curried producer with no default value */
<Base = any, Rest extends any[] = [], Return = void>(
recipe: (this: Draft<Base>, draft: Draft<Base>, ...rest: Rest) => Return
): (base: Base, ...rest: Rest) => Produced<Base, Return>
}

export const produce: IProduce
Expand Down

0 comments on commit 89f6443

Please sign in to comment.