Skip to content

Commit

Permalink
Merge pull request developit#45 from DCtheTall/greenlet-type
Browse files Browse the repository at this point in the history
Change TypeScript type definition to using synchronous functions
  • Loading branch information
developit authored Oct 15, 2019
2 parents 0abc04d + f2841c2 commit 2dd902a
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 2dd902a

Please sign in to comment.