UNPKG

react-tiniest-form

Version:
17 lines (16 loc) 921 B
import { ComponentPropsWithoutRef, ElementType, PropsWithChildren } from 'react'; type PropsWithTag<T extends ElementType, P> = P & { as?: T; }; type ComponentPropsWithoutRefAndDuplicate<T extends ElementType, P = {}> = Omit<ComponentPropsWithoutRef<T>, keyof P>; type PropsWithComponentPropsWithoutRef<T extends ElementType, P = {}> = PropsWithChildren<PropsWithTag<T, P>> & ComponentPropsWithoutRefAndDuplicate<T, P>; type PolymorphicProps<T extends ElementType, P = {}> = PropsWithTag<T, PropsWithComponentPropsWithoutRef<T, P>>; declare const getPolymorphicProps: <T extends ElementType, P>(defaultElement: ElementType, props: PolymorphicProps<T, P>) => { Element: ElementType; } & P & { as?: T | undefined; } & { children?: import("react").ReactNode; } & ComponentPropsWithoutRefAndDuplicate<T, P>; export { getPolymorphicProps }; export type { PolymorphicProps, PropsWithComponentPropsWithoutRef };