diff --git a/packages/insomnia-app/app/ui/components/graph-ql-explorer/graph-ql-explorer-type.js b/packages/insomnia-app/app/ui/components/graph-ql-explorer/graph-ql-explorer-type.js index 846066d4b3..c202e87311 100644 --- a/packages/insomnia-app/app/ui/components/graph-ql-explorer/graph-ql-explorer-type.js +++ b/packages/insomnia-app/app/ui/components/graph-ql-explorer/graph-ql-explorer-type.js @@ -4,6 +4,7 @@ import GraphQLExplorerTypeLink from './graph-ql-explorer-type-link'; import autobind from 'autobind-decorator'; import MarkdownPreview from '../markdown-preview'; import GraphQLExplorerFieldLink from './graph-ql-explorer-field-link'; +import { GraphQLUnionType } from 'graphql'; import type { GraphQLType, GraphQLField } from 'graphql'; type Props = { @@ -32,25 +33,26 @@ class GraphQLExplorerType extends React.PureComponent { renderTypesMaybe() { const { type, onNavigateType } = this.props; - if ( - Object.prototype.toString.call(type) !== '[object GraphQLUnionType]' && - Object.prototype.toString.call(type.getTypes) !== '[object Function]' - ) { + if (typeof type.getTypes !== 'function') { return null; } - // $FlowFixMe - const types = type.getTypes(); + + if (!(type instanceof GraphQLUnionType)) { + return null; + } + + const types = (type: Object).getTypes(); + + console.log('UNION TYPE? ', types); return (

Possible Types

);