I am trying to figure something out, that just won't work. I have a component that accepts a type headline. The component needs to accept a string, or a specific component, but nothing else:
export interface Props {
headline: string | Component
}
I have tried a combination of React.ElementType<typeof Component>, typeof Component, ComponentType<typeof Component>, none of it works, because it either just allows everything, or it allows nothing but the string at all. I have tried to pass the component as a function too, with headline={() => <Component />}, which eliminates all type errors but this won't render the passed component any longer.
This feels basic to me and I am not sure what the proper way to go about this would be. What is the right typing for this use case?