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) • 586 B
TypeScript
import { DomainPrimaryKeys } from './DomainPrimaryKeys';
import { DomainObjectShape, Refable } from './DomainReferenceable';
/**
* a generic which extracts the unique key shape of a domain object
*/
export type DomainPrimaryKeyShape<TDobj extends Refable<TShape, TPrimary, TUnique>, TShape extends DomainObjectShape = any, TPrimary extends readonly string[] = any, TUnique extends readonly string[] = any> = Required<Pick<InstanceType<TDobj>, DomainPrimaryKeys<TDobj>[number]>>;
export { DomainPrimaryKeyShape as DomainReferenceByPrimaryKey, DomainPrimaryKeyShape as RefByPrimary, };