type AsProp = { as?: T; }; type PropsToOmit = keyof (AsProp & P); type PolymorphicComponentProp< T extends React.ElementType, Props = {}, > = React.PropsWithChildren> & Omit, PropsToOmit>; export type PolymorphicRef = React.ComponentPropsWithRef['ref']; type PolymorphicComponentPropWithRef< T extends React.ElementType, Props = {}, > = PolymorphicComponentProp & { ref?: PolymorphicRef }; export type PolymorphicComponentPropsWithRef< T extends React.ElementType, P = {}, > = PolymorphicComponentPropWithRef; export type PolymorphicComponentProps< T extends React.ElementType, P = {}, > = PolymorphicComponentProp; export type PolymorphicComponent

= { ( props: PolymorphicComponentPropsWithRef, ): React.ReactNode; };