@@ -13,6 +13,7 @@ import invariant from '../jsutils/invariant';
13
13
import isInvalid from '../jsutils/isInvalid';
14
14
import isNullish from '../jsutils/isNullish';
15
15
import type { ObjMap } from '../jsutils/ObjMap';
16
+ import type { MaybePromise } from '../jsutils/MaybePromise';
16
17
17
18
import { typeFromAST } from '../utilities/typeFromAST';
18
19
import * as Kind from '../language/kinds';
@@ -133,7 +134,7 @@ export type ExecutionArgs = {|
133
134
declare function execute(
134
135
ExecutionArgs,
135
136
..._: []
136
- ): Promise <ExecutionResult> | ExecutionResult ;
137
+ ): MaybePromise <ExecutionResult>;
137
138
/* eslint-disable no-redeclare */
138
139
declare function execute(
139
140
schema: GraphQLSchema,
@@ -143,7 +144,7 @@ declare function execute(
143
144
variableValues?: ?{ [variable: string]: mixed },
144
145
operationName?: ?string,
145
146
fieldResolver?: ?GraphQLFieldResolver<any, any>,
146
- ): Promise <ExecutionResult> | ExecutionResult ;
147
+ ): MaybePromise <ExecutionResult>;
147
148
export function execute(
148
149
argsOrSchema,
149
150
document,
@@ -222,7 +223,7 @@ function executeImpl(
222
223
*/
223
224
function buildResponse(
224
225
context: ExecutionContext,
225
- data: Promise <ObjMap<mixed> | null> | ObjMap<mixed> | null ,
226
+ data: MaybePromise <ObjMap<mixed> | null>,
226
227
) {
227
228
const promise = getPromise(data);
228
229
if (promise) {
@@ -376,7 +377,7 @@ function executeOperation(
376
377
exeContext: ExecutionContext,
377
378
operation: OperationDefinitionNode,
378
379
rootValue: mixed,
379
- ): Promise <ObjMap<mixed> | null> | ObjMap<mixed> | null {
380
+ ): MaybePromise <ObjMap<mixed> | null> {
380
381
const type = getOperationRootType(exeContext.schema, operation);
381
382
const fields = collectFields(
382
383
exeContext,
@@ -503,7 +504,7 @@ function executeFields(
503
504
sourceValue: mixed,
504
505
path: ResponsePath | void,
505
506
fields: ObjMap<Array<FieldNode>>,
506
- ): Promise <ObjMap<mixed>> | ObjMap<mixed > {
507
+ ): MaybePromise <ObjMap<mixed>> {
507
508
let containsPromise = false;
508
509
509
510
const finalResults = Object.keys(fields).reduce((results, responseName) => {
0 commit comments