Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Conversation

danielrearden
Copy link
Collaborator

No description provided.

@codecov
Copy link

codecov bot commented Jul 8, 2020

Codecov Report

Merging #276 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #276   +/-   ##
=======================================
  Coverage   99.49%   99.49%           
=======================================
  Files          19       19           
  Lines         595      595           
  Branches       38       38           
=======================================
  Hits          592      592           
  Misses          3        3           
Impacted Files Coverage Δ
src/connection/connection.js 100.00% <ø> (ø)
src/node/node.js 100.00% <ø> (ø)
src/node/plural.js 88.88% <ø> (ø)
src/connection/arrayconnection.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3bd6838...d69f8b9. Read the comment docs.

src/node/node.js Outdated Show resolved Hide resolved
src/node/node.js Outdated Show resolved Hide resolved
@IvanGoncharov
Copy link
Member

@danielrearden Since we merged #279 can you please sync it up with TS typings.

@@ -153,7 +153,7 @@ export function cursorForObjectInConnection<T>(
* otherwise it will be the default.
*/
export function getOffsetWithDefault(
cursor?: ?ConnectionCursor,
cursor?: ConnectionCursor | null,
Copy link
Member

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

Suggested change
cursor?: ConnectionCursor | null,
cursor: ConnectionCursor | null,

Copy link
Member

@IvanGoncharov IvanGoncharov Jul 8, 2020

Choose a reason for hiding this comment

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

Scratch it, looks like

Suggested change
cursor?: ConnectionCursor | null,
cursor: ConnectionCursor | null | undefined,

is what we want based on real usage scenarios

Copy link
Collaborator Author

@danielrearden danielrearden Jul 8, 2020

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/node/plural.js Outdated Show resolved Hide resolved
startCursor?: ConnectionCursor | null,
endCursor?: ConnectionCursor | null,
hasPreviousPage?: boolean | null,
hasNextPage?: boolean | null,
Copy link
Member

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.

Copy link
Collaborator Author

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.

@IvanGoncharov IvanGoncharov added the PR: breaking change 💥 implementation requires increase of "major" version number label Jul 8, 2020
Base automatically changed from master to main February 10, 2021 15:10
IvanGoncharov added a commit to IvanGoncharov/graphql-relay-js that referenced this pull request Mar 8, 2021
All credits goes to @danielrearden
Closes graphql#276
@IvanGoncharov IvanGoncharov mentioned this pull request Mar 8, 2021
IvanGoncharov added a commit that referenced this pull request Mar 8, 2021
All credits goes to @danielrearden
Closes #276
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: breaking change 💥 implementation requires increase of "major" version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants