@valuer/main
Version:
Valuer is an advanced declarative value validator
14 lines (13 loc) • 1.19 kB
TypeScript
import { Thunk } from "@valuer/types";
import { DescriptorBase, DescriptorName } from "./descriptors";
export declare type Validator = keyof DescriptorBase;
export declare type ValidatorWithoutDefaultValidation = Validator & ("value" | "equals" | "set" | "typeOf" | "instanceOf" | "length" | "composite");
export declare type ValidatorWithDefaultValidation = Exclude<Validator, ValidatorWithoutDefaultValidation>;
export declare type ValidatorString = Validator & ("typeOf" | "number" | "spectrum" | "kind");
export declare type ValidatorStringCustom = Exclude<ValidatorString, "typeOf">;
export declare type ValidatorNonString = Exclude<Validator, ValidatorString>;
export declare type ValidatorFailure = string;
export declare type Validation<Value = any, V extends Validator = Validator> = DescriptorBase<Value>[V];
export declare type ValidationString<V extends ValidatorString = ValidatorString> = DescriptorBase[V];
export declare type ValidationNonString<V extends ValidatorNonString = ValidatorNonString> = DescriptorBase[V];
export declare type ValidationSole<Value = any> = DescriptorName | Thunk<Value> | ValidationString | Validation<Value, "pattern" | "set">;