declare type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; declare type InstanceOf = T extends { new (...args: any[]): infer U; } ? U : never; /** Validator for type T. */ export declare type Validator = (x: unknown) => x is T; /** Type for which a validator matches. */ export declare type TypeOf = T extends Validator ? U : never; /** Returns true if and only if x is a boolean. */ export declare const boolean: (x: unknown) => x is boolean; /** Returns true if and only if x is a string. */ export declare const string: (x: unknown) => x is string; /** Returns true if and only if x is a number. */ export declare const number: (x: unknown) => x is number; /** Returns true if and only if x is undefined. */ export declare const empty: (x: unknown) => x is undefined; /** Returns true if and only if x is null. */ export declare const nil: (x: unknown) => x is null; /** Returns true if and only if x is strictly equal to y. */ export declare const literal: (y: T) => (x: unknown) => x is T; /** Returns true if and only if x is an object where each value matches the given validator. */ export declare const object: >(validator: T) => (x: unknown) => x is { [key: string]: TypeOf; }; /** Returns true if and only if x is an array where each element matches the given validator. */ export declare const array: >(validator: T) => (x: unknown) => x is TypeOf[]; /** Returns true if and only if x is an instance of the given type. */ export declare const instance: (base: T) => (x: unknown) => x is InstanceOf; /** Returns true if and only if x is an object where each value matches the validator at the corresponding key in the schema. */ export declare const record: ; }>(schema: T) => (x: unknown) => x is { [K in keyof T]: TypeOf; }; /** Returns true if and only if x is an array where each element matches the validator at the corresponding index in the schema. */ export declare const tuple: []>(...schema: T) => (x: unknown) => x is { [K in keyof T]: TypeOf; }; /** Returns true if and only if x matches any of the given validators. */ export declare const any: []>(...validators: T) => (x: unknown) => x is TypeOf; /** Returns true if and only if x matches all of the given validators. */ export declare const all: []>(...validators: T) => (x: unknown) => x is UnionToIntersection>; /** Returns true if and only if x matches the given validator or is undefined. */ export declare const optional: (validator: Validator) => (x: unknown) => x is T | undefined; /** Returns true if and only if x matches the given validator or is null. */ export declare const nullable: (validator: Validator) => (x: unknown) => x is T | null; declare type Path = Array; /** Takes a validator and an object to be validated. Returns null if the object is valid, or the path to the invalid property. */ export declare function report(validate: (x: any) => boolean, object: any): Path | null; export {}; //# sourceMappingURL=index.d.ts.map