Skip to content
This repository has been archived by the owner on Sep 20, 2022. It is now read-only.

Commit

Permalink
Fix @link on non-null object types
Browse files Browse the repository at this point in the history
  • Loading branch information
Yogu committed Jun 24, 2019
1 parent 942a2f1 commit 5d03df6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/graphql/schema-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
getNullableType, GraphQLField, GraphQLFieldMap, GraphQLInterfaceType, GraphQLList, GraphQLNonNull,
getNamedType,
getNullableType, GraphQLField, GraphQLFieldMap, GraphQLInterfaceType, GraphQLList, GraphQLNamedType, GraphQLNonNull,
GraphQLObjectType, GraphQLSchema, GraphQLType, GraphQLUnionType
} from 'graphql';

Expand All @@ -11,7 +12,7 @@ import {
*/
export function walkFields(type: GraphQLObjectType|GraphQLInterfaceType, fieldNames: string[]): GraphQLField<any, any>|undefined {
let field: GraphQLField<any, any>|undefined;
let currentType: GraphQLType = type;
let currentType: GraphQLNamedType = type;
for (const fieldName of fieldNames) {
if (!(currentType instanceof GraphQLObjectType) && !(currentType instanceof GraphQLInterfaceType)) {
return undefined;
Expand All @@ -23,7 +24,7 @@ export function walkFields(type: GraphQLObjectType|GraphQLInterfaceType, fieldNa
}

field = fields[fieldName];
currentType = field.type;
currentType = getNamedType(field.type);
}
return field;
}
Expand Down

0 comments on commit 5d03df6

Please sign in to comment.