dino-core
Version:
A dependency injection framework for NodeJS applications
31 lines (30 loc) • 1.01 kB
TypeScript
import { type Archetype } from './Archetype';
/**
* Represent an identifier for an entity
*/
export declare class Id<T = string> {
private readonly value;
protected constructor(value: T);
/**
* Compare two id for equality
* > if other object is not defined return false
* > if this object and other object are not of the same type then return false
* > if any of this object properties is not same as the same property on other object then return false
* > otherwise return true
* @param other the other archetype to compare
* @returns true if the two Ids are same, false otherwise
*/
equals<T extends Archetype>(other: T): boolean;
/**
* Allows to access this identifier internal value
* @returns the identifier internal value
*/
get(): T;
/**
* Create a new identifier
* @param value the Id internal value
* @returns a new Id instance
*/
static create<T>(value: T): Id<T>;
toString(): string;
}