export interface IEntity { readonly id: Id; } export abstract class Entity implements IEntity { protected constructor(readonly id: Id) {} equals(other?: Entity): boolean { return !!other && this.id === other.id; } }