From f77583e076ca67f11e533b54e6a7e972c2ed1233 Mon Sep 17 00:00:00 2001 From: Dan Freeman Date: Mon, 13 Aug 2018 14:34:47 -0400 Subject: [PATCH] [graphql-resolve-batch] Batch resolvers receive ResolveInfo --- types/graphql-resolve-batch/graphql-resolve-batch-tests.ts | 4 +++- types/graphql-resolve-batch/index.d.ts | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/types/graphql-resolve-batch/graphql-resolve-batch-tests.ts b/types/graphql-resolve-batch/graphql-resolve-batch-tests.ts index 9043cdaf0e..51f8964423 100644 --- a/types/graphql-resolve-batch/graphql-resolve-batch-tests.ts +++ b/types/graphql-resolve-batch/graphql-resolve-batch-tests.ts @@ -95,13 +95,15 @@ const withSourceAndArgsAndContextTyped = createBatchResolver< SomeTestResult, SomeTestArgs, SomeTestContext ->(async (sources, args, context) => { +>(async (sources, args, context, info) => { // $ExpectType ReadonlyArray const verifySources = sources; // $ExpectType string const verifyArgs = args.someArg; // $ExpectType string const verifyContext = context.someContextProp; + // $ExpectType GraphQLResolveInfo + const verifyInfo = info; const result = await asyncBatchFunction(sources); return result; diff --git a/types/graphql-resolve-batch/index.d.ts b/types/graphql-resolve-batch/index.d.ts index ea90a83555..9908b7082a 100644 --- a/types/graphql-resolve-batch/index.d.ts +++ b/types/graphql-resolve-batch/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 +import { GraphQLResolveInfo } from 'graphql'; + /** * Creates a GraphQL.js field resolver that batches together multiple resolves * together that share the *exact* same GraphQL field selection. @@ -45,5 +47,6 @@ export type ResolverFunction = ( export type BatchResolveFunction = ( sources: ReadonlyArray, args: TArgs, - context: TContext + context: TContext, + info: GraphQLResolveInfo ) => TReturn[] | Promise;