import { clsx, type ClassValue } from 'clsx';
import { twMerge } from 'tailwind-merge';

export function cn(...inputs: ClassValue[]): string {
  return twMerge(clsx(inputs));
}

export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & {
  ref?: U | null;
};

export type WithoutChildren<T> = T extends any
  ? 'children' extends keyof T
    ? Omit<T, 'children'>
    : T
  : T;

export type WithoutChild<T> = T extends any
  ? 'child' extends keyof T
    ? Omit<T, 'child'>
    : T
  : T;