@studion/infra-code-blocks
Version:
Studion common infra components
20 lines • 736 B
TypeScript
type UnknownRecord = Record<PropertyKey, unknown>;
/**
* Merges `args` into `defaults`, recursively merging plain-object values.
*
* `undefined` values in `args` are ignored, including inside nested objects.
* Arrays, `null`, and non-plain objects are treated as replacement values and
* are not recursively merged.
*
* @example
* const merged = mergeWithDefaults(
* { timeout: 3000, retry: { count: 3, delay: 500 } },
* { retry: { count: 5 } },
* );
*
* console.log(merged);
* // { timeout: 3000, retry: { count: 5, delay: 500 } }
*/
export declare function mergeWithDefaults<T extends UnknownRecord, U extends UnknownRecord>(defaults: T, args: U): T & U;
export {};
//# sourceMappingURL=merge-with-defaults.d.ts.map