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