1 | import { Struct, StructType, StructContext } from './struct';
|
2 | declare type StructRecord<T> = Record<string, Struct<T>>;
|
3 | declare type StructTuple<T> = {
|
4 | [K in keyof T]: Struct<T[K]>;
|
5 | };
|
6 |
|
7 |
|
8 |
|
9 | export declare function any(): Struct<any>;
|
10 |
|
11 |
|
12 |
|
13 | export declare function array<T>(Element: Struct<T>): Struct<T[]>;
|
14 |
|
15 |
|
16 |
|
17 | export declare function boolean(): Struct<boolean>;
|
18 |
|
19 |
|
20 |
|
21 | export declare function coercion<T>(struct: Struct<T>, coercer: Struct<T>['coercer']): Struct<T>;
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | export declare function date(): Struct<Date>;
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | export declare function defaulted<T>(S: Struct<T>, fallback: any, strict?: true): Struct<T>;
|
36 |
|
37 |
|
38 |
|
39 | export declare function dynamic<T>(fn: (value: unknown, ctx: StructContext) => Struct<T>): Struct<T>;
|
40 |
|
41 |
|
42 |
|
43 | export declare function enums<T>(values: T[]): Struct<T>;
|
44 |
|
45 |
|
46 |
|
47 | export declare function instance<T extends {
|
48 | new (...args: any): any;
|
49 | }>(Class: T): Struct<InstanceType<T>>;
|
50 |
|
51 |
|
52 |
|
53 | export declare function integer(): Struct<number>;
|
54 |
|
55 |
|
56 |
|
57 | export declare function intersection<A>(Structs: StructTuple<[A]>): Struct<A>;
|
58 | export declare function intersection<A, B>(Structs: StructTuple<[A, B]>): Struct<A & B>;
|
59 | export declare function intersection<A, B, C>(Structs: StructTuple<[A, B, C]>): Struct<A & B & C>;
|
60 | export declare function intersection<A, B, C, D>(Structs: StructTuple<[A, B, C, D]>): Struct<A & B & C & D>;
|
61 | export declare function intersection<A, B, C, D, E>(Structs: StructTuple<[A, B, C, D, E]>): Struct<A & B & C & D & E>;
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 | export declare function lazy<T>(fn: () => Struct<T>): Struct<T>;
|
68 |
|
69 |
|
70 |
|
71 |
|
72 | export declare function length<T extends string | any[]>(S: Struct<T>, min: number, max?: number): Struct<T>;
|
73 |
|
74 |
|
75 |
|
76 | export declare function literal<T>(constant: T): Struct<T>;
|
77 |
|
78 |
|
79 |
|
80 | export declare function map<K, V>(Structs: StructTuple<[K, V]>): Struct<Map<K, V>>;
|
81 |
|
82 |
|
83 |
|
84 | export declare function never(): Struct<never>;
|
85 |
|
86 |
|
87 |
|
88 | export declare function number(): Struct<number>;
|
89 |
|
90 |
|
91 |
|
92 | export declare function object<V extends StructRecord<any>>(Structs: V): Struct<{
|
93 | [K in keyof V]: StructType<V[K]>;
|
94 | }>;
|
95 |
|
96 |
|
97 |
|
98 | export declare function optional<T>(S: Struct<T>): Struct<T | undefined>;
|
99 |
|
100 |
|
101 |
|
102 | export declare function partial<V extends StructRecord<any>>(Structs: V): Struct<{
|
103 | [K in keyof V]?: StructType<V[K]>;
|
104 | }>;
|
105 |
|
106 |
|
107 |
|
108 | export declare function pattern<T extends string>(S: Struct<T>, regexp: RegExp): Struct<T>;
|
109 |
|
110 |
|
111 |
|
112 |
|
113 | export declare function record<K extends string | number, V>(Structs: StructTuple<[K, V]>): Struct<Record<K, V>>;
|
114 |
|
115 |
|
116 |
|
117 | export declare function refinement<T>(struct: Struct<T>, type: string, refiner: Struct<T>['refiner']): Struct<T>;
|
118 |
|
119 |
|
120 |
|
121 | export declare function set<T>(Element: Struct<T>): Struct<Set<T>>;
|
122 |
|
123 |
|
124 |
|
125 | export declare function string(): Struct<string>;
|
126 |
|
127 |
|
128 |
|
129 | export declare function trimmed<T extends string>(S: Struct<T>): Struct<T>;
|
130 |
|
131 |
|
132 |
|
133 | export declare function tuple<A>(Elements: StructTuple<[A]>): Struct<[A]>;
|
134 | export declare function tuple<A, B>(Elements: StructTuple<[A, B]>): Struct<[A, B]>;
|
135 | export declare function tuple<A, B, C>(Elements: StructTuple<[A, B, C]>): Struct<[A, B, C]>;
|
136 | export declare function tuple<A, B, C, D>(Elements: StructTuple<[A, B, C, D]>): Struct<[A, B, C, D]>;
|
137 | export declare function tuple<A, B, C, D, E>(Elements: StructTuple<[A, B, C, D, E]>): Struct<[A, B, C, D, E]>;
|
138 |
|
139 |
|
140 |
|
141 |
|
142 | export declare function type<V extends StructRecord<any>>(Structs: V): Struct<{
|
143 | [K in keyof V]: StructType<V[K]>;
|
144 | }>;
|
145 |
|
146 |
|
147 |
|
148 | export declare function unknown(): Struct<unknown>;
|
149 |
|
150 |
|
151 |
|
152 | export declare function union<A>(Structs: StructTuple<[A]>): Struct<A>;
|
153 | export declare function union<A, B>(Structs: StructTuple<[A, B]>): Struct<A | B>;
|
154 | export declare function union<A, B, C>(Structs: StructTuple<[A, B, C]>): Struct<A | B | C>;
|
155 | export declare function union<A, B, C, D>(Structs: StructTuple<[A, B, C, D]>): Struct<A | B | C | D>;
|
156 | export declare function union<A, B, C, D, E>(Structs: StructTuple<[A, B, C, D, E]>): Struct<A | B | C | D | E>;
|
157 | export {};
|