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)
Sun, Dec 22, 7:05 AM
Unknown Object (File)
Sun, Dec 22, 7:05 AM
Unknown Object (File)
Sun, Dec 22, 7:05 AM
Unknown Object (File)
Sun, Dec 22, 7:05 AM
Unknown Object (File)
Wed, Dec 18, 12:24 PM
Unknown Object (File)
Sun, Dec 15, 4:27 AM
Unknown Object (File)
Sat, Dec 14, 11:48 PM
Unknown Object (File)
Sat, Dec 14, 5:09 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