-
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
Use flow %checks to reduce occurance of :any #695
Conversation
src/type/definition.js
Outdated
@@ -134,11 +136,10 @@ export type GraphQLLeafType = | |||
GraphQLScalarType | | |||
GraphQLEnumType; | |||
|
|||
export function isLeafType(type: ?GraphQLType): boolean { | |||
const namedType = getNamedType(type); |
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.
Note: This was ambiguous before. Other isCompositeType / isAbstractType checks below do not include named type unwrapping, and it did not match the type definition above. Only one callsite actually relied on named type unwrapping, so moved this check there.
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.
Pulled out into #697
I'm not super pleased about the eslint and babel workarounds required to get this all to work. I just wanted to get this up to show how it's useful. Perhaps we go after these tools to improve compatibility first? |
} | ||
}, | ||
FragmentDefinition(node) { | ||
const type = context.getType(); | ||
const type = typeFromAST(context.getSchema(), node.typeCondition); |
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.
Moved all the changes in this file to #698
Might wait for babel/babylon#103 before landing this to avoid the flow comments. |
d87eee2
to
8f01ff6
Compare
@leebyron this could be merged now. (btw, no need for comments around %checks) |
This uses a pre-release flow feature to provide predicate functions with more type checking power. It also breaks apart some functions into multiple declare function statements for cases where more specific input types result in more specific output types.
This uses a pre-release flow feature to provide predicate functions with more type checking power. It also breaks apart some functions into multiple declare function statements for cases where more specific input types result in more specific output types.