@cashfarm/plow
Version:
Library for validating input data and parameters
23 lines (22 loc) • 691 B
TypeScript
/**
* Base class for ValueObject's
*
* A value object is an object whose identitiy is
* determined by it's properties values.
*
* Value objects MUST:
* - Be immutable
* - Be compared by value-equality
* @export
* @class ValueObject
*/
export declare class ValueObject<TObject> {
private construct;
/**
* @param construct Your value object's constructor
* @param constructParams Name of the properties to pass to constructor IN ORDER
*/
constructor(construct: new (...args: any[]) => TObject, constructParams: (keyof TObject)[]);
equals(other: ValueObject<TObject>): boolean;
protected newInstanceWith(updatedProps: Partial<TObject>): TObject;
}