Skip to content

Commit

Permalink
Better typings for AsyncIterator/Generator, like microsoft#31117
Browse files Browse the repository at this point in the history
  • Loading branch information
jablko authored Aug 27, 2019
1 parent 4fc12d7 commit 31c9cfc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/es2018.asynciterable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ interface SymbolConstructor {

interface AsyncIterator<T, TReturn = any, TNext = undefined> {
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
next(...args: [] | [TNext | PromiseLike<TNext>]): Promise<IteratorResult<T, TReturn>>;
return?(value?: TReturn | PromiseLike<TReturn>): Promise<IteratorResult<T, TReturn>>;
throw?(e?: any): Promise<IteratorResult<T, TReturn>>;
next(...args: [] | [TNext]): Promise<IteratorResult<T, TReturn extends PromiseLike<infer UReturn> ? UReturn : TReturn>>;
return?(value?: TReturn): Promise<IteratorResult<T, TReturn extends PromiseLike<infer UReturn> ? UReturn : TReturn>>;
throw?(e?: any): Promise<IteratorResult<T, TReturn extends PromiseLike<infer UReturn> ? UReturn : TReturn>>;
}

interface AsyncIterable<T> {
Expand All @@ -22,4 +22,4 @@ interface AsyncIterable<T> {

interface AsyncIterableIterator<T> extends AsyncIterator<T> {
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
}
}

0 comments on commit 31c9cfc

Please sign in to comment.