1 | import { Struct, StructType, StructContext } from './struct';
|
2 | import { StructRecord, StructTuple } from './utils';
|
3 |
|
4 |
|
5 |
|
6 | export declare function any(): Struct<any>;
|
7 |
|
8 |
|
9 |
|
10 | export declare function array<T>(Element: Struct<T>): Struct<T[], Struct<T>>;
|
11 |
|
12 |
|
13 |
|
14 | export declare function boolean(): Struct<boolean>;
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | export declare function date(): Struct<Date>;
|
22 |
|
23 |
|
24 |
|
25 | export declare function dynamic<T>(fn: (value: unknown, ctx: StructContext) => Struct<T>): Struct<T>;
|
26 |
|
27 |
|
28 |
|
29 | export declare function enums<T>(values: T[]): Struct<T>;
|
30 |
|
31 |
|
32 |
|
33 | export declare function func(): Struct<Function>;
|
34 |
|
35 |
|
36 |
|
37 | export declare function instance<T extends {
|
38 | new (...args: any): any;
|
39 | }>(Class: T): Struct<InstanceType<T>>;
|
40 |
|
41 |
|
42 |
|
43 | export declare function intersection<A>(Structs: StructTuple<[A]>): Struct<A>;
|
44 | export declare function intersection<A, B>(Structs: StructTuple<[A, B]>): Struct<A & B>;
|
45 | export declare function intersection<A, B, C>(Structs: StructTuple<[A, B, C]>): Struct<A & B & C>;
|
46 | export declare function intersection<A, B, C, D>(Structs: StructTuple<[A, B, C, D]>): Struct<A & B & C & D>;
|
47 | export declare function intersection<A, B, C, D, E>(Structs: StructTuple<[A, B, C, D, E]>): Struct<A & B & C & D & E>;
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 | export declare function lazy<T>(fn: () => Struct<T>): Struct<T>;
|
54 |
|
55 |
|
56 |
|
57 | export declare function literal<T>(constant: T): Struct<T>;
|
58 |
|
59 |
|
60 |
|
61 | export declare function map<K, V>(Key: Struct<K>, Value: Struct<V>): Struct<Map<K, V>>;
|
62 |
|
63 |
|
64 |
|
65 | export declare function never(): Struct<never>;
|
66 |
|
67 |
|
68 |
|
69 | export declare function number(): Struct<number>;
|
70 |
|
71 |
|
72 |
|
73 | export declare function object<V extends StructRecord<any>>(Structs: V): Struct<{
|
74 | [K in keyof V]: StructType<V[K]>;
|
75 | }, V>;
|
76 |
|
77 |
|
78 |
|
79 | export declare function optional<T>(S: Struct<T>): Struct<T | undefined>;
|
80 |
|
81 |
|
82 |
|
83 | export declare function partial<T, V extends StructRecord<any>>(Structs: V | Struct<T, V>): Struct<{
|
84 | [K in keyof V]?: StructType<V[K]>;
|
85 | }>;
|
86 |
|
87 |
|
88 |
|
89 |
|
90 | export declare function record<K extends string | number, V>(Key: Struct<K>, Value: Struct<V>): Struct<Record<K, V>>;
|
91 |
|
92 |
|
93 |
|
94 | export declare function set<T>(Element: Struct<T>): Struct<Set<T>>;
|
95 |
|
96 |
|
97 |
|
98 | export declare function string(): Struct<string>;
|
99 |
|
100 |
|
101 |
|
102 | export declare function struct<T>(name: string, validator: Struct<T>['validator']): Struct<T, null>;
|
103 |
|
104 |
|
105 |
|
106 | export declare function tuple<A>(Elements: StructTuple<[A]>): Struct<[A]>;
|
107 | export declare function tuple<A, B>(Elements: StructTuple<[A, B]>): Struct<[A, B]>;
|
108 | export declare function tuple<A, B, C>(Elements: StructTuple<[A, B, C]>): Struct<[A, B, C]>;
|
109 | export declare function tuple<A, B, C, D>(Elements: StructTuple<[A, B, C, D]>): Struct<[A, B, C, D]>;
|
110 | export declare function tuple<A, B, C, D, E>(Elements: StructTuple<[A, B, C, D, E]>): Struct<[A, B, C, D, E]>;
|
111 |
|
112 |
|
113 |
|
114 |
|
115 | export declare function type<V extends StructRecord<any>>(Structs: V): Struct<{
|
116 | [K in keyof V]: StructType<V[K]>;
|
117 | }>;
|
118 |
|
119 |
|
120 |
|
121 | export declare function union<A>(Structs: StructTuple<[A]>): Struct<A>;
|
122 | export declare function union<A, B>(Structs: StructTuple<[A, B]>): Struct<A | B>;
|
123 | export declare function union<A, B, C>(Structs: StructTuple<[A, B, C]>): Struct<A | B | C>;
|
124 | export declare function union<A, B, C, D>(Structs: StructTuple<[A, B, C, D]>): Struct<A | B | C | D>;
|
125 | export declare function union<A, B, C, D, E>(Structs: StructTuple<[A, B, C, D, E]>): Struct<A | B | C | D | E>;
|