/** * This file is originally from `@radix-ui/react-polymorphic` before the package * was deprecated. The original source for this lived in the URL below. * * @see https://github.com/radix-ui/primitives/blob/17ffcb7aaa42cbd36b3c210ba86d7d73d218e5be/packages/react/polymorphic/src/polymorphic.ts */ import * as React from 'react'; import type { JSX } from 'react'; type Merge = Omit & P2; /** * Infers the OwnProps if E is a ForwardRefExoticComponentWithAs */ type OwnProps = E extends ForwardRefComponent ? P : {}; /** * Infers the JSX.IntrinsicElement if E is a ForwardRefExoticComponentWithAs */ type IntrinsicElement = E extends ForwardRefComponent ? I : never; type ForwardRefExoticComponent = React.ForwardRefExoticComponent : never, OwnProps & { as?: E; }>>; interface ForwardRefComponent extends ForwardRefExoticComponent { /** * When `as` prop is passed, use this overload. * Merges original own props (without DOM props) and the inferred props * from `as` element with the own props taking precedence. * * We explicitly avoid `React.ElementType` and manually narrow the prop types * so that events are typed when using JSX.IntrinsicElements. */ (props: As extends '' ? { as: keyof JSX.IntrinsicElements; } : As extends React.ComponentType ? Merge : As extends keyof JSX.IntrinsicElements ? Merge : never): React.ReactElement | null; } export type { ForwardRefComponent, OwnProps, IntrinsicElement, Merge }; //# sourceMappingURL=polymorphic.d.ts.map