Page MenuHomePhabricator

[Flow202][native][skip-ci] [46/x] Type itemToDummy using React.MixedElement
ClosedPublic

Authored by ashoat on Nov 27 2023, 1:24 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 5 2024, 7:19 AM
Unknown Object (File)
Mar 5 2024, 7:19 AM
Unknown Object (File)
Mar 5 2024, 7:19 AM
Unknown Object (File)
Mar 5 2024, 7:19 AM
Unknown Object (File)
Dec 19 2023, 10:18 AM
Unknown Object (File)
Dec 17 2023, 2:49 PM
Unknown Object (File)
Dec 16 2023, 4:06 PM
Unknown Object (File)
Dec 11 2023, 5:30 PM
Subscribers
None

Details

Summary

The new Flow was printing this error:

Error ------------------------------------------------------------------- components/node-height-measurer.react.js:37:39

Cannot instantiate React.Element because mixed [1] is not a React component. [not-a-component]

     34|   +itemToMeasureKey: Item => ?string,
     35|   // The "dummy" is the component whose height we will be measuring
     36|   // We will only call this with items for which itemToMeasureKey returns truthy
 [1] 37|   +itemToDummy: Item => React.Element<mixed>,
     38|   // Once we have the height, we need to merge it into the item
     39|   +mergeItemWithHeight: (item: Item, height: ?number) => MergedItem,
     40|   // We'll pass our results here when we're done

I opened up the Flow definition of React.Element to investigate, and found a convenient type for this use case: React.MixedElement.

NOTE: CI will fail on this diff. I considered the possibility of fixing Flow errors BEFORE upgrading Flow, but it wasn't possible... in some cases, the fixes to support the new version of Flow caused errors in the old version. I could have hidden these type errors with $FlowFixMe lines and then later revert those, but that seemed like too much busy work.

Depends on D10029

Test Plan

Confirm the Flow errors go away

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable