decoval
Version:
DecoVal is a decorator-driven validation pattern that allows you to add validation rules directly to the properties of TypeScript classes, simplifying data control and increasing code readability and reusability.
20 lines (19 loc) • 389 B
TypeScript
export type ValArrayOptions = {
minLength?: {
value: number;
message: string;
};
maxLength?: {
value: number;
message: string;
};
elementsType?: {
value: "any" | "string" | "number" | "boolean";
message: string;
};
allowedValues?: {
value: any[];
message?: string;
};
message?: string;
};