absent
absent
SSolidJS
Created by absent on 10/25/2024 in #support
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>
<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.
3 replies