Skip to content

Commit

Permalink
Improve Flow type definition file (Fixes #80)
Browse files Browse the repository at this point in the history
Adds a Flow annotation, and provides name for the default exported
function to fix errors with Flow type checking.
  • Loading branch information
marcins committed Jan 29, 2018
1 parent ad5a86a commit 538d987
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/immer.js.flow
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @flow

declare export function extendShallowObservable(target: any): any

/**
Expand All @@ -12,21 +14,21 @@ declare export function extendShallowObservable(target: any): any
* @param thunk - function that receives a proxy of the current state as first argument and which can be freely modified
* @returns The next state: a new state, or the current state if nothing was modified
*/
declare export default function<S>(
declare export default function produce<S>(
currentState: S,
recipe: (draftState: S) => void
): S
// curried invocations
declare export default function<S, A, B, C>(
declare export default function produce<S, A, B, C>(
recipe: (draftState: S, a: A, b: B, c: C) => void
): (currentState: S, a: A, b: B, c: C) => S
declare export default function<S, A, B>(
declare export default function produce<S, A, B>(
recipe: (draftState: S, a: A, b: B) => void
): (currentState: S, a: A, b: B) => S
declare export default function<S, A>(
declare export default function produce<S, A>(
recipe: (draftState: S, a: A) => void
): (currentState: S) => S
declare export default function<S>(
declare export default function produce<S>(
recipe: (draftState: S, ...extraArgs: any[]) => void
): (currentState: S, ...extraArgs: any[]) => S

Expand Down

0 comments on commit 538d987

Please sign in to comment.