Skip to content

Commit

Permalink
Update asyncgen type
Browse files Browse the repository at this point in the history
  • Loading branch information
bkiac committed Jun 8, 2024
1 parent b5a3283 commit 2df63fd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/fn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ export function gen<A extends any[], R extends Result<any, any>, T>(
* })
* ```
*/
export function asyncGen<A extends any[], R extends AsyncResult<any, any> | Result<any, any>, T>(
fn: (...args: A) => AsyncGenerator<R, T, any>,
): (...args: A) => AsyncResult<T, InferErr<Awaited<R>>> {
export function asyncGen<A extends any[], R extends AsyncResult<any, any> | Result<any, any>>(
fn: (...args: A) => AsyncGenerator<R, InferOk<Awaited<R>>, any>,
): (...args: A) => AsyncResult<InferOk<Awaited<R>>, InferErr<Awaited<R>>> {
return function (...args: any[]) {
return tryAsync(() => fn(...(args as A)));
};
Expand Down

0 comments on commit 2df63fd

Please sign in to comment.