From 35a3a1eab2cf4a533b0d87b77e1244cf54040e4e Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Mon, 10 Feb 2020 13:13:19 -0500 Subject: [PATCH] Fix lint errors --- .../graph-ql-explorer-type.js | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) 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

    - {Object.keys(types).map(key => { - return ( -
  • - -
  • - ); - })} + {types.map(type => ( +
  • + +
  • + ))}
);