import { ElementType, ComponentProps } from 'react';

type OverridableStringUnion<T extends string | number, U = Record<string, unknown>> = GenerateStringUnion<Overwrite<Record<T, true>, U>>;
type Overwrite<T, U> = DistributiveOmit<T, keyof U> & U;
type GenerateStringUnion<T> = Extract<{
    [Key in keyof T]: true extends T[Key] ? Key : never;
}[keyof T], string>;
type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
type CamelizeString<T extends PropertyKey, C extends string = ""> = T extends string ? string extends T ? string : T extends `${infer F}-${infer R}` ? CamelizeString<Capitalize<R>, `${C}${F}`> : `${C}${T}` : T;
type PropsWithoutRef<P> = P extends any ? "ref" extends keyof P ? Pick<P, Exclude<keyof P, "ref">> : P : P;
type ComponentPropsWithoutRef<T extends ElementType> = PropsWithoutRef<ComponentProps<T>>;

export { CamelizeString as C, OverridableStringUnion as O, ComponentPropsWithoutRef as a };
