1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | export declare class StructError extends TypeError {
|
8 | branch: Branch;
|
9 | failures: Failure[];
|
10 | path: Path;
|
11 | type: string | undefined;
|
12 | value: any;
|
13 | [key: string]: any;
|
14 | constructor(failures: Failure[]);
|
15 | }
|
16 | /**
|
17 | * `Path` arrays specify a nested value's location in a root object or array.
|
18 | *
|
19 | * ```js
|
20 | * ['user', 'address', 'city']
|
21 | * ['nodes', 1, 'nodes', 0, 'text']
|
22 | * ```
|
23 | */
|
24 | export declare type Path = Array<number | string>;
|
25 | /**
|
26 | * `Branch` arrays contain each value following a path down from the root.
|
27 | *
|
28 | * ```js
|
29 | * [root, ..., parent, value]
|
30 | * ```
|
31 | */
|
32 | export declare type Branch = Array<any>;
|
33 | /**
|
34 | * `Failure` objects represent a specific failure in validation. They are plain
|
35 | * objects that can be turned into real `StructError` when needed.
|
36 | *
|
37 | * ```js
|
38 | * {
|
39 | * type: 'number',
|
40 | * value: 'invalid',
|
41 | * path: [1],
|
42 | * branch: [
|
43 | * [1, 'invalid', 2],
|
44 | * 'invalid',
|
45 | * ]
|
46 | * }
|
47 | */
|
48 | export declare type Failure = {
|
49 | |
50 |
|
51 |
|
52 | branch: Branch;
|
53 | |
54 |
|
55 |
|
56 | path: Path;
|
57 | |
58 |
|
59 |
|
60 | value: any;
|
61 | |
62 |
|
63 |
|
64 |
|
65 | type: string | undefined;
|
66 | |
67 |
|
68 |
|
69 | [key: string]: any;
|
70 | };
|