Skip to content

[react] Remove bivariance hack for RefCallback to reject non-nullable instances in callbacks#58936

Merged
typescript-bot merged 2 commits intoDefinitelyTyped:masterfrom
eps1lon:fix/react/ref-bivariance
Mar 19, 2022
Merged

[react] Remove bivariance hack for RefCallback to reject non-nullable instances in callbacks#58936
typescript-bot merged 2 commits intoDefinitelyTyped:masterfrom
eps1lon:fix/react/ref-bivariance

Conversation

@eps1lon
Copy link
Copy Markdown
Collaborator

@eps1lon eps1lon commented Feb 23, 2022

Closes #58464

Select one of these and delete the others:

If changing an existing definition:

@ferdaber
Copy link
Copy Markdown
Contributor

I agree with this change, though ref objects need to be bivariant, ref callbacks don't need to be and should reflect exactly how React calls it.

@eps1lon
Copy link
Copy Markdown
Collaborator Author

eps1lon commented Feb 24, 2022

I agree with this change, though ref objects need to be bivariant, ref callbacks don't need to be and should reflect exactly how React calls it.

Alright, thanks.

Will split out the fixes into separate PRs since they should be landed regardless (in case we need to reintroduce the bivariance hack)

@eps1lon eps1lon force-pushed the fix/react/ref-bivariance branch from ebd7a85 to 5925081 Compare February 24, 2022 18:05
This was referenced Feb 24, 2022
@eps1lon eps1lon force-pushed the fix/react/ref-bivariance branch 2 times, most recently from 69dbd18 to c056f08 Compare March 1, 2022 15:07
@rawatrupesh
Copy link
Copy Markdown

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.

react-grid-layout (unpkg)

was missing the following properties:

  1. utils

Generated by 🚫 dangerJS against c056f08

This issue has been open for quite some time. I would appreciate a fix. #35370

@eps1lon eps1lon force-pushed the fix/react/ref-bivariance branch 2 times, most recently from f72710d to 10c49da Compare March 16, 2022 13:32
@eps1lon eps1lon force-pushed the fix/react/ref-bivariance branch from 10c49da to 74acb1a Compare March 16, 2022 19:55
@eps1lon eps1lon changed the title [RFC][react] Remove bivariance hack for RefCallback to reject non-nullable nstances in callbacks [react] Remove bivariance hack for RefCallback to reject non-nullable nstances in callbacks Mar 16, 2022
@eps1lon eps1lon marked this pull request as ready for review March 16, 2022 20:42
@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Mar 16, 2022

@eps1lon Thank you for submitting this PR!

This is a live comment which I will keep updated.

2 packages in this PR

Code Reviews

Because this is a widely-used package, a DT maintainer will need to review it before it can be merged.

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

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ✅ A DT maintainer needs to approve changes which affect more than one package

All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 58936,
  "author": "eps1lon",
  "headCommitOid": "74acb1a0a0a403255a021da3dd737af38a4aa1ab",
  "mergeBaseOid": "277df65eb7d3bad751f87fdc1dcfb9e7205bd46a",
  "lastPushDate": "2022-03-16T19:55:09.000Z",
  "lastActivityDate": "2022-03-19T07:08:07.000Z",
  "mergeOfferDate": "2022-03-18T19:50:25.000Z",
  "mergeRequestDate": "2022-03-19T07:08:07.000Z",
  "mergeRequestUser": "eps1lon",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "react",
      "kind": "edit",
      "files": [
        {
          "path": "types/react/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/react/test/tsx.tsx",
          "kind": "test"
        }
      ],
      "owners": [
        "johnnyreilly",
        "bbenezech",
        "pzavolinsky",
        "ericanderson",
        "DovydasNavickas",
        "theruther4d",
        "guilhermehubner",
        "ferdaber",
        "jrakotoharisoa",
        "pascaloliv",
        "hotell",
        "franklixuefei",
        "Jessidhia",
        "saranshkataria",
        "lukyth",
        "eps1lon",
        "zieka",
        "dancerphil",
        "dimitropoulos",
        "disjukr",
        "vhfmag",
        "hellatan",
        "priyanshurav"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    },
    {
      "name": "wordpress__block-editor",
      "kind": "edit",
      "files": [
        {
          "path": "types/wordpress__block-editor/wordpress__block-editor-tests.tsx",
          "kind": "test"
        }
      ],
      "owners": [
        "dsifford",
        "sirreal",
        "dmsnell"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Well-liked by everyone"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "gabritto",
      "date": "2022-03-18T19:49:46.000Z",
      "isMaintainer": true
    },
    {
      "type": "approved",
      "reviewer": "dmsnell",
      "date": "2022-03-16T21:01:56.000Z",
      "isMaintainer": false
    }
  ],
  "mainBotCommentID": 1069612969,
  "ciResult": "pass"
}

@typescript-bot
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor

@dmsnell dmsnell left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@typescript-bot typescript-bot added Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner labels Mar 18, 2022
@typescript-bot
Copy link
Copy Markdown
Contributor

@eps1lon: Everything looks good here. I am ready to merge this PR (at 74acb1a) on your behalf whenever you think it's ready.

If you'd like that to happen, please post a comment saying:

Ready to merge

and I'll merge this PR almost instantly. Thanks for helping out! ❤️

@eps1lon eps1lon changed the title [react] Remove bivariance hack for RefCallback to reject non-nullable nstances in callbacks [react] Remove bivariance hack for RefCallback to reject non-nullable instances in callbacks Mar 19, 2022
@eps1lon
Copy link
Copy Markdown
Collaborator Author

eps1lon commented Mar 19, 2022

Let's see how this goes

@eps1lon
Copy link
Copy Markdown
Collaborator Author

eps1lon commented Mar 19, 2022

Ready to merge

@typescript-bot typescript-bot merged commit 936df58 into DefinitelyTyped:master Mar 19, 2022
@eps1lon eps1lon deleted the fix/react/ref-bivariance branch March 19, 2022 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Critical package Edits multiple packages Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants