UNPKG

1.02 kBTypeScriptView Raw
1/**
2 * A `StructFailure` represents a single specific failure in validation.
3 */
4export type Failure = {
5 value: any;
6 key: any;
7 type: string;
8 refinement: string | undefined;
9 message: string;
10 explanation?: string;
11 branch: Array<any>;
12 path: Array<any>;
13};
14/**
15 * `StructError` objects are thrown (or returned) when validation fails.
16 *
17 * Validation logic is design to exit early for maximum performance. The error
18 * represents the first error encountered during validation. For more detail,
19 * the `error.failures` property is a generator function that can be run to
20 * continue validation and receive all the failures in the data.
21 */
22export declare class StructError extends TypeError {
23 value: any;
24 key: any;
25 type: string;
26 refinement: string | undefined;
27 path: Array<any>;
28 branch: Array<any>;
29 failures: () => Array<Failure>;
30 [x: string]: any;
31 constructor(failure: Failure, failures: () => Generator<Failure>);
32}
33//# sourceMappingURL=error.d.ts.map
\No newline at end of file