Files
v10/dist/dev/utils/merge-props.d.ts

25 lines
807 B
TypeScript

import { ComponentPropsWithRef, ElementType } from "react";
//#region src/utils/merge-props.d.ts
type Props<T extends ElementType = ElementType> = ComponentPropsWithRef<T>;
/**
* Merge multiple props objects.
*
* - Event handlers (on*): chained - external first, ours second
* - className: concatenated
* - style: merged objects (external wins conflicts)
* - other: last one wins
*
* @public
* @example
* ```ts
* const merged = mergeProps(
* { onClick: ourHandler, className: 'base' },
* { onClick: theirHandler, className: 'custom' }
* );
* // { onClick: chainedHandler, className: 'custom base' }
* ```
*/
declare function mergeProps<T extends ElementType>(...propSets: (Props<T> | undefined)[]): Props<T>;
//#endregion
export { mergeProps };
//# sourceMappingURL=merge-props.d.ts.map