bugzilla
Version:
A NodeJS module to access Bugzilla instances through the REST API.
22 lines (21 loc) • 1.36 kB
TypeScript
import { DateTime } from 'luxon';
export type Validator<T> = (val: any) => T;
export type ObjectSpec<T> = Record<string, Validator<any>> & {
[K in keyof T]: Validator<T[K]>;
};
export declare function object<T>(validator: ObjectSpec<T>, includes?: string[], excludes?: string[]): Validator<T>;
export declare function array<T>(validator: Validator<T>): Validator<T[]>;
export declare function datetime(val: any): DateTime;
export declare const boolean: Validator<boolean>;
export declare const int: Validator<number>;
export declare const double: Validator<number>;
export declare const string: Validator<string>;
export declare function base64(val: any): Buffer;
export declare function nullable<T>(validator: Validator<T>): Validator<T | null>;
export declare function nullable<T>(validator: Validator<T>, result: T): Validator<T>;
export declare function optional<T>(validator: Validator<T>): Validator<T | undefined>;
export declare function optional<T>(validator: Validator<T>, result: T): Validator<T>;
export declare function maybeArray<T>(validator: Validator<T>): Validator<T | T[]>;
export declare function intString(val: any): number;
export declare function map<K, V>(keyValidator: Validator<K>, valueValidator: Validator<V>): Validator<Map<K, V>>;
export declare function either<F, S>(first: Validator<F>, second: Validator<S>): Validator<F | S>;