@sinclair/typebox 0.21.2 → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -8
- package/readme.md +209 -256
- package/typebox.d.ts +182 -144
- package/typebox.js +149 -114
package/typebox.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export declare const BooleanKind: unique symbol;
|
|
|
28
28
|
export declare const NullKind: unique symbol;
|
|
29
29
|
export declare const UnknownKind: unique symbol;
|
|
30
30
|
export declare const AnyKind: unique symbol;
|
|
31
|
+
export declare const RefKind: unique symbol;
|
|
31
32
|
export interface CustomOptions {
|
|
32
33
|
$id?: string;
|
|
33
34
|
title?: string;
|
|
@@ -68,243 +69,280 @@ export declare type TDefinitions = {
|
|
|
68
69
|
};
|
|
69
70
|
export declare type TNamespace<T extends TDefinitions> = {
|
|
70
71
|
kind: typeof BoxKind;
|
|
71
|
-
|
|
72
|
+
$defs: T;
|
|
72
73
|
} & CustomOptions;
|
|
73
|
-
export
|
|
74
|
-
|
|
75
|
-
}
|
|
74
|
+
export interface TSchema {
|
|
75
|
+
$static: unknown;
|
|
76
|
+
}
|
|
76
77
|
export declare type TEnumType = Record<string, string | number>;
|
|
77
|
-
export declare type TKey = string | number;
|
|
78
|
+
export declare type TKey = string | number | symbol;
|
|
78
79
|
export declare type TValue = string | number | boolean;
|
|
79
|
-
export declare type TRecordKey = TString | TNumber | TKeyOf<any> | TUnion<
|
|
80
|
+
export declare type TRecordKey = TString | TNumber | TKeyOf<any> | TUnion<any>;
|
|
80
81
|
export declare type TEnumKey<T = TKey> = {
|
|
81
82
|
type: 'number' | 'string';
|
|
82
83
|
const: T;
|
|
83
84
|
};
|
|
84
|
-
export
|
|
85
|
+
export interface TProperties {
|
|
85
86
|
[key: string]: TSchema;
|
|
86
|
-
}
|
|
87
|
-
export
|
|
87
|
+
}
|
|
88
|
+
export interface TRecord<K extends TRecordKey, T extends TSchema> extends TSchema, ObjectOptions {
|
|
89
|
+
$static: StaticRecord<K, T>;
|
|
90
|
+
kind: typeof RecordKind;
|
|
91
|
+
type: 'object';
|
|
92
|
+
patternProperties: {
|
|
93
|
+
[pattern: string]: T;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export interface TTuple<T extends TSchema[]> extends TSchema, CustomOptions {
|
|
97
|
+
$static: StaticTuple<T>;
|
|
88
98
|
kind: typeof TupleKind;
|
|
89
99
|
type: 'array';
|
|
90
|
-
items?:
|
|
100
|
+
items?: T;
|
|
91
101
|
additionalItems?: false;
|
|
92
102
|
minItems: number;
|
|
93
103
|
maxItems: number;
|
|
94
|
-
}
|
|
95
|
-
export
|
|
104
|
+
}
|
|
105
|
+
export interface TObject<T extends TProperties> extends TSchema, ObjectOptions {
|
|
106
|
+
$static: StaticObject<T>;
|
|
96
107
|
kind: typeof ObjectKind;
|
|
97
108
|
type: 'object';
|
|
98
|
-
properties:
|
|
109
|
+
properties: T;
|
|
99
110
|
required?: string[];
|
|
100
|
-
}
|
|
101
|
-
export
|
|
111
|
+
}
|
|
112
|
+
export interface TUnion<T extends TSchema[]> extends TSchema, CustomOptions {
|
|
113
|
+
$static: StaticUnion<T>;
|
|
102
114
|
kind: typeof UnionKind;
|
|
103
|
-
anyOf:
|
|
104
|
-
}
|
|
105
|
-
export
|
|
115
|
+
anyOf: T;
|
|
116
|
+
}
|
|
117
|
+
export interface TIntersect<T extends TSchema[]> extends TSchema, IntersectOptions {
|
|
118
|
+
$static: StaticIntersect<T>;
|
|
106
119
|
kind: typeof IntersectKind;
|
|
107
120
|
type: 'object';
|
|
108
|
-
allOf:
|
|
109
|
-
}
|
|
110
|
-
export
|
|
121
|
+
allOf: T;
|
|
122
|
+
}
|
|
123
|
+
export interface TKeyOf<T extends TKey[]> extends TSchema, CustomOptions {
|
|
124
|
+
$static: StaticKeyOf<T>;
|
|
111
125
|
kind: typeof KeyOfKind;
|
|
112
126
|
type: 'string';
|
|
113
|
-
enum:
|
|
114
|
-
}
|
|
115
|
-
export
|
|
116
|
-
|
|
117
|
-
type: 'object';
|
|
118
|
-
patternProperties: {
|
|
119
|
-
[pattern: string]: TSchema;
|
|
120
|
-
};
|
|
121
|
-
} & ObjectOptions;
|
|
122
|
-
export declare type TArray<I> = Infer<I> & {
|
|
127
|
+
enum: T;
|
|
128
|
+
}
|
|
129
|
+
export interface TArray<T extends TSchema> extends TSchema, ArrayOptions {
|
|
130
|
+
$static: StaticArray<T>;
|
|
123
131
|
kind: typeof ArrayKind;
|
|
124
132
|
type: 'array';
|
|
125
|
-
items:
|
|
126
|
-
}
|
|
127
|
-
export
|
|
133
|
+
items: T;
|
|
134
|
+
}
|
|
135
|
+
export interface TLiteral<T extends TValue> extends TSchema, CustomOptions {
|
|
136
|
+
$static: StaticLiteral<T>;
|
|
128
137
|
kind: typeof LiteralKind;
|
|
129
|
-
const:
|
|
130
|
-
}
|
|
131
|
-
export
|
|
138
|
+
const: T;
|
|
139
|
+
}
|
|
140
|
+
export interface TEnum<T extends TEnumKey[]> extends TSchema, CustomOptions {
|
|
141
|
+
$static: StaticEnum<T>;
|
|
132
142
|
kind: typeof EnumKind;
|
|
133
|
-
anyOf:
|
|
134
|
-
}
|
|
135
|
-
export
|
|
143
|
+
anyOf: T;
|
|
144
|
+
}
|
|
145
|
+
export interface TRef<T extends TSchema> extends TSchema, CustomOptions {
|
|
146
|
+
$static: Static<T>;
|
|
147
|
+
kind: typeof RefKind;
|
|
148
|
+
$ref: string;
|
|
149
|
+
}
|
|
150
|
+
export interface TString extends TSchema, StringOptions<string> {
|
|
151
|
+
$static: string;
|
|
136
152
|
kind: typeof StringKind;
|
|
137
153
|
type: 'string';
|
|
138
|
-
}
|
|
139
|
-
export
|
|
154
|
+
}
|
|
155
|
+
export interface TNumber extends TSchema, NumberOptions {
|
|
156
|
+
$static: number;
|
|
140
157
|
kind: typeof NumberKind;
|
|
141
158
|
type: 'number';
|
|
142
|
-
}
|
|
143
|
-
export
|
|
159
|
+
}
|
|
160
|
+
export interface TInteger extends TSchema, NumberOptions {
|
|
161
|
+
$static: number;
|
|
144
162
|
kind: typeof IntegerKind;
|
|
145
163
|
type: 'integer';
|
|
146
|
-
}
|
|
147
|
-
export
|
|
164
|
+
}
|
|
165
|
+
export interface TBoolean extends TSchema, CustomOptions {
|
|
166
|
+
$static: boolean;
|
|
148
167
|
kind: typeof BooleanKind;
|
|
149
168
|
type: 'boolean';
|
|
150
|
-
}
|
|
151
|
-
export
|
|
169
|
+
}
|
|
170
|
+
export interface TNull extends TSchema, CustomOptions {
|
|
171
|
+
$static: null;
|
|
152
172
|
kind: typeof NullKind;
|
|
153
173
|
type: 'null';
|
|
154
|
-
}
|
|
155
|
-
export
|
|
174
|
+
}
|
|
175
|
+
export interface TUnknown extends TSchema, CustomOptions {
|
|
176
|
+
$static: unknown;
|
|
156
177
|
kind: typeof UnknownKind;
|
|
157
|
-
}
|
|
158
|
-
export
|
|
178
|
+
}
|
|
179
|
+
export interface TAny extends TSchema, CustomOptions {
|
|
180
|
+
$static: any;
|
|
159
181
|
kind: typeof AnyKind;
|
|
160
|
-
}
|
|
182
|
+
}
|
|
161
183
|
export declare const ConstructorKind: unique symbol;
|
|
162
184
|
export declare const FunctionKind: unique symbol;
|
|
163
185
|
export declare const PromiseKind: unique symbol;
|
|
164
186
|
export declare const UndefinedKind: unique symbol;
|
|
165
187
|
export declare const VoidKind: unique symbol;
|
|
166
|
-
export
|
|
188
|
+
export interface TConstructor<T extends TSchema[], U extends TSchema> extends TSchema, CustomOptions {
|
|
189
|
+
$static: StaticConstructor<T, U>;
|
|
167
190
|
kind: typeof ConstructorKind;
|
|
168
191
|
type: 'constructor';
|
|
169
192
|
arguments: TSchema[];
|
|
170
193
|
returns: TSchema;
|
|
171
|
-
}
|
|
172
|
-
export
|
|
194
|
+
}
|
|
195
|
+
export interface TFunction<T extends TSchema[], U extends TSchema> extends TSchema, CustomOptions {
|
|
196
|
+
$static: StaticFunction<T, U>;
|
|
173
197
|
kind: typeof FunctionKind;
|
|
174
198
|
type: 'function';
|
|
175
199
|
arguments: TSchema[];
|
|
176
200
|
returns: TSchema;
|
|
177
|
-
}
|
|
178
|
-
export
|
|
201
|
+
}
|
|
202
|
+
export interface TPromise<T extends TSchema> extends TSchema, CustomOptions {
|
|
203
|
+
$static: StaticPromise<T>;
|
|
179
204
|
kind: typeof PromiseKind;
|
|
180
205
|
type: 'promise';
|
|
181
206
|
item: TSchema;
|
|
182
|
-
}
|
|
183
|
-
export
|
|
207
|
+
}
|
|
208
|
+
export interface TUndefined extends TSchema, CustomOptions {
|
|
209
|
+
$static: undefined;
|
|
184
210
|
kind: typeof UndefinedKind;
|
|
185
211
|
type: 'undefined';
|
|
186
|
-
}
|
|
187
|
-
export
|
|
212
|
+
}
|
|
213
|
+
export interface TVoid extends TSchema, CustomOptions {
|
|
214
|
+
$static: void;
|
|
188
215
|
kind: typeof VoidKind;
|
|
189
216
|
type: 'void';
|
|
190
|
-
}
|
|
191
|
-
export declare type
|
|
217
|
+
}
|
|
218
|
+
export declare type Selectable = TObject<TProperties> | TRef<TObject<TProperties>>;
|
|
219
|
+
export declare type SelectablePropertyKeys<T extends Selectable> = T extends TObject<infer U> ? keyof U : T extends TRef<TObject<infer U>> ? keyof U : never;
|
|
220
|
+
export declare type SelectableProperties<T extends Selectable> = T extends TObject<infer U> ? U : T extends TRef<TObject<infer U>> ? U : never;
|
|
192
221
|
export declare type UnionToIntersect<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
193
|
-
export declare type
|
|
194
|
-
[K in keyof T]: Static<T[K]>;
|
|
195
|
-
};
|
|
196
|
-
export declare type IntersectReduce<I extends unknown, T extends readonly any[]> = T extends [infer A, ...infer B] ? IntersectReduce<I & A, B> : I;
|
|
197
|
-
export declare type ReadonlyOptionalPropertyKeys<T extends TProperties> = {
|
|
222
|
+
export declare type StaticReadonlyOptionalPropertyKeys<T extends TProperties> = {
|
|
198
223
|
[K in keyof T]: T[K] extends TReadonlyOptional<TSchema> ? K : never;
|
|
199
224
|
}[keyof T];
|
|
200
|
-
export declare type
|
|
225
|
+
export declare type StaticReadonlyPropertyKeys<T extends TProperties> = {
|
|
201
226
|
[K in keyof T]: T[K] extends TReadonly<TSchema> ? K : never;
|
|
202
227
|
}[keyof T];
|
|
203
|
-
export declare type
|
|
228
|
+
export declare type StaticOptionalPropertyKeys<T extends TProperties> = {
|
|
204
229
|
[K in keyof T]: T[K] extends TOptional<TSchema> ? K : never;
|
|
205
230
|
}[keyof T];
|
|
206
|
-
export declare type
|
|
231
|
+
export declare type StaticRequiredPropertyKeys<T extends TProperties> = keyof Omit<T, StaticReadonlyOptionalPropertyKeys<T> | StaticReadonlyPropertyKeys<T> | StaticOptionalPropertyKeys<T>>;
|
|
232
|
+
export declare type StaticIntersectEvaluate<T extends readonly TSchema[]> = {
|
|
233
|
+
[K in keyof T]: T[K] extends TSchema ? Static<T[K]> : never;
|
|
234
|
+
};
|
|
235
|
+
export declare type StaticIntersectReduce<I extends unknown, T extends readonly any[]> = T extends [infer A, ...infer B] ? StaticIntersectReduce<I & A, B> : I;
|
|
236
|
+
export declare type StaticRequired<T extends TProperties> = {
|
|
237
|
+
[K in keyof T]: T[K] extends TReadonlyOptional<infer U> ? TReadonly<U> : T[K] extends TReadonly<infer U> ? TReadonly<U> : T[K] extends TOptional<infer U> ? U : T[K];
|
|
238
|
+
};
|
|
239
|
+
export declare type StaticPartial<T extends TProperties> = {
|
|
240
|
+
[K in keyof T]: T[K] extends TReadonlyOptional<infer U> ? TReadonlyOptional<U> : T[K] extends TReadonly<infer U> ? TReadonlyOptional<U> : T[K] extends TOptional<infer U> ? TOptional<U> : TOptional<T[K]>;
|
|
241
|
+
};
|
|
207
242
|
export declare type StaticProperties<T extends TProperties> = {
|
|
208
|
-
readonly [K in
|
|
243
|
+
readonly [K in StaticReadonlyOptionalPropertyKeys<T>]?: Static<T[K]>;
|
|
209
244
|
} & {
|
|
210
|
-
readonly [K in
|
|
245
|
+
readonly [K in StaticReadonlyPropertyKeys<T>]: Static<T[K]>;
|
|
211
246
|
} & {
|
|
212
|
-
[K in
|
|
247
|
+
[K in StaticOptionalPropertyKeys<T>]?: Static<T[K]>;
|
|
213
248
|
} & {
|
|
214
|
-
[K in
|
|
249
|
+
[K in StaticRequiredPropertyKeys<T>]: Static<T[K]>;
|
|
215
250
|
};
|
|
216
|
-
export declare type StaticRecord<K extends TRecordKey, T extends TSchema> = K extends TString ? Record<string, Static<T>> : K extends TNumber ? Record<number, Static<T>> : K extends TKeyOf<
|
|
251
|
+
export declare type StaticRecord<K extends TRecordKey, T extends TSchema> = K extends TString ? Record<string, Static<T>> : K extends TNumber ? Record<number, Static<T>> : K extends TKeyOf<TKey[]> ? Record<K['$static'], Static<T>> : K extends TUnion<TSchema[]> ? Record<K['$static'], Static<T>> : never;
|
|
217
252
|
export declare type StaticEnum<T> = T extends TEnumKey<infer U>[] ? U : never;
|
|
218
253
|
export declare type StaticKeyOf<T extends TKey[]> = T extends Array<infer K> ? K : never;
|
|
219
|
-
export declare type StaticIntersect<T extends readonly TSchema[]> =
|
|
254
|
+
export declare type StaticIntersect<T extends readonly TSchema[]> = StaticIntersectReduce<unknown, StaticIntersectEvaluate<T>>;
|
|
220
255
|
export declare type StaticUnion<T extends readonly TSchema[]> = {
|
|
221
|
-
[K in keyof T]: Static<T[K]
|
|
256
|
+
[K in keyof T]: T[K] extends TSchema ? Static<T[K]> : never;
|
|
222
257
|
}[number];
|
|
223
258
|
export declare type StaticTuple<T extends readonly TSchema[]> = {
|
|
224
|
-
[K in keyof T]: Static<T[K]
|
|
259
|
+
[K in keyof T]: T[K] extends TSchema ? Static<T[K]> : never;
|
|
225
260
|
};
|
|
226
|
-
export declare type StaticObject<T extends TProperties> = StaticProperties<
|
|
261
|
+
export declare type StaticObject<T extends TProperties> = StaticProperties<T> extends infer I ? {
|
|
262
|
+
[K in keyof I]: I[K];
|
|
263
|
+
} : never;
|
|
227
264
|
export declare type StaticArray<T extends TSchema> = Array<Static<T>>;
|
|
228
265
|
export declare type StaticLiteral<T extends TValue> = T;
|
|
229
|
-
export declare type
|
|
230
|
-
[K in keyof T]: Static<T[K]
|
|
231
|
-
}
|
|
232
|
-
export declare type
|
|
233
|
-
|
|
234
|
-
}]) => Static<U>;
|
|
266
|
+
export declare type StaticParameters<T extends readonly TSchema[]> = {
|
|
267
|
+
[K in keyof T]: T[K] extends TSchema ? Static<T[K]> : never;
|
|
268
|
+
};
|
|
269
|
+
export declare type StaticConstructor<T extends readonly TSchema[], U extends TSchema> = new (...args: [...StaticParameters<T>]) => Static<U>;
|
|
270
|
+
export declare type StaticFunction<T extends readonly TSchema[], U extends TSchema> = (...args: [...StaticParameters<T>]) => Static<U>;
|
|
235
271
|
export declare type StaticPromise<T extends TSchema> = Promise<Static<T>>;
|
|
236
|
-
export declare type Static<T
|
|
237
|
-
[K in keyof I]: I[K];
|
|
238
|
-
} : T extends TRecord<infer I> ? I : T extends TArray<infer I> ? I : T extends TEnum<infer I> ? I : T extends TLiteral<infer I> ? I : T extends TString ? T['_infer'] : T extends TNumber ? T['_infer'] : T extends TInteger ? T['_infer'] : T extends TBoolean ? T['_infer'] : T extends TNull ? T['_infer'] : T extends TUnknown ? T['_infer'] : T extends TAny ? T['_infer'] : T extends TConstructor<infer I> ? I : T extends TFunction<infer I> ? I : T extends TPromise<infer I> ? I : T extends TUndefined ? T['_infer'] : T extends TVoid ? T['_infer'] : never;
|
|
272
|
+
export declare type Static<T extends TSchema> = T['$static'];
|
|
239
273
|
export declare class TypeBuilder {
|
|
240
|
-
|
|
274
|
+
protected readonly schemas: Map<string, TSchema>;
|
|
275
|
+
/** `Standard` Modifies an object property to be both readonly and optional */
|
|
241
276
|
ReadonlyOptional<T extends TSchema>(item: T): TReadonlyOptional<T>;
|
|
242
|
-
/** `
|
|
277
|
+
/** `Standard` Modifies an object property to be readonly */
|
|
243
278
|
Readonly<T extends TSchema>(item: T): TReadonly<T>;
|
|
244
|
-
/** `
|
|
279
|
+
/** `Standard` Modifies an object property to be optional */
|
|
245
280
|
Optional<T extends TSchema>(item: T): TOptional<T>;
|
|
246
|
-
/** `
|
|
247
|
-
Tuple<T extends TSchema[]>(items: [...T], options?: CustomOptions): TTuple<
|
|
248
|
-
/** `
|
|
249
|
-
Object<T extends TProperties>(properties: T, options?: ObjectOptions): TObject<
|
|
250
|
-
/** `
|
|
251
|
-
Intersect<T extends TSchema[]>(items: [...T], options?: IntersectOptions): TIntersect<
|
|
252
|
-
/** `
|
|
253
|
-
Union<T extends TSchema[]>(items: [...T], options?: CustomOptions): TUnion<
|
|
254
|
-
/** `
|
|
255
|
-
Array<T extends TSchema>(items: T, options?: ArrayOptions): TArray<
|
|
256
|
-
/** `
|
|
257
|
-
Enum<T extends TEnumType>(item: T, options?: CustomOptions): TEnum<
|
|
258
|
-
/** `
|
|
259
|
-
Literal<T extends TValue>(value: T, options?: CustomOptions): TLiteral<
|
|
260
|
-
/** `
|
|
281
|
+
/** `Standard` Creates a type type */
|
|
282
|
+
Tuple<T extends TSchema[]>(items: [...T], options?: CustomOptions): TTuple<T>;
|
|
283
|
+
/** `Standard` Creates an object type with the given properties */
|
|
284
|
+
Object<T extends TProperties>(properties: T, options?: ObjectOptions): TObject<T>;
|
|
285
|
+
/** `Standard` Creates an intersect type. */
|
|
286
|
+
Intersect<T extends TSchema[]>(items: [...T], options?: IntersectOptions): TIntersect<T>;
|
|
287
|
+
/** `Standard` Creates a union type */
|
|
288
|
+
Union<T extends TSchema[]>(items: [...T], options?: CustomOptions): TUnion<T>;
|
|
289
|
+
/** `Standard` Creates an array type */
|
|
290
|
+
Array<T extends TSchema>(items: T, options?: ArrayOptions): TArray<T>;
|
|
291
|
+
/** `Standard` Creates an enum type from a TypeScript enum */
|
|
292
|
+
Enum<T extends TEnumType>(item: T, options?: CustomOptions): TEnum<TEnumKey<T[keyof T]>[]>;
|
|
293
|
+
/** `Standard` Creates a literal type. Supports string, number and boolean values only */
|
|
294
|
+
Literal<T extends TValue>(value: T, options?: CustomOptions): TLiteral<T>;
|
|
295
|
+
/** `Standard` Creates a string type */
|
|
261
296
|
String<TCustomFormatOption extends string>(options?: StringOptions<StringFormatOption | TCustomFormatOption>): TString;
|
|
262
|
-
/** `
|
|
297
|
+
/** `Standard` Creates a string type from a regular expression */
|
|
263
298
|
RegEx(regex: RegExp, options?: CustomOptions): TString;
|
|
264
|
-
/** `
|
|
299
|
+
/** `Standard` Creates a number type */
|
|
265
300
|
Number(options?: NumberOptions): TNumber;
|
|
266
|
-
/** `
|
|
301
|
+
/** `Standard` Creates an integer type */
|
|
267
302
|
Integer(options?: NumberOptions): TInteger;
|
|
268
|
-
/** `
|
|
303
|
+
/** `Standard` Creates a boolean type */
|
|
269
304
|
Boolean(options?: CustomOptions): TBoolean;
|
|
270
|
-
/** `
|
|
305
|
+
/** `Standard` Creates a null type */
|
|
271
306
|
Null(options?: CustomOptions): TNull;
|
|
272
|
-
/** `
|
|
307
|
+
/** `Standard` Creates an unknown type */
|
|
273
308
|
Unknown(options?: CustomOptions): TUnknown;
|
|
274
|
-
/** `
|
|
309
|
+
/** `Standard` Creates an any type */
|
|
275
310
|
Any(options?: CustomOptions): TAny;
|
|
276
|
-
/** `
|
|
277
|
-
|
|
278
|
-
/** `
|
|
279
|
-
|
|
280
|
-
/** `
|
|
281
|
-
Required<T extends TObject<
|
|
282
|
-
/** `
|
|
283
|
-
Partial<T extends TObject<
|
|
284
|
-
/** `
|
|
285
|
-
Pick<T extends TObject<
|
|
286
|
-
/** `
|
|
287
|
-
Omit<T extends TObject<
|
|
288
|
-
/** `
|
|
311
|
+
/** `Standard` Creates a record type */
|
|
312
|
+
Record<K extends TRecordKey, T extends TSchema>(key: K, value: T, options?: ObjectOptions): TRecord<K, T>;
|
|
313
|
+
/** `Standard` Creates a keyof type from the given object */
|
|
314
|
+
KeyOf<T extends TObject<TProperties> | TRef<TObject<TProperties>>>(object: T, options?: CustomOptions): TKeyOf<SelectablePropertyKeys<T>[]>;
|
|
315
|
+
/** `Standard` Makes all properties in the given object type required */
|
|
316
|
+
Required<T extends TObject<TProperties> | TRef<TObject<TProperties>>>(object: T, options?: ObjectOptions): TObject<StaticRequired<T['properties']>>;
|
|
317
|
+
/** `Standard` Makes all properties in the given object type optional */
|
|
318
|
+
Partial<T extends TObject<TProperties> | TRef<TObject<TProperties>>>(object: T, options?: ObjectOptions): TObject<StaticPartial<T['properties']>>;
|
|
319
|
+
/** `Standard` Picks property keys from the given object type */
|
|
320
|
+
Pick<T extends TObject<TProperties> | TRef<TObject<TProperties>>, K extends SelectablePropertyKeys<T>[]>(object: T, keys: [...K], options?: ObjectOptions): TObject<Pick<SelectableProperties<T>, K[number]>>;
|
|
321
|
+
/** `Standard` Omits property keys from the given object type */
|
|
322
|
+
Omit<T extends TObject<TProperties> | TRef<TObject<TProperties>>, K extends SelectablePropertyKeys<T>[]>(object: T, keys: [...K], options?: ObjectOptions): TObject<Omit<SelectableProperties<T>, K[number]>>;
|
|
323
|
+
/** `Standard` Omits the `kind` and `modifier` properties from the underlying schema */
|
|
289
324
|
Strict<T extends TSchema>(schema: T, options?: CustomOptions): T;
|
|
290
|
-
/** `
|
|
291
|
-
Constructor<T extends TSchema[], U extends TSchema>(args: [...T], returns: U, options?: CustomOptions): TConstructor<
|
|
292
|
-
/** `
|
|
293
|
-
Function<T extends TSchema[], U extends TSchema>(args: [...T], returns: U, options?: CustomOptions): TFunction<
|
|
294
|
-
/** `
|
|
295
|
-
Promise<T extends TSchema>(item: T, options?: CustomOptions): TPromise<
|
|
296
|
-
/** `
|
|
325
|
+
/** `Extended` Creates a constructor type */
|
|
326
|
+
Constructor<T extends TSchema[], U extends TSchema>(args: [...T], returns: U, options?: CustomOptions): TConstructor<T, U>;
|
|
327
|
+
/** `Extended` Creates a function type */
|
|
328
|
+
Function<T extends TSchema[], U extends TSchema>(args: [...T], returns: U, options?: CustomOptions): TFunction<T, U>;
|
|
329
|
+
/** `Extended` Creates a promise type */
|
|
330
|
+
Promise<T extends TSchema>(item: T, options?: CustomOptions): TPromise<T>;
|
|
331
|
+
/** `Extended` Creates a undefined type */
|
|
297
332
|
Undefined(options?: CustomOptions): TUndefined;
|
|
298
|
-
/** `
|
|
333
|
+
/** `Extended` Creates a void type */
|
|
299
334
|
Void(options?: CustomOptions): TVoid;
|
|
300
|
-
/** `
|
|
335
|
+
/** `Standard` Creates a namespace for a set of related types */
|
|
336
|
+
Namespace<T extends TDefinitions>($defs: T, options?: CustomOptions): TNamespace<T>;
|
|
337
|
+
/** `Standard` References a type within a namespace. The referenced namespace must specify an `$id` */
|
|
338
|
+
Ref<T extends TNamespace<TDefinitions>, K extends keyof T['$defs']>(namespace: T, key: K): TRef<T['$defs'][K]>;
|
|
339
|
+
/** `Standard` References type. The referenced type must specify an `$id` */
|
|
340
|
+
Ref<T extends TSchema>(schema: T): TRef<T>;
|
|
341
|
+
/** `Experimental` Creates a recursive type */
|
|
301
342
|
Rec<T extends TSchema>(callback: (self: TAny) => T, options?: CustomOptions): T;
|
|
302
|
-
/**
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
Ref<T extends TNamespace<TDefinitions>, K extends keyof T['definitions']>(box: T, key: K): T['definitions'][K];
|
|
307
|
-
/** `experimental` References type. The referenced type must specify an `$id` */
|
|
308
|
-
Ref<T extends TSchema>(schema: T): T;
|
|
343
|
+
/** Conditionally stores and schema if it contains an $id and returns. */
|
|
344
|
+
protected Store(schema: any): any;
|
|
345
|
+
/** Conditionally dereferences a schema if RefKind. Otherwise return argument. */
|
|
346
|
+
protected Deref(schema: any): any;
|
|
309
347
|
}
|
|
310
348
|
export declare const Type: TypeBuilder;
|