Skip to content

Commit

Permalink
change type definition to allow passing synchronous functions
Browse files Browse the repository at this point in the history
  • Loading branch information
DCtheTall committed Oct 8, 2019
1 parent 0abc04d commit f2841c2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
type AsyncFunction<T> = (...args: any[]) => Promise<T>;
type AsyncFunction<S extends any[], T> = (...args: S) => Promise<T>;

export default function greenlet<T extends AsyncFunction<U>, U>(fn: T): T;
type MaybeAsyncFunction<S extends any[], T> = (...args: S) => (T | Promise<T>);

export default function greenlet<S extends any[], T>(fn: MaybeAsyncFunction<S, T>): AsyncFunction<S, T>;

0 comments on commit f2841c2

Please sign in to comment.