1
- import type { Maybe } from '../jsutils/Maybe ' ;
1
+ import type { Path } from '../jsutils/Path ' ;
2
2
import type { ObjMap } from '../jsutils/ObjMap' ;
3
3
import 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' ;
6
5
import type { GraphQLFormattedError } from '../error/formatError' ;
6
+ import { GraphQLError } from '../error/GraphQLError' ;
7
7
import type {
8
8
DocumentNode ,
9
9
OperationDefinitionNode ,
@@ -13,11 +13,11 @@ import type {
13
13
} from '../language/ast' ;
14
14
import type { GraphQLSchema } from '../type/schema' ;
15
15
import type {
16
+ GraphQLObjectType ,
16
17
GraphQLField ,
17
18
GraphQLFieldResolver ,
18
19
GraphQLResolveInfo ,
19
20
GraphQLTypeResolver ,
20
- GraphQLObjectType ,
21
21
} from '../type/definition' ;
22
22
/**
23
23
* Terminology
@@ -46,11 +46,13 @@ import type {
46
46
*/
47
47
export interface ExecutionContext {
48
48
schema : GraphQLSchema ;
49
+ fragments : ObjMap < FragmentDefinitionNode > ;
49
50
rootValue : unknown ;
50
51
contextValue : unknown ;
51
- fragments : ObjMap < FragmentDefinitionNode > ;
52
52
operation : OperationDefinitionNode ;
53
- variableValues : { [ key : string ] : unknown } ;
53
+ variableValues : {
54
+ [ variable : string ] : unknown ;
55
+ } ;
54
56
fieldResolver : GraphQLFieldResolver < any , any > ;
55
57
typeResolver : GraphQLTypeResolver < any , any > ;
56
58
errors : Array < GraphQLError > ;
@@ -63,20 +65,18 @@ export interface ExecutionContext {
63
65
* - `extensions` is reserved for adding non-standard properties.
64
66
*/
65
67
export interface ExecutionResult <
66
- TData = { [ key : string ] : any } ,
67
- TExtensions = { [ key : string ] : any } ,
68
+ TData = ObjMap < unknown > ,
69
+ TExtensions = ObjMap < unknown > ,
68
70
> {
69
71
errors ?: ReadonlyArray < GraphQLError > ;
70
- // TS_SPECIFIC: TData. Motivation: https://github.com/graphql/graphql-js/pull/2490#issuecomment-639154229
71
72
data ?: TData | null ;
72
73
extensions ?: TExtensions ;
73
74
}
74
75
export interface FormattedExecutionResult <
75
- TData = { [ key : string ] : any } ,
76
- TExtensions = { [ key : string ] : any } ,
76
+ TData = ObjMap < unknown > ,
77
+ TExtensions = ObjMap < unknown > ,
77
78
> {
78
79
errors ?: ReadonlyArray < GraphQLFormattedError > ;
79
- // TS_SPECIFIC: TData. Motivation: https://github.com/graphql/graphql-js/pull/2490#issuecomment-639154229
80
80
data ?: TData | null ;
81
81
extensions ?: TExtensions ;
82
82
}
@@ -85,7 +85,9 @@ export interface ExecutionArgs {
85
85
document : DocumentNode ;
86
86
rootValue ?: unknown ;
87
87
contextValue ?: unknown ;
88
- variableValues ?: Maybe < { [ key : string ] : unknown } > ;
88
+ variableValues ?: Maybe < {
89
+ readonly [ variable : string ] : unknown ;
90
+ } > ;
89
91
operationName ?: Maybe < string > ;
90
92
fieldResolver ?: Maybe < GraphQLFieldResolver < any , any > > ;
91
93
typeResolver ?: Maybe < GraphQLTypeResolver < any , any > > ;
@@ -116,7 +118,9 @@ export function executeSync(args: ExecutionArgs): ExecutionResult;
116
118
export function assertValidExecutionArguments (
117
119
schema : GraphQLSchema ,
118
120
document : DocumentNode ,
119
- rawVariableValues : Maybe < { [ key : string ] : unknown } > ,
121
+ rawVariableValues : Maybe < {
122
+ readonly [ variable : string ] : unknown ;
123
+ } > ,
120
124
) : void ;
121
125
/**
122
126
* Constructs a ExecutionContext object from the arguments passed to
@@ -131,7 +135,9 @@ export function buildExecutionContext(
131
135
document : DocumentNode ,
132
136
rootValue : unknown ,
133
137
contextValue : unknown ,
134
- rawVariableValues : Maybe < { [ key : string ] : unknown } > ,
138
+ rawVariableValues : Maybe < {
139
+ readonly [ variable : string ] : unknown ;
140
+ } > ,
135
141
operationName : Maybe < string > ,
136
142
fieldResolver : Maybe < GraphQLFieldResolver < unknown , unknown > > ,
137
143
typeResolver ?: Maybe < GraphQLTypeResolver < unknown , unknown > > ,
@@ -150,9 +156,9 @@ export function collectFields(
150
156
exeContext : ExecutionContext ,
151
157
runtimeType : GraphQLObjectType ,
152
158
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 > > ;
156
162
/**
157
163
* @internal
158
164
*/
@@ -195,5 +201,5 @@ export const defaultFieldResolver: GraphQLFieldResolver<unknown, unknown>;
195
201
export function getFieldDef (
196
202
schema : GraphQLSchema ,
197
203
parentType : GraphQLObjectType ,
198
- fieldName : string ,
204
+ fieldNode : FieldNode ,
199
205
) : Maybe < GraphQLField < unknown , unknown > > ;
0 commit comments