Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d6e760c

Browse files
resolveType: add workaround for transformed schemas (graphql#2793)
closes graphql#2779
1 parent 64a5c34 commit d6e760c

File tree

5 files changed

+112
-320
lines changed

5 files changed

+112
-320
lines changed

src/__tests__/starWarsSchema.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,11 @@ const characterInterface = new GraphQLInterfaceType({
125125
},
126126
}),
127127
resolveType(character) {
128-
if (character.type === 'Human') {
129-
return humanType;
130-
}
131-
// istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
132-
if (character.type === 'Droid') {
133-
return droidType;
128+
switch (character.type) {
129+
case 'Human':
130+
return humanType.name;
131+
case 'Droid':
132+
return droidType.name;
134133
}
135134

136135
// istanbul ignore next (Not reachable. All possible types have been considered)

0 commit comments

Comments
 (0)