import { Branch, Path, Failure } from './struct-error'; /** * Superstruct ships by default with an unopinionated set of scalar types that * express all of the data types that are built-in to JavaScript. */ export declare const Types: { /** * Matches any value other than `undefined`. * * ```js * 'anything' * true * ``` */ any: (value: any) => boolean; /** * Matches an `arguments` object. * * ```js * arguments * ``` */ arguments: (value: any) => boolean; /** * Matches an `Array`. * * ```js * [1, 2, 3] * ``` */ array: (value: any) => boolean; /** * Matches a boolean. * * ```js * true * false * ``` */ boolean: (value: any) => boolean; /** * Matches a Node.js `Buffer`. * * ```js * Buffer.from('string') * ``` */ buffer: (value: any) => boolean; /** * Matches a **valid** `Date` object. * * ```js * new Date() * ``` * * Note: Invalid `Date` objects that equal `NaN` are not matched. */ date: (value: any) => boolean; /** * Matches an error object. * * ```js * new Error() * ``` */ error: (value: any) => boolean; /** * Matches a `Float32Array` object. */ float32array: (value: any) => boolean; /** * Matches a `Float64Array` object. */ float64array: (value: any) => boolean; /** * Matches a function. * * ```js * () => {} * function () {} * ``` */ function: (value: any) => boolean; /** * Matches a generator function. * * ```js * function* () {} * ``` */ generatorfunction: (value: any) => boolean; /** * Matches a `Int16Array` object. */ int16array: (value: any) => boolean; /** * Matches a `Int32Array` object. */ int32array: (value: any) => boolean; /** * Matches a `Int8Array` object. */ int8array: (value: any) => boolean; /** * Matches a `Map` object. * * ```js * new Map() * ``` */ map: (value: any) => boolean; /** * Matches the `null` literal value. * * ```js * null * ``` */ null: (value: any) => boolean; /** * Matches a number. * * ```js * 42 * ``` */ number: (value: any) => boolean; /** * Matches a plain object. * * ```js * { key: 'value' } * { something: true } * ``` */ object: (value: any) => boolean; /** * Matches a `Promise` object. * * ```js * Promise.resolve() * ``` */ promise: (value: any) => boolean; /** * Matches a regular expression object. * * ```js * /a-z/g * ``` */ regexp: (value: any) => boolean; /** * Matches a `Set` object. * * ```js * new Set() * ``` */ set: (value: any) => boolean; /** * Matches a string. * * ```js * 'text' * ``` */ string: (value: any) => boolean; /** * Matches a `Symbol`. * * ```js * Symbol() * ``` */ symbol: (value: any) => boolean; /** * Matches a `Uint16Array` object. */ uint16array: (value: any) => boolean; /** * Matches a `Uint32Array` object. */ uint32array: (value: any) => boolean; /** * Matches a `Uint8Array` object. */ uint8array: (value: any) => boolean; /** * Matches a `Uint8ClampedArray` object. */ uint8clampedarray: (value: any) => boolean; /** * Matches the `undefined` literal value. * * ```js * undefined * ``` */ undefined: (value: any) => boolean; /** * Matches a `WeakMap` object. * * ```js * new WeakMap() * ``` */ weakmap: (value: any) => boolean; /** * Matches a `WeakSet` object. * * ```js * new WeakSet() * ``` */ weakset: (value: any) => boolean; }; /** * `Validator` functions allow developers to define their own scalar types for * Superstruct to validate against, and return an indication of what is invalid. * * ```js * import { superstruct } from 'superstruct' * import isEmail from 'is-email' * * const struct = superstruct({ * types: { * email: value => isEmail(value) && value.length < 256, * } * }) * ``` */ export declare type Validator = (value: any, branch: Branch, path: Path) => Partial[] | Partial | boolean;