Skip to content
Discussion options

You must be logged in to vote

The "in operator" is a runtime check.

But it also works with autocompletion. The best way of checking the type would be;

if (result.__typename === 'MyType') {
  // result is MyType here both in runtime and IDE
}

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@belafonte
Comment options

Comment options

You must be logged in to vote
2 replies
@belafonte
Comment options

@ardatan
Comment options

ardatan May 26, 2023
Collaborator

Answer selected by belafonte
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants