-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
[react-relay] supports fragment spreads #57614
Conversation
@maraisr Thank you for submitting this PR! This is a live comment which I will keep updated. 1 package in this PRCode ReviewsThis PR can be merged once it's reviewed by a DT maintainer. You can test the changes of this PR in the Playground. Status
Once every item on this list is checked, I'll ask you for permission to merge and publish the changes. Diagnostic Information: What the bot saw about this PR{
"type": "info",
"now": "-",
"pr_number": 57614,
"author": "maraisr",
"headCommitOid": "e54035451b66fe615a27cebc5ba0ed11b23687e9",
"lastPushDate": "2021-12-07T23:08:03.000Z",
"lastActivityDate": "2021-12-08T21:26:55.000Z",
"hasMergeConflict": false,
"isFirstContribution": false,
"tooManyFiles": false,
"hugeChange": false,
"popularityLevel": "Well-liked by everyone",
"pkgInfo": [
{
"name": "react-relay",
"kind": "edit",
"files": [
{
"path": "types/react-relay/relay-hooks/helpers.d.ts",
"kind": "definition"
}
],
"owners": [
"alloy",
"maraisr",
"edvinerikson"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Well-liked by everyone"
}
],
"reviews": [],
"mainBotCommentID": 988319094,
"ciResult": "pass"
} |
🔔 @alloy @edvinerikson — please review this PR in the next few days. Be sure to explicitly select |
@maraisr The CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! Note: builds which are failing do not end up on the list of PRs for the DT maintainers to review. |
export type KeyType<TData = unknown> = Readonly< | ||
| { | ||
' $data'?: TData | undefined; | ||
' $fragmentRefs': FragmentReference; | ||
} | ||
| { | ||
' $data'?: TData | undefined; | ||
' $fragmentSpreads': FragmentReference; | ||
}>; |
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.
Not too familiar with this new pusudo property — will this work? As in is it a union, or can it be both?
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.
Confirmed that this does work with Relay 13, not confirmed that it still works with relay 12 though
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.
Doe DefinitelyTyped have a way to have different types per relay-runtime version? We could make this change just for Relay 13+ ?
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.
Nope, the only way is to "fork" by duplicating the folders. Which is more than okay.
But maybe @orta has a few tricks
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.
It can't do this with beta/rcs (or at least I don't have the time to go add support for that, it's usually done for keeping older types around in projects rather than the other way around) - I've got this tested in a relay 12 app, so I think it's good to go.
My apps are pretty trivial so maybe I've missed something but it's trivial to revert if so
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.
That's fair. We've got some tests here that also pass. So I'm personally not offended by merging this.
But whilst we've got relay folk in the thread, at the top of your head. Anything else we should go explore in making types line up to 13?
Inspecting the JavaScript source for this package found some properties that are not in the .d.ts files. ramda (unpkg)was missing the following properties:
react-relay (unpkg)was missing the following properties:
|
Sounds pretty good |
see facebook/relay#3670
original author is @sync