domain-objects
Version:
A simple, convenient way to represent domain objects, leverage domain knowledge, and add runtime validation in your code base.
8 lines (7 loc) • 659 B
TypeScript
import { DomainReference } from './DomainReference';
import { DomainObjectShape, Refable } from './DomainReferenceable';
import { DomainUniqueKeyShape } from './DomainUniqueKeyShape';
export declare const isUniqueKeyRef: <TDobj extends Refable<TShape, TPrimary, TUnique>, TShape extends DomainObjectShape = any, TPrimary extends readonly string[] = any, TUnique extends readonly string[] = any>({ of, }: {
of: TDobj;
}) => (ref: DomainReference<Refable<TShape, any, any>, // refable<TShape, any, any> to ensure even unclassed .getReferenceTo usage can use this
TShape, TPrimary, TUnique>) => ref is DomainUniqueKeyShape<TDobj, TShape, TPrimary, TUnique>;