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

[react-relay] supports fragment spreads #57614

Merged
merged 2 commits into from
Dec 8, 2021
Merged

[react-relay] supports fragment spreads #57614

merged 2 commits into from
Dec 8, 2021

Conversation

maraisr
Copy link
Contributor

@maraisr maraisr commented Dec 7, 2021

see facebook/relay#3670

original author is @sync

@typescript-bot
Copy link
Contributor

typescript-bot commented Dec 7, 2021

@maraisr Thank you for submitting this PR!

This is a live comment which I will keep updated.

1 package in this PR

Code Reviews

This PR can be merged once it's reviewed by a DT maintainer.

You can test the changes of this PR in the Playground.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • 🕐 Only a DT maintainer can approve changes without tests

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"
}

@typescript-bot typescript-bot added Author is Owner The author of this PR is a listed owner of the package. Untested Change This PR does not touch tests labels Dec 7, 2021
@typescript-bot
Copy link
Contributor

🔔 @alloy @edvinerikson — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@typescript-bot typescript-bot added the The CI failed When GH Actions fails label Dec 7, 2021
@typescript-bot
Copy link
Contributor

@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.

@typescript-bot typescript-bot removed the The CI failed When GH Actions fails label Dec 7, 2021
Comment on lines +8 to +16
export type KeyType<TData = unknown> = Readonly<
| {
' $data'?: TData | undefined;
' $fragmentRefs': FragmentReference;
}
| {
' $data'?: TData | undefined;
' $fragmentSpreads': FragmentReference;
}>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sibelius @AndrewIngram

Not too familiar with this new pusudo property — will this work? As in is it a union, or can it be both?

Copy link
Collaborator

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

Copy link

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+ ?

Copy link
Contributor Author

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

Copy link
Collaborator

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

Copy link
Contributor Author

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?

@DangerBotOSS
Copy link

Inspecting the JavaScript source for this package found some properties that are not in the .d.ts files.
The check for missing properties isn't always right, so take this list as advice, not a requirement.

ramda (unpkg)

was missing the following properties:

  1. sequence

react-relay (unpkg)

was missing the following properties:

  1. MutationTypes
  2. RangeOperations

Generated by 🚫 dangerJS against e540354

@orta orta merged commit c92b93d into DefinitelyTyped:master Dec 8, 2021
@maraisr
Copy link
Contributor Author

maraisr commented Dec 9, 2021

@orta turns out we had more changes to make 🤔

see #57638

After that; I am also busy going through all the types and doing a v13 sync — will perform a version bump there for the types. And draw a line in the sand here for v12?

@orta
Copy link
Collaborator

orta commented Dec 9, 2021

Sounds pretty good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author is Owner The author of this PR is a listed owner of the package. Untested Change This PR does not touch tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants