type lookup in hint fails
See original GitHub issueHi,
we’re using the codemirror-graphql
in the GraphQL Playground and experience problems, that the type
property of a suggestion is undefined.
It happens in this line of code:
https://github.com/graphql/codemirror-graphql/blob/master/src/hint.js#L66
The problem is, that item.detail
can contain !
in the case of a non-nullable type.
item.detail
comes from here https://github.com/graphql/graphql-language-service/blob/master/packages/interface/src/getAutocompleteSuggestions.js#L97
schema.getType()
however is just returning getTypeMap()[name]
- as there is no type with the name User!
, undefined
is returned.
https://github.com/graphql/graphql-js/blob/master/src/type/schema.js#L182
Now is the question what the solution for this could be.
The quick-fix, that would work for us, is just not calling .getType()
in hint
anymore.
But I guess that the type lookup has been added for a reason.
@asiandrummer would be awesome to hear your take on that.
Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:15 (10 by maintainers)
Top GitHub Comments
unfortunately, i don’t know either. it’s a pain to disable Check JS every time, though 😦
also, thank you @yoshiakis so very much for your stewardship of
codemirror-graphql
!