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)
Fri, Nov 8, 3:53 AM
Unknown Object (File)
Fri, Nov 8, 2:29 AM
Unknown Object (File)
Wed, Nov 6, 6:41 AM
Unknown Object (File)
Oct 17 2024, 11:50 AM
Unknown Object (File)
Oct 17 2024, 11:50 AM
Unknown Object (File)
Oct 17 2024, 11:49 AM
Unknown Object (File)
Oct 17 2024, 11:49 AM
Unknown Object (File)
Oct 16 2024, 5:51 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