Skip to content

Correct types for 'path' & 'parentType' of GraphQLResolveInfo#1033

Merged
leebyron merged 3 commits intographql:masterfrom
IvanGoncharov:correctTypes
Dec 1, 2017
Merged

Correct types for 'path' & 'parentType' of GraphQLResolveInfo#1033
leebyron merged 3 commits intographql:masterfrom
IvanGoncharov:correctTypes

Conversation

@IvanGoncharov
Copy link
Copy Markdown
Member

In this PR I corrected types for path and parentType fields of GraphQLResolveInfo.
Without this info, I forced to add additional checks to my resolvers:

if (info.parentType instanceof GraphQLObjectType) {
  // ...
}
if (info.path) {
 // ...
}

Both checks always true and this is obvious from code of buildResolveInfo function.
But I forced to add above checks in all my resolvers 😞

@wincent This PR affects only typings and doesn't change any runtime behaviour. Can you please review it?

@IvanGoncharov
Copy link
Copy Markdown
Member Author

I rebased this PR.

@leebyron
Copy link
Copy Markdown
Contributor

leebyron commented Dec 1, 2017

Thanks for rebasing, I'm taking a look now

Comment thread src/type/definition.js
fieldNodes: Array<FieldNode>;
returnType: GraphQLOutputType;
parentType: GraphQLCompositeType;
parentType: GraphQLObjectType;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch fixing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants