1 | import { Infer, Struct } from '../struct.js';
|
2 | import { ObjectSchema, ObjectType, AnyStruct, InferStructTuple, UnionToIntersection } from '../utils.js';
|
3 |
|
4 |
|
5 |
|
6 | export declare function any(): Struct<any, null>;
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | export declare function array<T extends Struct<any>>(Element: T): Struct<Infer<T>[], T>;
|
15 | export declare function array(): Struct<unknown[], undefined>;
|
16 |
|
17 |
|
18 |
|
19 | export declare function bigint(): Struct<bigint, null>;
|
20 |
|
21 |
|
22 |
|
23 | export declare function boolean(): Struct<boolean, null>;
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | export declare function date(): Struct<Date, null>;
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 | export declare function enums<U extends number, T extends readonly U[]>(values: T): Struct<T[number], {
|
38 | [K in T[number]]: K;
|
39 | }>;
|
40 | export declare function enums<U extends string, T extends readonly U[]>(values: T): Struct<T[number], {
|
41 | [K in T[number]]: K;
|
42 | }>;
|
43 |
|
44 |
|
45 |
|
46 | export declare function func(): Struct<Function, null>;
|
47 |
|
48 |
|
49 |
|
50 | export declare function instance<T extends {
|
51 | new (...args: any): any;
|
52 | }>(Class: T): Struct<InstanceType<T>, null>;
|
53 |
|
54 |
|
55 |
|
56 | export declare function integer(): Struct<number, null>;
|
57 |
|
58 |
|
59 |
|
60 | export declare function intersection<A extends AnyStruct, B extends AnyStruct[]>(Structs: [A, ...B]): Struct<Infer<A> & UnionToIntersection<InferStructTuple<B>[number]>, null>;
|
61 |
|
62 |
|
63 |
|
64 | export declare function literal<T extends boolean>(constant: T): Struct<T, T>;
|
65 | export declare function literal<T extends number>(constant: T): Struct<T, T>;
|
66 | export declare function literal<T extends string>(constant: T): Struct<T, T>;
|
67 | export declare function literal<T>(constant: T): Struct<T, null>;
|
68 |
|
69 |
|
70 |
|
71 |
|
72 | export declare function map(): Struct<Map<unknown, unknown>, null>;
|
73 | export declare function map<K, V>(Key: Struct<K>, Value: Struct<V>): Struct<Map<K, V>, null>;
|
74 |
|
75 |
|
76 |
|
77 | export declare function never(): Struct<never, null>;
|
78 |
|
79 |
|
80 |
|
81 | export declare function nullable<T, S>(struct: Struct<T, S>): Struct<T | null, S>;
|
82 |
|
83 |
|
84 |
|
85 | export declare function number(): Struct<number, null>;
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 | export declare function object(): Struct<Record<string, unknown>, null>;
|
93 | export declare function object<S extends ObjectSchema>(schema: S): Struct<ObjectType<S>, S>;
|
94 |
|
95 |
|
96 |
|
97 | export declare function optional<T, S>(struct: Struct<T, S>): Struct<T | undefined, S>;
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 | export declare function record<K extends string, V>(Key: Struct<K>, Value: Struct<V>): Struct<Record<K, V>, null>;
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 | export declare function regexp(): Struct<RegExp, null>;
|
112 |
|
113 |
|
114 |
|
115 |
|
116 | export declare function set(): Struct<Set<unknown>, null>;
|
117 | export declare function set<T>(Element: Struct<T>): Struct<Set<T>, null>;
|
118 |
|
119 |
|
120 |
|
121 | export declare function string(): Struct<string, null>;
|
122 |
|
123 |
|
124 |
|
125 |
|
126 | export declare function tuple<A extends AnyStruct, B extends AnyStruct[]>(Structs: [A, ...B]): Struct<[Infer<A>, ...InferStructTuple<B>], null>;
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 | export declare function type<S extends ObjectSchema>(schema: S): Struct<ObjectType<S>, S>;
|
134 |
|
135 |
|
136 |
|
137 | export declare function union<A extends AnyStruct, B extends AnyStruct[]>(Structs: [A, ...B]): Struct<Infer<A> | InferStructTuple<B>[number], null>;
|
138 |
|
139 |
|
140 |
|
141 | export declare function unknown(): Struct<unknown, null>;
|
142 |
|
\ | No newline at end of file |