UNPKG

domain-objects

Version:

A simple, convenient way to represent domain objects, leverage domain knowledge, and add runtime validation in your code base.

11 lines (10 loc) 460 B
import type { DomainObjectShape } from '../../instantiation/DomainObjectShape'; type DeepPartial<T> = { [K in keyof T]?: T[K] extends Array<infer U> ? Array<DeepPartial<U>> : T[K] extends object ? DeepPartial<T[K]> : T[K]; }; /** * .what = deep clones domain objects safely * .why = preserves instance types, methods, and nested structures */ export declare const clone: <T extends DomainObjectShape>(dobj: T, updates?: DeepPartial<T>) => T; export {};