@@ -285,20 +285,23 @@ export function extendSchema(
285
285
return (extendTypeCache[type.name]: any);
286
286
}
287
287
288
- // Should be called only once per type so only getExtendedType should call it .
288
+ // To be called at most once per type. Only getExtendedType should call this .
289
289
function extendType < T : GraphQLNamedType > (type: T): T {
290
- let extendedType = type ;
291
- if ( ! isIntrospectionType ( type ) ) {
292
- if ( isObjectType ( type ) ) {
293
- extendedType = extendObjectType ( type ) ;
294
- } else if ( isInterfaceType ( type ) ) {
295
- extendedType = extendInterfaceType ( type ) ;
296
- } else if ( isUnionType ( type ) ) {
297
- extendedType = extendUnionType ( type ) ;
298
- }
290
+ if ( isIntrospectionType ( type ) ) {
291
+ // Introspection types are not extended.
292
+ return type ;
293
+ }
294
+ if (isObjectType(type)) {
295
+ return extendObjectType ( type ) ;
296
+ }
297
+ if (isInterfaceType(type)) {
298
+ return extendInterfaceType ( type ) ;
299
+ }
300
+ if (isUnionType(type)) {
301
+ return extendUnionType ( type ) ;
299
302
}
300
- // Workaround: Flow should figure out correct type, but it doesn't .
301
- return (extendedType: any) ;
303
+ // This type is not yet extendable .
304
+ return type ;
302
305
}
303
306
304
307
function extendObjectType ( type : GraphQLObjectType ) : GraphQLObjectType {
0 commit comments