UNPKG

@jengaui/utils

Version:

Jenga UI Utils component in React

19 lines (16 loc) 769 B
import { Props } from 'tastycss'; declare type TupleTypes<T> = { [P in keyof T]: T[P]; } extends { [key: number]: infer V; } ? V : never; declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; /** * Merges multiple props objects together. Event handlers are chained, * classNames are combined, and ids are deduplicated - different ids * will trigger a side-effect and re-render components hooked up with `useId`. * For all other props, the last prop object overrides all previous ones. * @param args - Multiple sets of props to merge together. */ declare function mergeProps<T extends (Props | undefined)[], K = UnionToIntersection<TupleTypes<T>>>(...args: T): K; export { mergeProps };