diff --git a/packages/@mantine/core/src/core/factory/create-polymorphic-component.ts b/packages/@mantine/core/src/core/factory/create-polymorphic-component.ts index 5bc066e5775..4a8a7ce5c24 100644 --- a/packages/@mantine/core/src/core/factory/create-polymorphic-component.ts +++ b/packages/@mantine/core/src/core/factory/create-polymorphic-component.ts @@ -3,10 +3,9 @@ type ExtendedProps = OverrideProps & type ElementType = keyof JSX.IntrinsicElements | React.JSXElementConstructor; -type PropsOf = JSX.LibraryManagedAttributes< - C, - React.ComponentPropsWithoutRef ->; +type PropsOf = C extends ElementType + ? JSX.LibraryManagedAttributes> + : never; type ComponentProp = { component?: C; @@ -23,7 +22,10 @@ export type PolymorphicComponentProps = C extends React.ElementTy ref?: PolymorphicRef; renderRoot?: (props: any) => any; } - : Props & { component: React.ElementType; renderRoot?: (props: Record) => any }; + : Props & { + component: React.ElementType; + renderRoot?: (props: Record) => any; + }; export function createPolymorphicComponent< ComponentDefaultType,