import * as React from 'react'; // The following is an `as` property implementation // that was copy-pasted from https://www.benmvp.com/blog/polymorphic-react-components-typescript/ // // P.S. `as` property is now deprecated, so this file is a legacy one. // Use `itemsContainerComponent` property instead. // // "A more precise version of `React.ComponentPropsWithoutRef`". // It's not clear what exactly they meant by that. type PropsOf< Component extends keyof React.JSX.IntrinsicElements | React.JSXElementConstructor > = React.JSX.LibraryManagedAttributes> // // Combines props with any additional props. type CombineProps< BaseProps = {}, AdditionalProps = {} > = Omit & AdditionalProps // // Combines component props with any additional props. type CombineComponentPropsWith< Component extends React.ElementType, Props = {} > = CombineProps, Props> // // Adds an `as: AsComponent` property. export type WithAsProperty< AsComponent extends React.ElementType, Props = {} > = CombineComponentPropsWith // // // // This is a type of a `ref` that will be passed to a given `Component`. // export type ComponentRef< // Component extends React.ElementType // > = React.ComponentPropsWithRef['ref'] // // // // Adds an `as: AsComponent` property along with a `ref` property. // export type WithAsPropertyAndRef< // AsComponent extends React.ElementType, // Props = {} // > = WithAsProperty & { // ref?: ComponentRef // }