SolidJSS
SolidJSโ€ข15mo agoโ€ข
2 replies
absent

Restricting children to specific component types

I'm wondering if it's possible to define a pair of components, e.g. SpecialTable and SpecialRow, such that the former type only accepts children of the latter type:
<SpecialTable>
  <SpecialRow/>
  <SpecialRow/>
  ...
</SpecialTable>

I assumed that the C in FlowProps<P extends Record<string, any> = {}, C = JSX.Element> was meant for this, but failed attempts and some research seem to indicate otherwise. If the answer is "not possible, and we don't think it should be possible," I'm interested in learning why.
Was this page helpful?