[react] Remove bivariance hack for RefCallback to reject non-nullable instances in callbacks#58936
Conversation
|
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) |
ebd7a85 to
5925081
Compare
69dbd18 to
c056f08
Compare
This issue has been open for quite some time. I would appreciate a fix. #35370 |
f72710d to
10c49da
Compare
10c49da to
74acb1a
Compare
|
@eps1lon Thank you for submitting this PR! This is a live comment which I will keep updated. 2 packages in this PR
Code ReviewsBecause 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
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"
} |
|
🔔 @johnnyreilly @bbenezech @pzavolinsky @ericanderson @DovydasNavickas @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @Hotell @franklixuefei @Jessidhia @saranshkataria @lukyth @zieka @dancerphil @dimitropoulos @disjukr @vhfmag @hellatan @priyanshurav @dsifford @sirreal @dmsnell — please review this PR in the next few days. Be sure to explicitly select |
|
Let's see how this goes |
|
Ready to merge |
Closes #58464
npm test <package to test>.Select one of these and delete the others:
If changing an existing definition:
"React will call the ref callback with the DOM element when the component mounts, and call it with null when it unmounts"
[ ] If this PR brings the type definitions up to date with a new version of the JS library, update the version number in the header.