/** * `StructError` objects are thrown (or returned) by Superstruct when its * validation fails. The error represents the first error encountered during * validation. But they also have an `error.failures` property that holds * information for all of the failures encountered. */ export declare class StructError extends TypeError { branch: Branch; failures: Failure[]; path: Path; type: string | undefined; value: any; [key: string]: any; constructor(failures: Failure[]); } /** * `Path` arrays specify a nested value's location in a root object or array. * * ```js * ['user', 'address', 'city'] * ['nodes', 1, 'nodes', 0, 'text'] * ``` */ export declare type Path = Array; /** * `Branch` arrays contain each value following a path down from the root. * * ```js * [root, ..., parent, value] * ``` */ export declare type Branch = Array; /** * `Failure` objects represent a specific failure in validation. They are plain * objects that can be turned into real `StructError` when needed. * * ```js * { * type: 'number', * value: 'invalid', * path: [1], * branch: [ * [1, 'invalid', 2], * 'invalid', * ] * } */ export declare type Failure = { /** * The branch of values following a path down from the root. */ branch: Branch; /** * The path of indices to retrieve the failing value from the root. */ path: Path; /** * The failing value. */ value: any; /** * The expected type description of the failing value, or `undefined` if it * didn't have an expected type. */ type: string | undefined; /** * Failures can also be augmented with any of your on custom properties. */ [key: string]: any; };