-
Notifications
You must be signed in to change notification settings - Fork 182
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
Remove maybe types #276
Remove maybe types #276
Conversation
Codecov Report
@@ Coverage Diff @@
## master #276 +/- ##
=======================================
Coverage 99.49% 99.49%
=======================================
Files 19 19
Lines 595 595
Branches 38 38
=======================================
Hits 592 592
Misses 3 3
Continue to review full report at Codecov.
|
@danielrearden Since we merged #279 can you please sync it up with TS typings. |
src/connection/arrayconnection.js
Outdated
@@ -153,7 +153,7 @@ export function cursorForObjectInConnection<T>( | |||
* otherwise it will be the default. | |||
*/ | |||
export function getOffsetWithDefault( | |||
cursor?: ?ConnectionCursor, | |||
cursor?: ConnectionCursor | null, |
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.
technically it can't be optional since second argument is required
cursor?: ConnectionCursor | null, | |
cursor: ConnectionCursor | null, |
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.
Scratch it, looks like
cursor?: ConnectionCursor | null, | |
cursor: ConnectionCursor | null | undefined, |
is what we want based on real usage scenarios
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.
cursor
comes from resolver args, so ConnectionCursor | void | null
would make sense
src/connection/connectiontypes.js
Outdated
startCursor?: ConnectionCursor | null, | ||
endCursor?: ConnectionCursor | null, | ||
hasPreviousPage?: boolean | null, | ||
hasNextPage?: boolean | null, |
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.
Can you please check if we actually need null
or not?
If it just inputs types than we are totally ok to make it just optional.
If it's also output types please check what's actually returned.
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.
Looks like we only ever use this to type the result of functions like connectionFromArray
. In that context, none of these properties would ever be undefined and only startCursor
and endCursor
would be possible null
.
All credits goes to @danielrearden Closes graphql#276
All credits goes to @danielrearden Closes #276
No description provided.