@@ -95,10 +95,10 @@ import {
95
95
export type ExecutionContext = {
96
96
schema : GraphQLSchema ,
97
97
fragments : ObjMap < FragmentDefinitionNode > ,
98
- rootValue : mixed ,
99
- contextValue : mixed ,
98
+ rootValue : unknown ,
99
+ contextValue : unknown ,
100
100
operation : OperationDefinitionNode ,
101
- variableValues : { [ variable : string ] : mixed , ... } ,
101
+ variableValues : { [ variable : string ] : unknown , ... } ,
102
102
fieldResolver : GraphQLFieldResolver < any , any > ,
103
103
typeResolver : GraphQLTypeResolver < any , any > ,
104
104
errors : Array < GraphQLError > ,
@@ -113,22 +113,22 @@ export type ExecutionContext = {
113
113
*/
114
114
export type ExecutionResult = {
115
115
errors ?: ReadonlyArray < GraphQLError > ,
116
- data ?: ObjMap < mixed > | null ,
117
- extensions ?: ObjMap < mixed > ,
116
+ data ?: ObjMap < unknown > | null ,
117
+ extensions ?: ObjMap < unknown > ,
118
118
} ;
119
119
120
120
export type FormattedExecutionResult = {
121
121
errors ?: ReadonlyArray < GraphQLFormattedError > ,
122
- data ?: ObjMap < mixed > | null ,
123
- extensions ?: ObjMap < mixed > ,
122
+ data ?: ObjMap < unknown > | null ,
123
+ extensions ?: ObjMap < unknown > ,
124
124
} ;
125
125
126
126
export type ExecutionArgs = {
127
127
schema : GraphQLSchema ,
128
128
document : DocumentNode ,
129
129
rootValue ?: mixed ,
130
130
contextValue ?: mixed ,
131
- variableValues ?: ?{ readonly [ variable : string ] : mixed , ... } ,
131
+ variableValues ?: ?{ readonly [ variable : string ] : unknown , ... } ,
132
132
operationName ?: ?string ,
133
133
fieldResolver ?: ?GraphQLFieldResolver < any , any > ,
134
134
typeResolver ?: ?GraphQLTypeResolver < any , any > ,
@@ -210,7 +210,7 @@ export function executeSync(args: ExecutionArgs): ExecutionResult {
210
210
*/
211
211
function buildResponse (
212
212
exeContext : ExecutionContext ,
213
- data : PromiseOrValue < ObjMap < mixed > | null > ,
213
+ data : PromiseOrValue < ObjMap < unknown > | null > ,
214
214
) : PromiseOrValue < ExecutionResult > {
215
215
if ( isPromise ( data ) ) {
216
216
return data . then ( ( resolved ) => buildResponse ( exeContext , resolved ) ) ;
@@ -229,7 +229,7 @@ function buildResponse(
229
229
export function assertValidExecutionArguments (
230
230
schema : GraphQLSchema ,
231
231
document : DocumentNode ,
232
- rawVariableValues : ?{ readonly [ variable : string ] : mixed , ... } ,
232
+ rawVariableValues : ?{ readonly [ variable : string ] : unknown , ... } ,
233
233
) : void {
234
234
devAssert ( document , 'Must provide document.' ) ;
235
235
@@ -254,12 +254,12 @@ export function assertValidExecutionArguments(
254
254
export function buildExecutionContext (
255
255
schema : GraphQLSchema ,
256
256
document : DocumentNode ,
257
- rootValue : mixed ,
258
- contextValue : mixed ,
259
- rawVariableValues : ?{ readonly [ variable : string ] : mixed , ... } ,
257
+ rootValue : unknown ,
258
+ contextValue : unknown ,
259
+ rawVariableValues : ?{ readonly [ variable : string ] : unknown , ... } ,
260
260
operationName : ?string ,
261
- fieldResolver : ?GraphQLFieldResolver < mixed , mixed > ,
262
- typeResolver ?: ?GraphQLTypeResolver < mixed , mixed > ,
261
+ fieldResolver : ?GraphQLFieldResolver < unknown , unknown > ,
262
+ typeResolver ?: ?GraphQLTypeResolver < unknown , unknown > ,
263
263
) : ReadonlyArray < GraphQLError > | ExecutionContext {
264
264
let operation : OperationDefinitionNode | void ;
265
265
const fragments : ObjMap < FragmentDefinitionNode > = Object . create ( null ) ;
@@ -325,8 +325,8 @@ export function buildExecutionContext(
325
325
function executeOperation (
326
326
exeContext : ExecutionContext ,
327
327
operation : OperationDefinitionNode ,
328
- rootValue : mixed ,
329
- ) : PromiseOrValue < ObjMap < mixed > | null > {
328
+ rootValue : unknown ,
329
+ ) : PromiseOrValue < ObjMap < unknown > | null > {
330
330
const type = getOperationRootType ( exeContext . schema , operation ) ;
331
331
const fields = collectFields (
332
332
exeContext ,
@@ -366,10 +366,10 @@ function executeOperation(
366
366
function executeFieldsSerially (
367
367
exeContext : ExecutionContext ,
368
368
parentType : GraphQLObjectType ,
369
- sourceValue : mixed ,
369
+ sourceValue : unknown ,
370
370
path : Path | void ,
371
371
fields : ObjMap < Array < FieldNode > > ,
372
- ) : PromiseOrValue < ObjMap < mixed > > {
372
+ ) : PromiseOrValue < ObjMap < unknown > > {
373
373
return promiseReduce (
374
374
Object . keys ( fields ) ,
375
375
( results , responseName ) => {
@@ -405,10 +405,10 @@ function executeFieldsSerially(
405
405
function executeFields (
406
406
exeContext : ExecutionContext ,
407
407
parentType : GraphQLObjectType ,
408
- sourceValue : mixed ,
408
+ sourceValue : unknown ,
409
409
path : Path | void ,
410
410
fields : ObjMap < Array < FieldNode > > ,
411
- ) : PromiseOrValue < ObjMap < mixed > > {
411
+ ) : PromiseOrValue < ObjMap < unknown > > {
412
412
const results = Object . create ( null ) ;
413
413
let containsPromise = false ;
414
414
@@ -584,10 +584,10 @@ function getFieldEntryKey(node: FieldNode): string {
584
584
function resolveField (
585
585
exeContext : ExecutionContext ,
586
586
parentType : GraphQLObjectType ,
587
- source : mixed ,
587
+ source : unknown ,
588
588
fieldNodes : ReadonlyArray < FieldNode > ,
589
589
path : Path ,
590
- ) : PromiseOrValue < mixed > {
590
+ ) : PromiseOrValue < unknown > {
591
591
const fieldNode = fieldNodes [ 0 ] ;
592
592
const fieldName = fieldNode . name . value ;
593
593
@@ -661,7 +661,7 @@ function resolveField(
661
661
*/
662
662
export function buildResolveInfo (
663
663
exeContext : ExecutionContext ,
664
- fieldDef : GraphQLField < mixed , mixed > ,
664
+ fieldDef : GraphQLField < unknown , unknown > ,
665
665
fieldNodes : ReadonlyArray < FieldNode > ,
666
666
parentType : GraphQLObjectType ,
667
667
path : Path ,
@@ -726,8 +726,8 @@ function completeValue(
726
726
fieldNodes : ReadonlyArray < FieldNode > ,
727
727
info : GraphQLResolveInfo ,
728
728
path : Path ,
729
- result : mixed ,
730
- ) : PromiseOrValue < mixed > {
729
+ result : unknown ,
730
+ ) : PromiseOrValue < unknown > {
731
731
// If result is an Error, throw a located error.
732
732
if ( result instanceof Error ) {
733
733
throw result ;
@@ -819,8 +819,8 @@ function completeListValue(
819
819
fieldNodes : ReadonlyArray < FieldNode > ,
820
820
info : GraphQLResolveInfo ,
821
821
path : Path ,
822
- result : mixed ,
823
- ) : PromiseOrValue < ReadonlyArray < mixed > > {
822
+ result : unknown ,
823
+ ) : PromiseOrValue < ReadonlyArray < unknown > > {
824
824
if ( ! isCollection ( result ) ) {
825
825
throw new GraphQLError (
826
826
`Expected Iterable, but did not find one for field "${ info . parentType . name } .${ info . fieldName } ".` ,
@@ -886,7 +886,7 @@ function completeListValue(
886
886
* Complete a Scalar or Enum by serializing to a valid value, returning
887
887
* null if serialization is not possible.
888
888
*/
889
- function completeLeafValue ( returnType : GraphQLLeafType , result : mixed ) : mixed {
889
+ function completeLeafValue ( returnType : GraphQLLeafType , result : unknown ) : unknown {
890
890
const serializedResult = returnType . serialize ( result ) ;
891
891
if ( serializedResult === undefined ) {
892
892
throw new Error (
@@ -907,8 +907,8 @@ function completeAbstractValue(
907
907
fieldNodes : ReadonlyArray < FieldNode > ,
908
908
info : GraphQLResolveInfo ,
909
909
path : Path ,
910
- result : mixed ,
911
- ) : PromiseOrValue < ObjMap < mixed > > {
910
+ result : unknown ,
911
+ ) : PromiseOrValue < ObjMap < unknown > > {
912
912
const resolveTypeFn = returnType . resolveType ?? exeContext . typeResolver ;
913
913
const contextValue = exeContext . contextValue ;
914
914
const runtimeType = resolveTypeFn ( result , contextValue , info , returnType ) ;
@@ -951,12 +951,12 @@ function completeAbstractValue(
951
951
}
952
952
953
953
function ensureValidRuntimeType (
954
- runtimeTypeName : mixed ,
954
+ runtimeTypeName : unknown ,
955
955
exeContext : ExecutionContext ,
956
956
returnType : GraphQLAbstractType ,
957
957
fieldNodes : ReadonlyArray < FieldNode > ,
958
958
info : GraphQLResolveInfo ,
959
- result : mixed ,
959
+ result : unknown ,
960
960
) : GraphQLObjectType {
961
961
if ( runtimeTypeName == null ) {
962
962
throw new GraphQLError (
@@ -1014,8 +1014,8 @@ function completeObjectValue(
1014
1014
fieldNodes : ReadonlyArray < FieldNode > ,
1015
1015
info : GraphQLResolveInfo ,
1016
1016
path : Path ,
1017
- result : mixed ,
1018
- ) : PromiseOrValue < ObjMap < mixed > > {
1017
+ result : unknown ,
1018
+ ) : PromiseOrValue < ObjMap < unknown > > {
1019
1019
// If there is an isTypeOf predicate function, call it with the
1020
1020
// current result. If isTypeOf returns false, then raise an error rather
1021
1021
// than continuing execution.
@@ -1053,7 +1053,7 @@ function completeObjectValue(
1053
1053
1054
1054
function invalidReturnTypeError (
1055
1055
returnType : GraphQLObjectType ,
1056
- result : mixed ,
1056
+ result : unknown ,
1057
1057
fieldNodes : ReadonlyArray < FieldNode > ,
1058
1058
) : GraphQLError {
1059
1059
return new GraphQLError (
@@ -1067,8 +1067,8 @@ function collectAndExecuteSubfields(
1067
1067
returnType : GraphQLObjectType ,
1068
1068
fieldNodes : ReadonlyArray < FieldNode > ,
1069
1069
path : Path ,
1070
- result : mixed ,
1071
- ) : PromiseOrValue < ObjMap < mixed > > {
1070
+ result : unknown ,
1071
+ ) : PromiseOrValue < ObjMap < unknown > > {
1072
1072
// Collect sub-fields to execute to complete this value.
1073
1073
const subFieldNodes = collectSubfields ( exeContext , returnType , fieldNodes ) ;
1074
1074
return executeFields ( exeContext , returnType , result , path , subFieldNodes ) ;
@@ -1111,7 +1111,7 @@ function _collectSubfields(
1111
1111
* Otherwise, test each possible type for the abstract type by calling
1112
1112
* isTypeOf for the object being coerced, returning the first type that matches.
1113
1113
*/
1114
- export const defaultTypeResolver : GraphQLTypeResolver < mixed , mixed > = function (
1114
+ export const defaultTypeResolver : GraphQLTypeResolver < unknown , unknown > = function (
1115
1115
value ,
1116
1116
contextValue ,
1117
1117
info ,
@@ -1158,8 +1158,8 @@ export const defaultTypeResolver: GraphQLTypeResolver<mixed, mixed> = function (
1158
1158
* of calling that function while passing along args and context value.
1159
1159
*/
1160
1160
export const defaultFieldResolver : GraphQLFieldResolver <
1161
- mixed ,
1162
- mixed ,
1161
+ unknown ,
1162
+ unknown ,
1163
1163
> = function ( source : any , args , contextValue , info ) {
1164
1164
// ensure source is a value for which property access is acceptable.
1165
1165
if ( isObjectLike ( source ) || typeof source === 'function' ) {
@@ -1186,7 +1186,7 @@ export function getFieldDef(
1186
1186
schema : GraphQLSchema ,
1187
1187
parentType : GraphQLObjectType ,
1188
1188
fieldName : string ,
1189
- ) : ?GraphQLField < mixed , mixed > {
1189
+ ) : ?GraphQLField < unknown , unknown > {
1190
1190
if (
1191
1191
fieldName === SchemaMetaFieldDef . name &&
1192
1192
schema . getQueryType ( ) === parentType
0 commit comments