Skip to content

Commit ecf732f

Browse files
authored
TS: use proper type for async generator (#3009)
1 parent 9531486 commit ecf732f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

integrationTests/ts/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
33
"module": "commonjs",
4-
"lib": ["es6", "esnext.asynciterable"],
4+
"lib": ["es2019", "es2020.string"],
55
"strict": true,
66
"noEmit": true,
77
"types": []

src/subscription/mapAsyncIterator.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { PromiseOrValue } from '../jsutils/PromiseOrValue';
55
* which produces values mapped via calling the callback function.
66
*/
77
export function mapAsyncIterator<T, U>(
8-
iterable: AsyncIterable<T>,
8+
iterable: AsyncIterable<T> | AsyncGenerator<T, void, void>,
99
callback: (arg: T) => PromiseOrValue<U>,
1010
rejectCallback?: (arg: any) => PromiseOrValue<U>,
11-
): any; // TS_SPECIFIC: AsyncGenerator requires [email protected]
11+
): AsyncGenerator<U, void, void>;

src/subscription/subscribe.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export interface SubscriptionArgs {
3939
*/
4040
export function subscribe(
4141
args: SubscriptionArgs,
42-
): Promise<AsyncIterableIterator<ExecutionResult> | ExecutionResult>;
42+
): Promise<AsyncGenerator<ExecutionResult, void, void> | ExecutionResult>;
4343

4444
/**
4545
* Implements the "CreateSourceEventStream" algorithm described in the

0 commit comments

Comments
 (0)