Skip to content

Commit 2dd902a

Browse files
authored
Merge pull request #45 from DCtheTall/greenlet-type
Change TypeScript type definition to using synchronous functions
2 parents 0abc04d + f2841c2 commit 2dd902a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

index.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
type AsyncFunction<T> = (...args: any[]) => Promise<T>;
1+
type AsyncFunction<S extends any[], T> = (...args: S) => Promise<T>;
22

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

0 commit comments

Comments
 (0)