@@ -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' ;
@@ -988,9 +989,9 @@ function completeAbstractValue(
988
989
path: ResponsePath,
989
990
result: mixed,
990
991
): MaybePromise< ObjMap < mixed > > {
991
- const runtimeType = returnType . resolveType
992
- ? returnType . resolveType ( result , exeContext . contextValue , info )
993
- : defaultResolveTypeFn ( result , exeContext . contextValue , info , returnType ) ;
992
+ const resolveTypeFn = returnType . resolveType || defaultResolveType ;
993
+ const contextValue = exeContext . contextValue ;
994
+ const runtimeType = resolveTypeFn ( result , contextValue , info , returnType ) ;
994
995
995
996
if ( isPromise ( runtimeType ) ) {
996
997
return runtimeType . then ( resolvedRuntimeType =>
@@ -1171,12 +1172,12 @@ function _collectSubfields(
1171
1172
* Otherwise, test each possible type for the abstract type by calling
1172
1173
* isTypeOf for the object being coerced, returning the first type that matches.
1173
1174
*/
1174
- function defaultResolveTypeFn (
1175
- value : mixed ,
1176
- contextValue : mixed ,
1177
- info : GraphQLResolveInfo ,
1178
- abstractType : GraphQLAbstractType ,
1179
- ) : MaybePromise < ? GraphQLObjectType | string > {
1175
+ const defaultResolveType : GraphQLTypeResolver < any , * > = function (
1176
+ value ,
1177
+ contextValue ,
1178
+ info ,
1179
+ abstractType ,
1180
+ ) {
1180
1181
// First, look for `__typename`.
1181
1182
if (
1182
1183
value !== null &&
@@ -1213,7 +1214,7 @@ function defaultResolveTypeFn(
1213
1214
}
1214
1215
} ) ;
1215
1216
}
1216
- }
1217
+ } ;
1217
1218
1218
1219
/**
1219
1220
* If a resolve function is not given, then a default resolve behavior is used
0 commit comments