Replace instanceof checks with their respective predicates#1518
Replace instanceof checks with their respective predicates#1518trevor-scheer merged 3 commits intomasterfrom
Conversation
| true | ||
| ); | ||
| const isOptional = !( | ||
| type instanceof GraphQLNonNull || type instanceof GraphQLNonNull |
There was a problem hiding this comment.
Lol what even was this?
There was a problem hiding this comment.
@shadaj this is way back in history but can you recall if this was intentional or possibly a mistake?
Re: 58f07c4#diff-508d6e2cd0e11941b1548a2ea48a909dR139
There was a problem hiding this comment.
Looks like a mistake! I really hope there's no situation in which double-checking a type is actually needed 😄
There was a problem hiding this comment.
@shadaj Was removing the second check the mistake, or was that correct? Like this was originally
const isOptional = !(type instanceof GraphQLNonNull || type.ofType instanceof GraphQLNonNull);
was the ofType incorrectly removed, or was that fine to remove?
There was a problem hiding this comment.
It was fine to remove the extra check, I believe that ofType was eliminated with changes to the IR format so only the top level type needed to be checked.
This replaces all
instanceof GraphQLXYZchecks with their respective predicate functions.TODO:
*Make sure changelog entries note which project(s) has been affected. See older entries for examples on what this looks like.