const Component: FC<ComponentProps> = ({ text }) => <></>;
const ComponentWrapper: FC<Type> = ({ component, ...rest }) => <Component {...rest} />
<ComponentWrapper component={Component} text="yes" /> // <---- надо,чтоб тут ТС унаследовал пропсы от Component
type ComponentWrapper<T = {}> = {
component: ComponentType<T>;
} & T;
interface IWrapper<T> {
component: T;
}
const Wrapper = <T extends React.ComponentType<any>>({
component: Component,
...props
}: React.PropsWithChildren<IWrapper<T> & React.ComponentProps<T>>) => <Component {...props} />;