HomePhabricator
Diffusion Comm a59baacae0ad

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

Description

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

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

Reviewers: tomek

Reviewed By: tomek

Differential Revision: https://phab.comm.dev/D10030