Skip to content

Commit d707c2e

Browse files
committed
Improve flow types for execute logic
1 parent 5e6a5b9 commit d707c2e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/execution/execute.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
} from '../type/definition';
2929
import { GraphQLList, GraphQLNonNull } from '../type/wrappers';
3030
import type {
31-
GraphQLType,
31+
GraphQLOutputType,
3232
GraphQLLeafType,
3333
GraphQLAbstractType,
3434
GraphQLField,
@@ -799,7 +799,7 @@ function asErrorInstance(error: mixed): Error {
799799
// in the execution context.
800800
function completeValueCatchingError(
801801
exeContext: ExecutionContext,
802-
returnType: GraphQLType,
802+
returnType: GraphQLOutputType,
803803
fieldNodes: $ReadOnlyArray<FieldNode>,
804804
info: GraphQLResolveInfo,
805805
path: ResponsePath,
@@ -853,7 +853,7 @@ function completeValueCatchingError(
853853
// location information.
854854
function completeValueWithLocatedError(
855855
exeContext: ExecutionContext,
856-
returnType: GraphQLType,
856+
returnType: GraphQLOutputType,
857857
fieldNodes: $ReadOnlyArray<FieldNode>,
858858
info: GraphQLResolveInfo,
859859
path: ResponsePath,
@@ -913,7 +913,7 @@ function completeValueWithLocatedError(
913913
*/
914914
function completeValue(
915915
exeContext: ExecutionContext,
916-
returnType: GraphQLType,
916+
returnType: GraphQLOutputType,
917917
fieldNodes: $ReadOnlyArray<FieldNode>,
918918
info: GraphQLResolveInfo,
919919
path: ResponsePath,
@@ -1003,7 +1003,9 @@ function completeValue(
10031003

10041004
// Not reachable. All possible output types have been considered.
10051005
throw new Error(
1006-
`Cannot complete value of unexpected type "${String(returnType)}".`,
1006+
`Cannot complete value of unexpected type "${String(
1007+
(returnType: empty),
1008+
)}".`,
10071009
);
10081010
}
10091011

0 commit comments

Comments
 (0)