domain-objects
Version:
A simple, convenient way to represent domain objects, leverage domain knowledge, and add runtime validation in your code base.
13 lines (12 loc) • 826 B
TypeScript
import { DomainReference } from './DomainReference';
import { DomainObjectShape, Refable } from './DomainReferenceable';
/**
* declares a reference to a domain.entity or domain.event
*
* note
* - if the shape of the unique and primary keys are not resolved, please manually annotate the type
* - e.g., `const ref = getRef<typeof SeaTurtle>(turtle)` instead of `const ref = getRef(turtle)`
* - automatic resolution of the relationship between instance and class.static properties is still a todo
*/
export declare const getReferenceTo: <TDobj extends Refable<TShape, TPrimary, TUnique>, TShape extends DomainObjectShape = any, TPrimary extends readonly string[] = any, TUnique extends readonly string[] = any>(dobj: TShape) => DomainReference<TDobj, TShape, TPrimary, TUnique>;
export { getReferenceTo as getRef, };