import type { ComponentType } from "react"; // eslint-disable-next-line @typescript-eslint/no-explicit-any type AnyComponent = ComponentType; export function copyComponentProperties( BaseComponent: T, Component: AnyComponent, ) { for (const [key, value] of Object.entries(BaseComponent)) { if (key === "$$typeof" || key === "render" || key === "contextType") { continue; } (Component as unknown as Record)[key] = value; } Component.displayName = BaseComponent.displayName; return Component as unknown as T; }