/** * Interface for type validation. */ export interface TypeValidator { is(u: unknown): boolean; getType(): string; } /** * Validate a factory or instance. */ export declare class FactoryOrInstance implements TypeValidator { is(factoryOrInstance: unknown): boolean; getType(): string; } /** * Validate a basic type. */ export declare class Type implements TypeValidator { private _typeName; protected typeOf: string; constructor(typeName: string, example: T); is(u: unknown): u is T; getType(): string; } /** * Validate an array of the specified type. * * This does not validate instances of types. All class instances * of classes will simply objects. */ export declare class TypeArray implements TypeValidator { private _typeName; protected typeOf: string; constructor(typeName: string, example: T); is(u: unknown): u is T; getType(): string; } /** * Validate a value is a number and is greater or eval than a minimum. */ export declare class NumberWithMinimum extends Type { readonly min: number; constructor(min: number); is(u: unknown): u is number; } /** * Validate a value is a string and it matches the given expression. */ export declare class StringMatchingRegex extends Type { readonly expression: RegExp; constructor(expression: RegExp); is(u: unknown): u is string; } /** * Validate a value is a function. */ export declare class Function implements TypeValidator { is(u: unknown): u is (...args: any[]) => void; getType(): string; } export declare class NullableBoolean implements TypeValidator { is(u: unknown): boolean; getType(): string; } /** * Validate a value is a date. Values which are numbers are treated as dates and any string * which if compliant with `time.RFC3339Nano` is a date. */ export declare class DateValidator implements TypeValidator { is(u: unknown): boolean; getType(): string; } /** * Validates that a string is a valid kind. */ export declare class KindValidator extends StringMatchingRegex { constructor(); is(u: unknown): u is string; } /** * Validate a value is a string matching one of the allowed values. */ export declare class OneOf implements TypeValidator { private readonly _values; constructor(values: ReadonlyArray); is(u: unknown): u is string; getType(): string; } /** * Returns true if the value is null or undefined. */ export declare function isNullish(value: unknown): value is null | undefined; /** * A set of standard type validators. */ export declare class TypeValidators { static readonly String: Type; static readonly Number: Type; static readonly ObjectOrFactory: FactoryOrInstance; static readonly Object: Type; static readonly StringArray: TypeArray; static readonly Boolean: Type; static readonly Function: Function; static createTypeArray(typeName: string, example: T): TypeArray; static numberWithMin(min: number): NumberWithMinimum; static stringMatchingRegex(expression: RegExp): StringMatchingRegex; static readonly Date: DateValidator; static oneOf(...values: string[]): OneOf; static readonly Kind: KindValidator; static readonly NullableBoolean: NullableBoolean; } //# sourceMappingURL=validators.d.ts.map