domain-objects
Version:
A simple, convenient way to represent domain objects, leverage domain knowledge, and add runtime validation in your code base.
10 lines (9 loc) • 492 B
TypeScript
import { DomainEntity } from '../instantiation/DomainEntity';
import { DomainEvent } from '../instantiation/DomainEvent';
export type DomainObjectShape = Record<string, any>;
export interface DomainReferenceable<TShape extends DomainObjectShape, TPrimary extends readonly string[], TUnique extends readonly string[]> extends DomainEntity<TShape>, DomainEvent<TShape> {
new (props: TShape): TShape;
primary: TPrimary;
unique: TUnique;
}
export { DomainReferenceable as Refable, };