import { Infer, Struct } from '../struct.js'; import { ObjectSchema, ObjectType, AnyStruct, InferStructTuple, UnionToIntersection } from '../utils.js'; /** * Ensure that any value passes validation. */ export declare function any(): Struct; /** * Ensure that a value is an array and that its elements are of a specific type. * * Note: If you omit the element struct, the arrays elements will not be * iterated at all. This can be helpful for cases where performance is critical, * and it is preferred to using `array(any())`. */ export declare function array>(Element: T): Struct[], T>; export declare function array(): Struct; /** * Ensure that a value is a bigint. */ export declare function bigint(): Struct; /** * Ensure that a value is a boolean. */ export declare function boolean(): Struct; /** * Ensure that a value is a valid `Date`. * * Note: this also ensures that the value is *not* an invalid `Date` object, * which can occur when parsing a date fails but still returns a `Date`. */ export declare function date(): Struct; /** * Ensure that a value is one of a set of potential values. * * Note: after creating the struct, you can access the definition of the * potential values as `struct.schema`. */ export declare function enums(values: T): Struct; export declare function enums(values: T): Struct; /** * Ensure that a value is a function. */ export declare function func(): Struct; /** * Ensure that a value is an instance of a specific class. */ export declare function instance(Class: T): Struct, null>; /** * Ensure that a value is an integer. */ export declare function integer(): Struct; /** * Ensure that a value matches all of a set of types. */ export declare function intersection(Structs: [A, ...B]): Struct & UnionToIntersection[number]>, null>; /** * Ensure that a value is an exact value, using `===` for comparison. */ export declare function literal(constant: T): Struct; export declare function literal(constant: T): Struct; export declare function literal(constant: T): Struct; export declare function literal(constant: T): Struct; /** * Ensure that a value is a `Map` object, and that its keys and values are of * specific types. */ export declare function map(): Struct, null>; export declare function map(Key: Struct, Value: Struct): Struct, null>; /** * Ensure that no value ever passes validation. */ export declare function never(): Struct; /** * Augment an existing struct to allow `null` values. */ export declare function nullable(struct: Struct): Struct; /** * Ensure that a value is a number. */ export declare function number(): Struct; /** * Ensure that a value is an object, that is has a known set of properties, * and that its properties are of specific types. * * Note: Unrecognized properties will fail validation. */ export declare function object(): Struct, null>; export declare function object(schema: S): Struct, S>; /** * Augment a struct to allow `undefined` values. */ export declare function optional(struct: Struct): Struct; /** * Ensure that a value is an object with keys and values of specific types, but * without ensuring any specific shape of properties. * * Like TypeScript's `Record` utility. */ export declare function record(Key: Struct, Value: Struct): Struct, null>; /** * Ensure that a value is a `RegExp`. * * Note: this does not test the value against the regular expression! For that * you need to use the `pattern()` refinement. */ export declare function regexp(): Struct; /** * Ensure that a value is a `Set` object, and that its elements are of a * specific type. */ export declare function set(): Struct, null>; export declare function set(Element: Struct): Struct, null>; /** * Ensure that a value is a string. */ export declare function string(): Struct; /** * Ensure that a value is a tuple of a specific length, and that each of its * elements is of a specific type. */ export declare function tuple(Structs: [A, ...B]): Struct<[Infer, ...InferStructTuple], null>; /** * Ensure that a value has a set of known properties of specific types. * * Note: Unrecognized properties are allowed and untouched. This is similar to * how TypeScript's structural typing works. */ export declare function type(schema: S): Struct, S>; /** * Ensure that a value matches one of a set of types. */ export declare function union(Structs: [A, ...B]): Struct | InferStructTuple[number], null>; /** * Ensure that any value passes validation, without widening its type to `any`. */ export declare function unknown(): Struct; //# sourceMappingURL=types.d.ts.map