mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge pull request #28087 from dfreeman/graphql-resolve-batch-info
[graphql-resolve-batch] Batch resolvers receive ResolveInfo
This commit is contained in:
@@ -95,13 +95,15 @@ const withSourceAndArgsAndContextTyped = createBatchResolver<
|
||||
SomeTestResult,
|
||||
SomeTestArgs,
|
||||
SomeTestContext
|
||||
>(async (sources, args, context) => {
|
||||
>(async (sources, args, context, info) => {
|
||||
// $ExpectType ReadonlyArray<SomeTestSource>
|
||||
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;
|
||||
|
||||
+4
-1
@@ -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<TSource, TArgs, TContext, TReturn> = (
|
||||
export type BatchResolveFunction<TSource, TArgs, TContext, TReturn> = (
|
||||
sources: ReadonlyArray<TSource>,
|
||||
args: TArgs,
|
||||
context: TContext
|
||||
context: TContext,
|
||||
info: GraphQLResolveInfo
|
||||
) => TReturn[] | Promise<TReturn[]>;
|
||||
|
||||
Reference in New Issue
Block a user