react-pdf-builder
Version:
Build beautiful PDF documents in React.
26 lines (25 loc) • 1.19 kB
TypeScript
export declare function randomUuid(): string;
export type DeepPartial<T> = {
[K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
};
/**
* Deep merges two records by combining their properties.
*
* The mergeRecords function creates a copy of record1 in a new object called merged
* and iterates over each key in record2. If both values of the corresponding keys
* in record1 and record2 are objects, it recursively calls mergeRecords. If not,
* it assigns the value from record2 to merged. Finally, it returns the merged record.
*
* A third customMerge function arg allows for custom merging of certain values.
*
* @param record1 - The first record to merge.
* @param record2 - The second record to merge.
* @param customMerge - A function allowing custom value merging in certain circumstances.
* @returns The merged record.
*/
export declare function deepMerge<T extends Record<string, any>>(record1: T, record2: T, customMerge?: (key: string, a: any, b: any) => {
success: boolean;
value: any;
}): T;
/** Returns all children as an array, including those inside React fragments. */
export declare const childrenAsArray: (children: any) => any[];