import { ComponentProps, ElementType, ReactElement } from "react"; /** * @see https://www.benmvp.com/blog/polymorphic-react-components-typescript/ */ export type AsProps = { as?: E; }; export type MergeProps = AsProps & Omit, keyof AsProps>; export type PolymorphicComponentProps = P & MergeProps; export type PolymorphicComponent = (props: PolymorphicComponentProps) => ReactElement | null;