Skip to content

Commit

Permalink
feature: Export the type of a recipe as Produce (#968)
Browse files Browse the repository at this point in the history
* feature: add type for producer function

* IProducer -> Producer

Co-authored-by: Michel Weststrate <mweststrate@gmail.com>
  • Loading branch information
feihe08 and mweststrate authored Jan 2, 2023
1 parent 23afcf1 commit c88f787
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/types/types-external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ export interface IProduceWithPatches {
): Promise<PatchesTuple<Base>>
}

/**
* The type for `recipe function`
*/
export type Producer<T> = (draft: Draft<T>) => ValidRecipeReturnType<Draft<T>> | Promise<ValidRecipeReturnType<Draft<T>>>

// Fixes #507: bili doesn't export the types of this file if there is no actual source in it..
// hopefully it get's tree-shaken away for everyone :)
export function never_used() {}

0 comments on commit c88f787

Please sign in to comment.