typescript-cheatsheets / react

Cheatsheets for experienced React developers getting started with TypeScript

Home Page:https://react-typescript-cheatsheet.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] type check JSX children to be a specific component/type

neo opened this issue · comments

So if I want to define children (or any other prop) to take only a specific component (that I make), is it possible?

An example would be if I have a list component and an item component, and list should only accept an array of the item component...

Thank you!!

not possible, sorry. https://twitter.com/ryanflorence/status/1085745787982700544 let me know if you find otherwise

what a sad conclusion... 😭 thank you for pointing out tho!