From ecf732fe03df2dd5a355cc2c7912245164a48301 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Wed, 31 Mar 2021 11:05:16 -0500 Subject: [PATCH] TS: use proper type for async generator (#3009) --- integrationTests/ts/tsconfig.json | 2 +- src/subscription/mapAsyncIterator.d.ts | 4 ++-- src/subscription/subscribe.d.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integrationTests/ts/tsconfig.json b/integrationTests/ts/tsconfig.json index ea6266120c..03106e8e86 100644 --- a/integrationTests/ts/tsconfig.json +++ b/integrationTests/ts/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["es6", "esnext.asynciterable"], + "lib": ["es2019", "es2020.string"], "strict": true, "noEmit": true, "types": [] diff --git a/src/subscription/mapAsyncIterator.d.ts b/src/subscription/mapAsyncIterator.d.ts index ecf2e51cd3..fb031ba3bf 100644 --- a/src/subscription/mapAsyncIterator.d.ts +++ b/src/subscription/mapAsyncIterator.d.ts @@ -5,7 +5,7 @@ import { PromiseOrValue } from '../jsutils/PromiseOrValue'; * which produces values mapped via calling the callback function. */ export function mapAsyncIterator( - iterable: AsyncIterable, + iterable: AsyncIterable | AsyncGenerator, callback: (arg: T) => PromiseOrValue, rejectCallback?: (arg: any) => PromiseOrValue, -): any; // TS_SPECIFIC: AsyncGenerator requires typescript@3.6 +): AsyncGenerator; diff --git a/src/subscription/subscribe.d.ts b/src/subscription/subscribe.d.ts index 2dcfeed21e..46c00d3e92 100644 --- a/src/subscription/subscribe.d.ts +++ b/src/subscription/subscribe.d.ts @@ -39,7 +39,7 @@ export interface SubscriptionArgs { */ export function subscribe( args: SubscriptionArgs, -): Promise | ExecutionResult>; +): Promise | ExecutionResult>; /** * Implements the "CreateSourceEventStream" algorithm described in the