@@ -43,6 +43,7 @@ import type {
43
43
GraphQLField ,
44
44
GraphQLFieldResolver ,
45
45
GraphQLResolveInfo ,
46
+ GraphQLTypeResolver ,
46
47
ResponsePath ,
47
48
GraphQLList ,
48
49
} 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 =>
@@ -1172,12 +1173,12 @@ function _collectSubfields(
1172
1173
* Otherwise, test each possible type for the abstract type by calling
1173
1174
* isTypeOf for the object being coerced, returning the first type that matches.
1174
1175
*/
1175
- function defaultResolveTypeFn (
1176
- value : mixed ,
1177
- contextValue : mixed ,
1178
- info : GraphQLResolveInfo ,
1179
- abstractType : GraphQLAbstractType ,
1180
- ) : MaybePromise < ? GraphQLObjectType | string > {
1176
+ const defaultResolveType : GraphQLTypeResolver < any , * > = function (
1177
+ value ,
1178
+ contextValue ,
1179
+ info ,
1180
+ abstractType ,
1181
+ ) {
1181
1182
// First, look for `__typename`.
1182
1183
if (
1183
1184
value !== null &&
@@ -1214,7 +1215,7 @@ function defaultResolveTypeFn(
1214
1215
}
1215
1216
} ) ;
1216
1217
}
1217
- }
1218
+ } ;
1218
1219
1219
1220
/**
1220
1221
* If a resolve function is not given, then a default resolve behavior is used
0 commit comments