@@ -44,6 +44,7 @@ import type {
44
44
GraphQLField ,
45
45
GraphQLFieldResolver ,
46
46
GraphQLResolveInfo ,
47
+ GraphQLTypeResolver ,
47
48
ResponsePath ,
48
49
GraphQLList ,
49
50
} from '../type/definition' ;
@@ -991,9 +992,9 @@ function completeAbstractValue(
991
992
path: ResponsePath,
992
993
result: mixed,
993
994
): MaybePromise< ObjMap < mixed > > {
994
- const runtimeType = returnType . resolveType
995
- ? returnType . resolveType ( result , exeContext . contextValue , info )
996
- : defaultResolveTypeFn ( result , exeContext . contextValue , info , returnType ) ;
995
+ const resolveTypeFn = returnType . resolveType || defaultResolveType ;
996
+ const contextValue = exeContext . contextValue ;
997
+ const runtimeType = resolveTypeFn ( result , contextValue , info , returnType ) ;
997
998
998
999
if ( isPromise ( runtimeType ) ) {
999
1000
return runtimeType . then ( resolvedRuntimeType =>
@@ -1174,12 +1175,12 @@ function _collectSubfields(
1174
1175
* Otherwise, test each possible type for the abstract type by calling
1175
1176
* isTypeOf for the object being coerced, returning the first type that matches.
1176
1177
*/
1177
- function defaultResolveTypeFn (
1178
- value : mixed ,
1179
- contextValue : mixed ,
1180
- info : GraphQLResolveInfo ,
1181
- abstractType : GraphQLAbstractType ,
1182
- ) : MaybePromise < ? GraphQLObjectType | string > {
1178
+ const defaultResolveType : GraphQLTypeResolver < any , * > = function (
1179
+ value ,
1180
+ contextValue ,
1181
+ info ,
1182
+ abstractType ,
1183
+ ) {
1183
1184
// First, look for `__typename`.
1184
1185
if (
1185
1186
value !== null &&
@@ -1216,7 +1217,7 @@ function defaultResolveTypeFn(
1216
1217
}
1217
1218
} ) ;
1218
1219
}
1219
- }
1220
+ } ;
1220
1221
1221
1222
/**
1222
1223
* If a resolve function is not given, then a default resolve behavior is used
0 commit comments