I'm writing a quick wrapper interface. I'm looking for some mystery types:
Let Foo be some React component that accepts props of type FooProps.
Let X be the interface that represents both any generic React component or any HTML element. Where Foo extends X but also div extends X. X is anything that can be turned into a JSX.Element by <X></X>
Let Y<T extends X> be the props of our T, which is again any element such as Foo or div. Where Y<Foo> = FooProps, and Y<div> = { className: string, ... }
We could write:
interface WrapperProps<T extends X>{
children?: React.ReactNode;
attributes?: Y<T>;
}
Then we could write:
const props: WrapperProps<T> = ...;
const el: JSX.Element = (
<T {...attributes}>
{ children }
</T>
);
What are these mystery types X and Y?