1- import type { Maybe } from '../jsutils/Maybe ' ;
1+ import type { Path } from '../jsutils/Path ' ;
22import type { ObjMap } from '../jsutils/ObjMap' ;
33import type { PromiseOrValue } from '../jsutils/PromiseOrValue' ;
4- import type { Path } from '../jsutils/Path' ;
5- import type { GraphQLError } from '../error/GraphQLError' ;
4+ import type { Maybe } from '../jsutils/Maybe' ;
65import type { GraphQLFormattedError } from '../error/formatError' ;
6+ import { GraphQLError } from '../error/GraphQLError' ;
77import type {
88 DocumentNode ,
99 OperationDefinitionNode ,
@@ -13,11 +13,11 @@ import type {
1313} from '../language/ast' ;
1414import type { GraphQLSchema } from '../type/schema' ;
1515import type {
16+ GraphQLObjectType ,
1617 GraphQLField ,
1718 GraphQLFieldResolver ,
1819 GraphQLResolveInfo ,
1920 GraphQLTypeResolver ,
20- GraphQLObjectType ,
2121} from '../type/definition' ;
2222/**
2323 * Terminology
@@ -46,11 +46,13 @@ import type {
4646 */
4747export interface ExecutionContext {
4848 schema : GraphQLSchema ;
49+ fragments : ObjMap < FragmentDefinitionNode > ;
4950 rootValue : unknown ;
5051 contextValue : unknown ;
51- fragments : ObjMap < FragmentDefinitionNode > ;
5252 operation : OperationDefinitionNode ;
53- variableValues : { [ key : string ] : unknown } ;
53+ variableValues : {
54+ [ variable : string ] : unknown ;
55+ } ;
5456 fieldResolver : GraphQLFieldResolver < any , any > ;
5557 typeResolver : GraphQLTypeResolver < any , any > ;
5658 errors : Array < GraphQLError > ;
@@ -63,20 +65,18 @@ export interface ExecutionContext {
6365 * - `extensions` is reserved for adding non-standard properties.
6466 */
6567export interface ExecutionResult <
66- TData = { [ key : string ] : any } ,
67- TExtensions = { [ key : string ] : any } ,
68+ TData = ObjMap < unknown > ,
69+ TExtensions = ObjMap < unknown > ,
6870> {
6971 errors ?: ReadonlyArray < GraphQLError > ;
70- // TS_SPECIFIC: TData. Motivation: https://github.com/graphql/graphql-js/pull/2490#issuecomment-639154229
7172 data ?: TData | null ;
7273 extensions ?: TExtensions ;
7374}
7475export interface FormattedExecutionResult <
75- TData = { [ key : string ] : any } ,
76- TExtensions = { [ key : string ] : any } ,
76+ TData = ObjMap < unknown > ,
77+ TExtensions = ObjMap < unknown > ,
7778> {
7879 errors ?: ReadonlyArray < GraphQLFormattedError > ;
79- // TS_SPECIFIC: TData. Motivation: https://github.com/graphql/graphql-js/pull/2490#issuecomment-639154229
8080 data ?: TData | null ;
8181 extensions ?: TExtensions ;
8282}
@@ -85,7 +85,9 @@ export interface ExecutionArgs {
8585 document : DocumentNode ;
8686 rootValue ?: unknown ;
8787 contextValue ?: unknown ;
88- variableValues ?: Maybe < { [ key : string ] : unknown } > ;
88+ variableValues ?: Maybe < {
89+ readonly [ variable : string ] : unknown ;
90+ } > ;
8991 operationName ?: Maybe < string > ;
9092 fieldResolver ?: Maybe < GraphQLFieldResolver < any , any > > ;
9193 typeResolver ?: Maybe < GraphQLTypeResolver < any , any > > ;
@@ -116,7 +118,9 @@ export function executeSync(args: ExecutionArgs): ExecutionResult;
116118export function assertValidExecutionArguments (
117119 schema : GraphQLSchema ,
118120 document : DocumentNode ,
119- rawVariableValues : Maybe < { [ key : string ] : unknown } > ,
121+ rawVariableValues : Maybe < {
122+ readonly [ variable : string ] : unknown ;
123+ } > ,
120124) : void ;
121125/**
122126 * Constructs a ExecutionContext object from the arguments passed to
@@ -131,7 +135,9 @@ export function buildExecutionContext(
131135 document : DocumentNode ,
132136 rootValue : unknown ,
133137 contextValue : unknown ,
134- rawVariableValues : Maybe < { [ key : string ] : unknown } > ,
138+ rawVariableValues : Maybe < {
139+ readonly [ variable : string ] : unknown ;
140+ } > ,
135141 operationName : Maybe < string > ,
136142 fieldResolver : Maybe < GraphQLFieldResolver < unknown , unknown > > ,
137143 typeResolver ?: Maybe < GraphQLTypeResolver < unknown , unknown > > ,
@@ -150,9 +156,9 @@ export function collectFields(
150156 exeContext : ExecutionContext ,
151157 runtimeType : GraphQLObjectType ,
152158 selectionSet : SelectionSetNode ,
153- fields : ObjMap < Array < FieldNode > > ,
154- visitedFragmentNames : ObjMap < boolean > ,
155- ) : ObjMap < Array < FieldNode > > ;
159+ fields : Map < string , Array < FieldNode > > ,
160+ visitedFragmentNames : Set < string > ,
161+ ) : Map < string , Array < FieldNode > > ;
156162/**
157163 * @internal
158164 */
@@ -195,5 +201,5 @@ export const defaultFieldResolver: GraphQLFieldResolver<unknown, unknown>;
195201export function getFieldDef (
196202 schema : GraphQLSchema ,
197203 parentType : GraphQLObjectType ,
198- fieldName : string ,
204+ fieldNode : FieldNode ,
199205) : Maybe < GraphQLField < unknown , unknown > > ;
0 commit comments