UNPKG

domain-objects

Version:

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

14 lines (13 loc) 880 B
import { DomainObject } from '../instantiation/DomainObject'; export declare class DomainObjectNotSafeToManipulateError extends Error { constructor({ unsafeKeys, className, }: { unsafeKeys: string[]; className: string; }); } /** * For internal use only. DomainObjects must have all nested domain objects defined in their `DomainObject.nested` definition. Otherwise, we could be dealing with a domain object that is not instantiated, and thus we will not appropriately serialize it. * * Therefore, if any DomainObject has nested objects that are not instantiated as DomainObjects, there is a risk that the nested object is really a nested, uninstantiated DomainObject - which would cause bugs if uncaught. */ export declare const assertDomainObjectIsSafeToManipulate: <T extends Record<string, any>>(obj: DomainObject<T> & Record<string, any>) => void;