Ported from https://github.com/reasonml/reason-react/issues/478
I was wondering if something similar to https://github.com/facebook/flow/issues/6611 would be possible with ReasonReact.
In short, would it be possible to type component that accepts only children of a specific type, fragments containing only that specific type, or components that return the same specific type?
For example, a List
component that should only render Item
components:
<List>
<Item />
<ComponentThatRendersASingleItem />
<>
<Item />
<Item />
<>
<ComponentThatRendersSeveralItemsInAFragment />
<List>