JSX Element type

I have a JSX component which should accept multiple children as props, however, using Element | Element[] (or ReactElement imported from hono/jsx) gives the following error when multiple children are passed:
Type 'Element' is not assignable to type 'ReactElement'.
Type 'HtmlEscapedString' is not assignable to type 'ReactElement'.
Type 'String & HtmlEscaped' is missing the following properties from type 'JSXNode': tag, props, children, type, and 2 more.ts(2322)
Type 'Element' is not assignable to type 'ReactElement'.
Type 'HtmlEscapedString' is not assignable to type 'ReactElement'.
Type 'String & HtmlEscaped' is missing the following properties from type 'JSXNode': tag, props, children, type, and 2 more.ts(2322)
Any ideas on how to accept multiple child elements?
3 Replies
JustinNoel
JustinNoel5mo ago
i know it's not the best solution, but I just just ended up typing like this: children?: unknown;
chrisyalamov
chrisyalamovOP5mo ago
Pretty much what I've done for the time being as well :/
jamesfoley
jamesfoley4mo ago
I used ReactNode seems to have worked for me
Want results from more Discord servers?
Add your server