-
Notifications
You must be signed in to change notification settings - Fork 2.1k
GraphQLObjectTypeConfig<TSource>
to GraphQLFieldResolveFn<TSource, TResult>
#425
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -478,12 +478,12 @@ export type GraphQLIsTypeOfFn = ( | |
info: GraphQLResolveInfo | ||
) => boolean | ||
|
||
export type GraphQLFieldResolveFn<TSource> = ( | ||
export type GraphQLFieldResolveFn<TSource, TResult> = ( | ||
source: TSource, | ||
args: {[argName: string]: mixed}, | ||
context: mixed, | ||
info: GraphQLResolveInfo | ||
) => mixed | ||
) => TResult | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm curious if this actually aids in Flow's type checking? What issue would Flow not catch that it does catch after this change? I'd love to see an example so I can understand better. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Im not sure what the sentence If it means What will be happened if
Ideally the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
|
||
export type GraphQLResolveInfo = { | ||
fieldName: string; | ||
|
@@ -501,7 +501,7 @@ export type GraphQLResolveInfo = { | |
export type GraphQLFieldConfig<TSource> = { | ||
type: GraphQLOutputType; | ||
args?: GraphQLFieldConfigArgumentMap; | ||
resolve?: GraphQLFieldResolveFn<TSource>; | ||
resolve?: GraphQLFieldResolveFn<TSource, *>; | ||
deprecationReason?: ?string; | ||
description?: ?string; | ||
} | ||
|
@@ -525,7 +525,7 @@ export type GraphQLFieldDefinition = { | |
description: ?string; | ||
type: GraphQLOutputType; | ||
args: Array<GraphQLArgument>; | ||
resolve?: GraphQLFieldResolveFn<*>; | ||
resolve?: GraphQLFieldResolveFn<*, *>; | ||
deprecationReason?: ?string; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these resolve function type hints necessary? I would expect that Flow would not require them since you already typed
getFriends
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it is necessary, the input and output datatype should be a part of schema's design. A explicit declare give the resolver a constraint.(Makes it clear to other people, what data should be in and what data should be out).Will explain this below.