Reputation: 9034
How would I set a type annotation of JSX?
I want to check if props received are type of JSX and not any other type.
This is what my interface looks like:
interface ITextEditorProps{
value: any
}
// Component
<TextEditor value={<div><h1>Hello World</h1></div>} />
Upvotes: 4
Views: 758
Reputation: 37594
There is a type JSX.Element
for a broader approach or directly with React.ReactElement<type>
interface ITextEditorProps {
value: JSX.Element // React.ReactElement<type> also possible
}
Upvotes: 4