diff --git a/packages/jokul/src/utilities/polymorphism/polymorphism.ts b/packages/jokul/src/utilities/polymorphism/polymorphism.ts index 7a863f36d37..9b99eddd0a2 100644 --- a/packages/jokul/src/utilities/polymorphism/polymorphism.ts +++ b/packages/jokul/src/utilities/polymorphism/polymorphism.ts @@ -2,12 +2,6 @@ type ElementTypeProp = { as?: ElementType; }; -type PropsToOmit< - ElementType extends React.ElementType, - Props, -> = keyof (ElementTypeProp & Props); -// type PropsToOmit = keyof (ElementTypeProp & Props); - export type PolymorphicProps< ElementType extends React.ElementType, Props = {}, @@ -19,13 +13,11 @@ export type PolymorphicProps< export type PolymorphicRef = React.ComponentPropsWithRef["ref"]; -// old utility with ref -export type PolymorphicPropsWithRef = PolymorphicProps< - ElementType, +export type PolymorphicComponentPropWithRef = PolymorphicComponentProp< + As, Props -> & { ref?: PolymorphicRef }; +> & { ref?: PolymorphicRef }; -// This is a new type utitlity with ref // Implementation of reusable polymorphic types // Explaination: https://blog.logrocket.com/build-strongly-typed-polymorphic-components-react-typescript/ type AsProp = { as?: As }; @@ -35,11 +27,6 @@ type PolymorphicComponentProp = Re > & Omit, PropsToOmit>; -export type PolymorphicComponentPropWithRef = PolymorphicComponentProp< - As, - Props -> & { ref?: PolymorphicRef }; - // Les https://stackoverflow.com/q/57683303 export type Expand = T extends (...args: infer A) => infer R ? (...args: Expand) => Expand