@sinclair/typebox 0.26.0-dev.4 → 0.26.0-dev.5

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/readme.md CHANGED
@@ -676,7 +676,7 @@ const BooleanVector = Vector(Type.Boolean()) // const BooleanVector = {
676
676
 
677
677
  ### Reference Types
678
678
 
679
- Reference types are supported with `Type.Ref(...)`. Use `Type.Deref(...)` to dereference a type.
679
+ Reference types are supported with `Type.Ref(...)`.
680
680
 
681
681
  ```typescript
682
682
  const T = Type.String({ $id: 'T' }) // const T = {
@@ -687,11 +687,6 @@ const T = Type.String({ $id: 'T' }) // const T = {
687
687
  const R = Type.Ref(T) // const R = {
688
688
  // $ref: 'T'
689
689
  // }
690
-
691
- const U = Type.Deref(R) // const U = {
692
- // $id: 'T',
693
- // type: 'string'
694
- // }
695
690
  ```
696
691
 
697
692
  <a name='types-recursive'></a>
@@ -1222,33 +1217,37 @@ For additional comparative benchmarks, please refer to [typescript-runtime-type-
1222
1217
  This benchmark measures compilation performance for varying types. You can review this benchmark [here](https://github.com/sinclairzx81/typebox/blob/master/benchmark/measurement/module/compile.ts).
1223
1218
 
1224
1219
  ```typescript
1225
- ┌──────────────────┬────────────┬──────────────┬──────────────┬──────────────┐
1226
- (index) │ Iterations │ Ajv │ TypeCompiler │ Performance │
1227
- ├──────────────────┼────────────┼──────────────┼──────────────┼──────────────┤
1228
- Number2000 │ ' 451 ms' │ ' 16 ms' │ ' 28.19 x' │
1229
- String2000 │ ' 338 ms' │ ' 14 ms' │ ' 24.14 x' │
1230
- Boolean2000 │ ' 297 ms' │ ' 13 ms' │ ' 22.85 x' │
1231
- Null2000 │ ' 265 ms' │ ' 8 ms' │ ' 33.13 x' │
1232
- RegEx2000 │ ' 492 ms' │ ' 18 ms' │ ' 27.33 x' │
1233
- ObjectA 2000 │ ' 2744 ms' │ ' 55 ms' │ ' 49.89 x' │
1234
- ObjectB2000 │ ' 3005 ms' │ ' 44 ms' │ ' 68.30 x' │
1235
- Tuple 2000 │ ' 1283 ms' │ ' 26 ms' │ ' 49.35 x' │
1236
- Union2000 │ ' 1263 ms' │ ' 27 ms' │ ' 46.78 x' │
1237
- Vector42000 │ ' 1622 ms' │ ' 23 ms' │ ' 70.52 x' │
1238
- Matrix42000 │ ' 888 ms' │ ' 12 ms' │ ' 74.00 x' │
1239
- Literal_String2000 │ ' 344 ms' │ ' 14 ms' │ ' 24.57 x' │
1240
- Literal_Number2000 │ ' 389 ms' │ ' 8 ms' │ ' 48.63 x' │
1241
- Literal_Boolean2000 │ ' 374 ms' │ ' 9 ms' │ ' 41.56 x' │
1242
- Array_Number2000 │ ' 710 ms' │ ' 12 ms' │ ' 59.17 x' │
1243
- Array_String2000 │ ' 739 ms' │ ' 9 ms' │ ' 82.11 x' │
1244
- Array_Boolean2000 │ ' 732 ms' │ ' 7 ms' │ ' 104.57 x' │
1245
- Array_ObjectA2000 │ ' 3733 ms' │ ' 42 ms' │ ' 88.88 x' │
1246
- Array_ObjectB 2000 │ ' 3602 ms' │ ' 42 ms' │ ' 85.76 x' │
1247
- Array_Tuple2000 │ ' 2204 ms' │ ' 20 ms' │ ' 110.20 x' │
1248
- Array_Union2000 │ ' 1533 ms' │ ' 24 ms' │ ' 63.88 x' │
1249
- Array_Vector42000 │ ' 2263 ms' │ ' 21 ms' │ ' 107.76 x' │
1250
- Array_Matrix42000 │ ' 1576 ms' │ ' 14 ms' │ ' 112.57 x' │
1251
- └──────────────────┴────────────┴──────────────┴──────────────┴──────────────┘
1220
+ ┌────────────────────────────┬────────────┬──────────────┬──────────────┬──────────────┐
1221
+ (index) │ Iterations │ Ajv │ TypeCompiler │ Performance │
1222
+ ├────────────────────────────┼────────────┼──────────────┼──────────────┼──────────────┤
1223
+ Literal_String 1000 │ ' 252 ms' │ ' 8 ms' │ ' 31.50 x' │
1224
+ Literal_Number 1000 │ ' 198 ms' │ ' 5 ms' │ ' 39.60 x' │
1225
+ Literal_Boolean 1000 │ ' 183 ms' │ ' 6 ms' │ ' 30.50 x' │
1226
+ Primitive_Number 1000 │ ' 172 ms' │ ' 12 ms' │ ' 14.33 x' │
1227
+ Primitive_String 1000 │ ' 156 ms' │ ' 10 ms' │ ' 15.60 x' │
1228
+ Primitive_Boolean1000 │ ' 137 ms' │ ' 10 ms' │ ' 13.70 x' │
1229
+ Primitive_Null 1000 │ ' 118 ms' │ ' 7 ms' │ ' 16.86 x' │
1230
+ Primitive_RegEx1000 │ ' 235 ms' │ ' 11 ms' │ ' 21.36 x' │
1231
+ Object_Unconstrained 1000 │ ' 1183 ms' │ ' 39 ms' │ ' 30.33 x' │
1232
+ Object_Constrained 1000 │ ' 1164 ms' │ ' 35 ms' │ ' 33.26 x' │
1233
+ Tuple_Primitive 1000 │ ' 470 ms' │ ' 16 ms' │ ' 29.38 x' │
1234
+ Tuple_Object 1000 │ ' 1096 ms' │ ' 17 ms' │ ' 64.47 x' │
1235
+ Composite_Intersect 1000 │ ' 570 ms' │ ' 21 ms' │ ' 27.14 x' │
1236
+ Composite_Union 1000 │ ' 523 ms' │ ' 21 ms' │ ' 24.90 x' │
1237
+ Math_Vector4 1000 │ ' 788 ms' │ ' 12 ms' │ ' 65.67 x' │
1238
+ Math_Matrix4 1000 │ ' 389 ms' │ ' 12 ms' │ ' 32.42 x' │
1239
+ Array_Primitive_Number 1000 │ ' 291 ms' │ ' 6 ms' │ ' 48.50 x' │
1240
+ Array_Primitive_String 1000 │ ' 313 ms' │ ' 4 ms' │ ' 78.25 x' │
1241
+ Array_Primitive_Boolean1000 │ ' 357 ms' │ ' 3 ms' │ ' 119.00 x' │
1242
+ Array_Object_Unconstrained 1000 │ ' 1551 ms' │ ' 19 ms' │ ' 81.63 x' │
1243
+ Array_Object_Constrained 1000 │ ' 1258 ms' │ ' 20 ms' │ ' 62.90 x' │
1244
+ Array_Tuple_Primitive 1000 │ ' 951 ms' │ ' 15 ms' │ ' 63.40 x' │
1245
+ Array_Tuple_Object 1000 │ ' 1157 ms' │ ' 14 ms' │ ' 82.64 x' │
1246
+ │ Array_Composite_Intersect │ 1000 │ ' 856 ms' │ ' 19 ms' │ ' 45.05 x' │
1247
+ │ Array_Composite_Union │ 1000 │ ' 1073 ms' │ ' 16 ms' │ ' 67.06 x' │
1248
+ │ Array_Math_Vector4 │ 1000 │ ' 1062 ms' │ ' 11 ms' │ ' 96.55 x' │
1249
+ │ Array_Math_Matrix4 │ 1000 │ ' 478 ms' │ ' 6 ms' │ ' 79.67 x' │
1250
+ └────────────────────────────┴────────────┴──────────────┴──────────────┴──────────────┘
1252
1251
  ```
1253
1252
 
1254
1253
  <a name='benchmark-validate'></a>
@@ -1258,35 +1257,39 @@ This benchmark measures compilation performance for varying types. You can revie
1258
1257
  This benchmark measures validation performance for varying types. You can review this benchmark [here](https://github.com/sinclairzx81/typebox/blob/master/benchmark/measurement/module/check.ts).
1259
1258
 
1260
1259
  ```typescript
1261
- ┌──────────────────┬────────────┬──────────────┬──────────────┬──────────────┬──────────────┐
1262
- (index) │ Iterations │ ValueCheck │ Ajv │ TypeCompiler │ Performance │
1263
- ├──────────────────┼────────────┼──────────────┼──────────────┼──────────────┼──────────────┤
1264
- Number │ 1000000 │ ' 30 ms' │ ' 7 ms' │ ' 6 ms' │ ' 1.17 x' │
1265
- String │ 1000000 │ ' 23 ms' │ ' 21 ms' │ ' 11 ms' │ ' 1.91 x' │
1266
- Boolean │ 1000000 │ ' 22 ms' │ ' 21 ms' │ ' 10 ms' │ ' 2.10 x' │
1267
- Null │ 1000000 │ ' 27 ms' │ ' 20 ms' │ ' 10 ms' │ ' 2.00 x' │
1268
- RegEx │ 1000000 │ ' 163 ms' │ ' 47 ms' │ ' 38 ms' │ ' 1.24 x' │
1269
- ObjectA │ 1000000 │ ' 654 ms' │ ' 41 ms' │ ' 24 ms' │ ' 1.71 x' │
1270
- ObjectB │ 1000000 │ ' 1173 ms' │ ' 59 ms' │ ' 41 ms' │ ' 1.44 x' │
1271
- Tuple │ 1000000 │ ' 124 ms' │ ' 24 ms' │ ' 17 ms' │ ' 1.41 x' │
1272
- Union │ 1000000 │ ' 332 ms' │ ' 26 ms' │ ' 16 ms' │ ' 1.63 x' │
1273
- Recursive │ 1000000 │ ' 3129 ms' │ ' 412 ms' │ ' 102 ms' │ ' 4.04 x' │
1274
- Vector4 │ 1000000 │ ' 147 ms' │ ' 26 ms' │ ' 13 ms' │ ' 2.00 x' │
1275
- Matrix4 │ 1000000 │ ' 576 ms' │ ' 41 ms' │ ' 28 ms' │ ' 1.46 x' │
1276
- Literal_String │ 1000000 │ ' 51 ms' │ ' 21 ms' │ ' 10 ms' │ ' 2.10 x' │
1277
- Literal_Number │ 1000000 │ ' 47 ms' │ ' 21 ms' │ ' 11 ms' │ ' 1.91 x' │
1278
- Literal_Boolean │ 1000000 │ ' 47 ms' │ ' 21 ms' │ ' 10 ms' │ ' 2.10 x' │
1279
- Array_Number │ 1000000 │ ' 490 ms' │ ' 33 ms' │ ' 18 ms' │ ' 1.83 x' │
1280
- Array_String │ 1000000 │ ' 502 ms' │ ' 31 ms' │ ' 25 ms' │ ' 1.24 x' │
1281
- Array_Boolean │ 1000000 │ ' 465 ms' │ ' 33 ms' │ ' 27 ms' │ ' 1.22 x' │
1282
- Array_ObjectA │ 1000000 │ ' 15463 ms' │ ' 2470 ms' │ ' 2052 ms' │ ' 1.20 x' │
1283
- Array_ObjectB │ 1000000 │ ' 18047 ms' │ ' 2497 ms' │ ' 2348 ms' │ ' 1.06 x' │
1284
- Array_Tuple │ 1000000 │ ' 1958 ms' │ ' 99 ms' │ ' 77 ms' │ ' 1.29 x' │
1285
- Array_Union │ 1000000 │ ' 5348 ms' │ ' 254 ms' │ ' 89 ms' │ ' 2.85 x' │
1286
- Array_Recursive │ 1000000 │ ' 54643 ms' │ ' 8870 ms' │ ' 1158 ms' │ ' 7.66 x' │
1287
- Array_Vector4 │ 1000000 │ ' 2724 ms' │ ' 105 ms' │ ' 48 ms' │ ' 2.19 x' │
1288
- Array_Matrix4 │ 1000000 │ ' 13821 ms' │ ' 437 ms' │ ' 266 ms' │ ' 1.64 x' │
1289
- └──────────────────┴────────────┴──────────────┴──────────────┴──────────────┴──────────────┘
1260
+ ┌────────────────────────────┬────────────┬──────────────┬──────────────┬──────────────┬──────────────┐
1261
+ (index) │ Iterations │ ValueCheck │ Ajv │ TypeCompiler │ Performance │
1262
+ ├────────────────────────────┼────────────┼──────────────┼──────────────┼──────────────┼──────────────┤
1263
+ Literal_String │ 1000000 │ ' 24 ms' │ ' 6 ms' │ ' 5 ms' │ ' 1.20 x' │
1264
+ Literal_Number │ 1000000 │ ' 19 ms' │ ' 19 ms' │ ' 11 ms' │ ' 1.73 x' │
1265
+ Literal_Boolean │ 1000000 │ ' 19 ms' │ ' 18 ms' │ ' 10 ms' │ ' 1.80 x' │
1266
+ Primitive_Number │ 1000000 │ ' 25 ms' │ ' 17 ms' │ ' 11 ms' │ ' 1.55 x' │
1267
+ Primitive_String │ 1000000 │ ' 23 ms' │ ' 16 ms' │ ' 10 ms' │ ' 1.60 x' │
1268
+ Primitive_Boolean │ 1000000 │ ' 19 ms' │ ' 17 ms' │ ' 10 ms' │ ' 1.70 x' │
1269
+ Primitive_Null │ 1000000 │ ' 21 ms' │ ' 17 ms' │ ' 10 ms' │ ' 1.70 x' │
1270
+ Primitive_RegEx │ 1000000 │ ' 154 ms' │ ' 45 ms' │ ' 38 ms' │ ' 1.18 x' │
1271
+ Object_Unconstrained │ 1000000 │ ' 837 ms' │ ' 34 ms' │ ' 29 ms' │ ' 1.17 x' │
1272
+ Object_Constrained │ 1000000 │ ' 1045 ms' │ ' 52 ms' │ ' 45 ms' │ ' 1.16 x' │
1273
+ Object_Recursive │ 1000000 │ ' 4711 ms' │ ' 355 ms' │ ' 100 ms' │ ' 3.55 x' │
1274
+ Tuple_Primitive │ 1000000 │ ' 163 ms' │ ' 21 ms' │ ' 16 ms' │ ' 1.31 x' │
1275
+ Tuple_Object │ 1000000 │ ' 668 ms' │ ' 30 ms' │ ' 26 ms' │ ' 1.15 x' │
1276
+ Composite_Intersect │ 1000000 │ ' 682 ms' │ ' 28 ms' │ ' 21 ms' │ ' 1.33 x' │
1277
+ Composite_Union │ 1000000 │ ' 463 ms' │ ' 22 ms' │ ' 19 ms' │ ' 1.16 x' │
1278
+ Math_Vector4 │ 1000000 │ ' 255 ms' │ ' 22 ms' │ ' 13 ms' │ ' 1.69 x' │
1279
+ Math_Matrix4 │ 1000000 │ ' 988 ms' │ ' 38 ms' │ ' 29 ms' │ ' 1.31 x' │
1280
+ Array_Primitive_Number │ 1000000 │ ' 270 ms' │ ' 26 ms' │ ' 15 ms' │ ' 1.73 x' │
1281
+ Array_Primitive_String │ 1000000 │ ' 207 ms' │ ' 22 ms' │ ' 16 ms' │ ' 1.38 x' │
1282
+ Array_Primitive_Boolean │ 1000000 │ ' 137 ms' │ ' 21 ms' │ ' 19 ms' │ ' 1.11 x' │
1283
+ Array_Object_Unconstrained │ 1000000 │ ' 4698 ms' │ ' 68 ms' │ ' 61 ms' │ ' 1.11 x' │
1284
+ Array_Object_Constrained │ 1000000 │ ' 4863 ms' │ ' 139 ms' │ ' 117 ms' │ ' 1.19 x' │
1285
+ Array_Object_Recursive │ 1000000 │ ' 19170 ms' │ ' 1606 ms' │ ' 332 ms' │ ' 4.84 x' │
1286
+ Array_Tuple_Primitive │ 1000000 │ ' 724 ms' │ ' 38 ms' │ ' 31 ms' │ ' 1.23 x' │
1287
+ Array_Tuple_Object │ 1000000 │ ' 2843 ms' │ ' 71 ms' │ ' 63 ms' │ ' 1.13 x' │
1288
+ │ Array_Composite_Intersect │ 1000000 │ ' 2816 ms' │ ' 49 ms' │ ' 40 ms' │ ' 1.23 x' │
1289
+ │ Array_Composite_Union │ 1000000 │ ' 2021 ms' │ ' 69 ms' │ ' 39 ms' │ ' 1.77 x' │
1290
+ │ Array_Math_Vector4 │ 1000000 │ ' 1080 ms' │ ' 39 ms' │ ' 25 ms' │ ' 1.56 x' │
1291
+ │ Array_Math_Matrix4 │ 1000000 │ ' 4561 ms' │ ' 112 ms' │ ' 96 ms' │ ' 1.17 x' │
1292
+ └────────────────────────────┴────────────┴──────────────┴──────────────┴──────────────┴──────────────┘
1290
1293
  ```
1291
1294
 
1292
1295
  <a name='benchmark-compression'></a>
@@ -1299,15 +1302,11 @@ The following table lists esbuild compiled and minified sizes for each TypeBox m
1299
1302
  ┌──────────────────────┬────────────┬────────────┬─────────────┐
1300
1303
  │ (index) │ Compiled │ Minified │ Compression │
1301
1304
  ├──────────────────────┼────────────┼────────────┼─────────────┤
1302
- │ typebox/compiler │ ' 65.4 kb' │ ' 32.2 kb' │ '2.03 x' │
1303
- │ typebox/conditional │ ' 45.5 kb' │ ' 18.6 kb' │ '2.45 x' │
1304
- │ typebox/custom │ ' 0.6 kb' │ ' 0.2 kb' │ '2.61 x' │
1305
- │ typebox/format │ ' 0.6 kb' │ ' 0.2 kb' │ '2.66 x' │
1306
- │ typebox/guard │ ' 23.8 kb' │ ' 11.4 kb' │ '2.08 x' │
1307
- │ typebox/hash │ ' 4.2 kb' │ ' 1.8 kb' │ '2.30 x' │
1308
- │ typebox/system │ ' 14.0 kb' │ ' 7.1 kb' │ '1.96 x' │
1309
- │ typebox/value │ ' 90.0 kb' │ ' 41.8 kb' │ '2.15 x' │
1310
- │ typebox │ ' 12.0 kb' │ ' 6.4 kb' │ '1.89 x' │
1305
+ │ typebox/compiler │ '108.2 kb' │ ' 48.5 kb' │ '2.23 x' │
1306
+ │ typebox/errors │ ' 92.9 kb' │ ' 41.4 kb' │ '2.24 x' │
1307
+ │ typebox/system │ ' 59.7 kb' │ ' 24.5 kb' │ '2.43 x' │
1308
+ │ typebox/value │ '153.3 kb' │ ' 66.6 kb' │ '2.30 x' │
1309
+ │ typebox │ ' 58.7 kb' │ ' 24.1 kb' │ '2.43 x' │
1311
1310
  └──────────────────────┴────────────┴────────────┴─────────────┘
1312
1311
  ```
1313
1312
 
package/typebox.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export declare const Recursive: unique symbol;
2
1
  export declare const Modifier: unique symbol;
3
2
  export declare const Hint: unique symbol;
4
3
  export declare const Kind: unique symbol;
@@ -27,7 +26,7 @@ export type TReadonlyOptional<T extends TSchema> = T & {
27
26
  export interface SchemaOptions {
28
27
  $schema?: string;
29
28
  /** Id for this schema */
30
- readonly $id?: string;
29
+ $id?: string;
31
30
  /** Title of this schema */
32
31
  title?: string;
33
32
  /** Description of this schema */
@@ -43,7 +42,6 @@ export interface TKind {
43
42
  }
44
43
  export interface TSchema extends SchemaOptions, TKind {
45
44
  [Modifier]?: string;
46
- [Recursive]?: string;
47
45
  [Hint]?: string;
48
46
  params: unknown[];
49
47
  static: unknown;
@@ -84,7 +82,6 @@ export interface TBoolean extends TSchema {
84
82
  type: 'boolean';
85
83
  }
86
84
  export type TConstructorParameters<T extends TConstructor<TSchema[], TSchema>> = TTuple<T['parameters']>;
87
- export type TDeref<T> = T extends TRef<infer U> ? TDeref<U> : T;
88
85
  export type TInstanceType<T extends TConstructor<TSchema[], TSchema>> = T['returns'];
89
86
  export type TCompositeUnion<Left extends TSchema, Right extends TSchema> = Ensure<TUnion<[Left, Right]>>;
90
87
  export type TCompositeMerge<T extends TObject, Output extends Record<any, TSchema>> = Evaluate<{
@@ -93,7 +90,7 @@ export type TCompositeMerge<T extends TObject, Output extends Record<any, TSchem
93
90
  [Key in keyof Output]: Key extends keyof T['properties'] ? TCompositeUnion<T['properties'][Key], Output[Key]> : Output[Key];
94
91
  }>;
95
92
  export type TCompositeReduce<T extends TObject[], Output extends {}> = T extends [infer L, ...infer R] ? TCompositeReduce<[...Assert<R, TObject[]>], TCompositeMerge<Assert<L, TObject>, Output>> : T extends [] ? Output : never;
96
- export type TComposite<T extends TObject[]> = Ensure<TObject<TCompositeReduce<T, {}>>>;
93
+ export type TComposite<T extends TObject[] = TObject[]> = Ensure<TObject<TCompositeReduce<T, {}>>>;
97
94
  export type TConstructorParameterArray<T extends readonly TSchema[], P extends unknown[]> = [...{
98
95
  [K in keyof T]: Static<Assert<T[K], TSchema>, P>;
99
96
  }];
@@ -170,9 +167,9 @@ export type TKeyOfTuple<T extends TSchema> = {
170
167
  } extends infer U ? UnionToTuple<Exclude<{
171
168
  [K in keyof U]: U[K];
172
169
  }[keyof U], undefined>> : never;
173
- export type TKeyOf<T extends TSchema = TSchema, D = TDeref<T>> = (D extends TIntersect ? TKeyOfTuple<T> : D extends TUnion ? TKeyOfTuple<T> : D extends TObject ? TKeyOfTuple<T> : [
170
+ export type TKeyOf<T extends TSchema = TSchema> = (T extends TIntersect ? TKeyOfTuple<T> : T extends TUnion ? TKeyOfTuple<T> : T extends TObject ? TKeyOfTuple<T> : [
174
171
  ]) extends infer R ? TUnionResult<Assert<R, TSchema[]>> : never;
175
- export type TLiteralValue = string | number | boolean | bigint;
172
+ export type TLiteralValue = string | number | boolean;
176
173
  export interface TLiteral<T extends TLiteralValue = TLiteralValue> extends TSchema {
177
174
  [Kind]: 'Literal';
178
175
  static: T;
@@ -242,7 +239,7 @@ export type TOmitArray<T extends TSchema[], K extends keyof any> = Assert<{
242
239
  [K2 in keyof T]: TOmit<Assert<T[K2], TSchema>, K>;
243
240
  }, TSchema[]>;
244
241
  export type TOmitProperties<T extends TProperties, K extends keyof any> = Evaluate<Assert<Omit<T, K>, TProperties>>;
245
- export type TOmit<T extends TSchema, K extends keyof any, D = TDeref<T>> = D extends TIntersect<infer S> ? TIntersect<TOmitArray<S, K>> : D extends TUnion<infer S> ? TUnion<TOmitArray<S, K>> : D extends TObject<infer S> ? TObject<TOmitProperties<S, K>> : D;
242
+ export type TOmit<T extends TSchema, K extends keyof any> = T extends TIntersect<infer S> ? TIntersect<TOmitArray<S, K>> : T extends TUnion<infer S> ? TUnion<TOmitArray<S, K>> : T extends TObject<infer S> ? TObject<TOmitProperties<S, K>> : T;
246
243
  export type TParameters<T extends TFunction> = TTuple<T['parameters']>;
247
244
  export type TPartialArray<T extends TSchema[]> = Assert<{
248
245
  [K in keyof T]: TPartial<Assert<T[K], TSchema>>;
@@ -250,14 +247,14 @@ export type TPartialArray<T extends TSchema[]> = Assert<{
250
247
  export type TPartialProperties<T extends TProperties> = Evaluate<Assert<{
251
248
  [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]>;
252
249
  }, TProperties>>;
253
- export type TPartial<T extends TSchema, D = TDeref<T>> = D extends TIntersect<infer S> ? TIntersect<TPartialArray<S>> : D extends TUnion<infer S> ? TUnion<TPartialArray<S>> : D extends TObject<infer S> ? TObject<TPartialProperties<S>> : D;
250
+ export type TPartial<T extends TSchema> = T extends TIntersect<infer S> ? TIntersect<TPartialArray<S>> : T extends TUnion<infer S> ? TUnion<TPartialArray<S>> : T extends TObject<infer S> ? TObject<TPartialProperties<S>> : T;
254
251
  export type TPickArray<T extends TSchema[], K extends keyof any> = {
255
252
  [K2 in keyof T]: TPick<Assert<T[K2], TSchema>, K>;
256
253
  };
257
254
  export type TPickProperties<T extends TProperties, K extends keyof any> = Pick<T, Assert<Extract<K, keyof T>, keyof T>> extends infer R ? ({
258
255
  [K in keyof R]: Assert<R[K], TSchema> extends TSchema ? R[K] : never;
259
256
  }) : never;
260
- export type TPick<T extends TSchema, K extends keyof any, D = TDeref<T>> = D extends TIntersect<infer S> ? TIntersect<TPickArray<S, K>> : D extends TUnion<infer S> ? TUnion<TPickArray<S, K>> : D extends TObject<infer S> ? TObject<TPickProperties<S, K>> : D;
257
+ export type TPick<T extends TSchema, K extends keyof any> = T extends TIntersect<infer S> ? TIntersect<TPickArray<S, K>> : T extends TUnion<infer S> ? TUnion<TPickArray<S, K>> : T extends TObject<infer S> ? TObject<TPickProperties<S, K>> : T;
261
258
  export type TPromiseStatic<T extends TSchema, P extends unknown[]> = Promise<Static<T, P>>;
262
259
  export interface TPromise<T extends TSchema = TSchema> extends TSchema {
263
260
  [Kind]: 'Promise';
@@ -305,7 +302,7 @@ export type TRequiredArray<T extends TSchema[]> = Assert<{
305
302
  export type TRequiredProperties<T extends TProperties> = Evaluate<Assert<{
306
303
  [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];
307
304
  }, TProperties>>;
308
- export type TRequired<T extends TSchema, D = TDeref<T>> = D extends TIntersect<infer S> ? TIntersect<TRequiredArray<S>> : D extends TUnion<infer S> ? TUnion<TRequiredArray<S>> : D extends TObject<infer S> ? TObject<TRequiredProperties<S>> : D;
305
+ export type TRequired<T extends TSchema> = T extends TIntersect<infer S> ? TIntersect<TRequiredArray<S>> : T extends TUnion<infer S> ? TUnion<TRequiredArray<S>> : T extends TObject<infer S> ? TObject<TRequiredProperties<S>> : T;
309
306
  export type StringFormatOption = 'date-time' | 'time' | 'date' | 'email' | 'idn-email' | 'hostname' | 'idn-hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'iri' | 'uuid' | 'iri-reference' | 'uri-template' | 'json-pointer' | 'relative-json-pointer' | 'regex';
310
307
  export interface StringOptions<Format extends string> extends SchemaOptions {
311
308
  minLength?: number;
@@ -391,6 +388,8 @@ export type Static<T extends TSchema, P extends unknown[] = []> = (T & {
391
388
  })['static'];
392
389
  export type TypeRegistryValidationFunction<TSchema> = (schema: TSchema, value: unknown) => boolean;
393
390
  export declare namespace TypeRegistry {
391
+ /** Returns the entries in this registry */
392
+ function Entries(): Map<string, TypeRegistryValidationFunction<any>>;
394
393
  /** Clears all user defined types */
395
394
  function Clear(): void;
396
395
  /** Returns true if this registry contains this kind */
@@ -400,21 +399,11 @@ export declare namespace TypeRegistry {
400
399
  /** Gets a custom validation function for a user defined type */
401
400
  function Get(kind: string): TypeRegistryValidationFunction<any> | undefined;
402
401
  }
403
- export declare namespace ReferenceRegistry {
404
- /** Clears the reference registry */
405
- function Clear(): void;
406
- /** Returns true if this registry contains this schema */
407
- function Has(schema: TSchema): boolean;
408
- /** Sets this schema on this registry if a $id exists */
409
- function Set(schema: TSchema): void;
410
- /** Dereferences the schema one level deep */
411
- function DerefOne(schema: TSchema): TSchema;
412
- /** Dereferences the schema recursively */
413
- function Deref(schema: TSchema): TSchema;
414
- }
415
402
  export type FormatRegistryValidationFunction = (value: string) => boolean;
416
403
  /** Provides functions to create user defined string formats */
417
404
  export declare namespace FormatRegistry {
405
+ /** Returns the entries in this registry */
406
+ function Entries(): Map<string, FormatRegistryValidationFunction>;
418
407
  /** Clears all user defined string formats */
419
408
  function Clear(): void;
420
409
  /** Returns true if the user defined string format exists */
@@ -496,8 +485,8 @@ export declare namespace TypeGuard {
496
485
  /** Returns true if the given schema is TSchema */
497
486
  function TSchema(schema: unknown): schema is TSchema;
498
487
  }
488
+ /** Fast undefined check used for properties of type undefined */
499
489
  export declare namespace ExtendsUndefined {
500
- /** Fast undefined check for properties of type undefined */
501
490
  function Check(schema: TSchema): boolean;
502
491
  }
503
492
  export declare enum TypeExtendsResult {
@@ -508,7 +497,7 @@ export declare enum TypeExtendsResult {
508
497
  export declare namespace TypeExtends {
509
498
  function Extends(left: TSchema, right: TSchema): TypeExtendsResult;
510
499
  }
511
- /** Specialized Clone for Types. Clones and removes non self-referential identifiers */
500
+ /** Specialized Clone for Types */
512
501
  export declare namespace TypeClone {
513
502
  /** Clones a type. This function will omit non-self referential identifiers on the cloned type. */
514
503
  function Clone<T extends TSchema>(schema: T, options: SchemaOptions): T;
@@ -539,9 +528,9 @@ export declare class StandardTypeBuilder extends TypeBuilder {
539
528
  /** `[Standard]` Creates a Boolean type */
540
529
  Boolean(options?: SchemaOptions): TBoolean;
541
530
  /** `[Standard]` Creates a Composite object type that will Union any overlapping properties of the given Object array */
531
+ Composite<T extends TIntersect<TObject[]>>(schema: T, options?: ObjectOptions): TComposite<T['allOf']>;
532
+ /** `[Standard]` Creates a Composite object type that will Union any overlapping properties of the given Object array */
542
533
  Composite<T extends TObject[]>(schemas: [...T], options?: ObjectOptions): TComposite<T>;
543
- /** `[Standard]` Dereferences the given TRef to its target type */
544
- Deref<T extends TRef>(schema: T): TDeref<T>;
545
534
  /** `[Standard]` Creates a Enum type */
546
535
  Enum<T extends Record<string, string | number>>(item: T, options?: SchemaOptions): TEnum<T>;
547
536
  /** `[Standard]` A conditional type expression that will return the true type if the left type extends the right */