Skip to content

Allow consumers to specify a custom data type for execute #2862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/execution/execute.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,14 @@ export interface ExecutionArgs {
*
* Accepts either an object with named arguments, or individual arguments.
*/
export function execute(args: ExecutionArgs): PromiseOrValue<ExecutionResult>;
export function execute(
export function execute<
TData = { [key: string]: any },
TExtensions = { [key: string]: any }
>(args: ExecutionArgs): PromiseOrValue<ExecutionResult<TData, TExtensions>>;
export function execute<
TData = { [key: string]: any },
TExtensions = { [key: string]: any }
>(
schema: GraphQLSchema,
document: DocumentNode,
rootValue?: any,
Expand All @@ -99,14 +105,17 @@ export function execute(
operationName?: Maybe<string>,
fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>,
typeResolver?: Maybe<GraphQLTypeResolver<any, any>>,
): PromiseOrValue<ExecutionResult>;
): PromiseOrValue<ExecutionResult<TData, TExtensions>>;

/**
* Also implements the "Evaluating requests" section of the GraphQL specification.
* However, it guarantees to complete synchronously (or throw an error) assuming
* that all field resolvers are also synchronous.
*/
export function executeSync(args: ExecutionArgs): ExecutionResult;
export function executeSync<
TData = { [key: string]: any },
TExtensions = { [key: string]: any }
>(args: ExecutionArgs): ExecutionResult<TData, TExtensions>;

/**
* Essential assertions before executing to provide developer feedback for
Expand Down