@kopexa/react-utils
Version:
A set of utilities for react on client side
19 lines (17 loc) • 991 B
text/typescript
/** biome-ignore-all lint/suspicious/noExplicitAny: utility file */
interface DOMElement extends Element, HTMLOrSVGElement {
}
type DataAttributes = {
[dataAttr: string]: any;
};
type DOMAttributes<T = DOMElement> = React.AriaAttributes & React.DOMAttributes<T> & DataAttributes & {
id?: string;
role?: React.AriaRole;
tabIndex?: number;
style?: React.CSSProperties;
};
type Merge<M, N> = N extends Record<string, unknown> ? M : Omit<M, keyof N> & N;
type PropGetter<P = Record<string, unknown>, R = DOMAttributes> = (props?: Merge<DOMAttributes, P>, ref?: React.Ref<any>) => R & React.RefAttributes<any>;
type RemovedProps = "asChild" | "defaultChecked" | "defaultValue" | "color";
type ComponentPropsWithout<T extends React.ElementType, O extends Omit<string, keyof React.ComponentProps<T>> | keyof React.ComponentProps<T>> = Omit<React.ComponentProps<T>, O & string>;
export type { ComponentPropsWithout, DOMAttributes, DOMElement, Merge, PropGetter, RemovedProps };