-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type definition for DefinitionNode
appears to be wrong
#4012
Comments
A if (definition.kind === Kind.OPERATION_DEFINITION || definition.kind === Kind.FRAGMENT_DEFINITION) {} Doing the above ensures that you are dealing with the query-language and hence have a selection-set. |
Ah, that does solve the initial
There surely must be a way to do this would a bunch of narrowing because the code actually works fine (perhaps because my inputs are uniform?). |
I mean, these are all valid type errors and your code will fail for other permutations of the query-language. 😅 the first one is the distinction between
Where you can see whether the |
Ahh, yes. Sorry, of course 🤦♂️ Thanks for the explanation. |
I've inspected
parse(op).definitions[0].selectionSet
, and it does indeed exist.I see
DefinitionNode
includesExecutableDefinitionNode
→OperationDefinitionNode
, andOperationDefinitionNode
hasselectionSet
, but the definition doesn't seem to follow that deep.The text was updated successfully, but these errors were encountered: