@sinclair/typebox 0.32.0-dev-14 → 0.32.0-dev-15

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.
Files changed (166) hide show
  1. package/build/import/index.d.mts +10 -10
  2. package/build/import/index.mjs +3 -3
  3. package/build/import/type/exclude/exclude-from-mapped-result.d.mts +13 -0
  4. package/build/import/type/exclude/exclude-from-mapped-result.mjs +14 -0
  5. package/build/import/type/exclude/exclude.d.mts +4 -1
  6. package/build/import/type/exclude/exclude.mjs +10 -4
  7. package/build/import/type/exclude/index.d.mts +1 -0
  8. package/build/import/type/exclude/index.mjs +1 -0
  9. package/build/import/type/extends/extends-from-mapped-key.d.mts +17 -0
  10. package/build/import/type/extends/extends-from-mapped-key.mjs +21 -0
  11. package/build/import/type/extends/extends-from-mapped-result.d.mts +13 -0
  12. package/build/import/type/extends/extends-from-mapped-result.mjs +14 -0
  13. package/build/import/type/extends/extends.d.mts +4 -4
  14. package/build/import/type/extends/extends.mjs +4 -4
  15. package/build/import/type/extends/index.d.mts +2 -2
  16. package/build/import/type/extends/index.mjs +2 -2
  17. package/build/import/type/extract/extract-from-mapped-result.d.mts +13 -0
  18. package/build/import/type/extract/extract-from-mapped-result.mjs +14 -0
  19. package/build/import/type/extract/extract.d.mts +3 -0
  20. package/build/import/type/extract/extract.mjs +9 -3
  21. package/build/import/type/extract/index.d.mts +1 -0
  22. package/build/import/type/extract/index.mjs +1 -0
  23. package/build/import/type/indexed/index.d.mts +1 -1
  24. package/build/import/type/indexed/index.mjs +1 -1
  25. package/build/import/type/indexed/{indexed-mapped-result.d.mts → indexed-from-mapped-key.d.mts} +6 -6
  26. package/build/import/type/indexed/indexed-from-mapped-key.mjs +18 -0
  27. package/build/import/type/indexed/indexed-result.d.mts +2 -2
  28. package/build/import/type/indexed/indexed-result.mjs +3 -2
  29. package/build/import/type/indexed/indexed.d.mts +2 -2
  30. package/build/import/type/indexed/indexed.mjs +4 -4
  31. package/build/import/type/intrinsic/capitalize.mjs +1 -2
  32. package/build/import/type/intrinsic/index.d.mts +1 -1
  33. package/build/import/type/intrinsic/index.mjs +1 -1
  34. package/build/import/type/intrinsic/{intrinsic-mapped-result.d.mts → intrinsic-from-mapped-key.d.mts} +6 -5
  35. package/build/import/type/intrinsic/intrinsic-from-mapped-key.mjs +21 -0
  36. package/build/import/type/intrinsic/intrinsic.d.mts +6 -6
  37. package/build/import/type/intrinsic/intrinsic.mjs +8 -8
  38. package/build/import/type/intrinsic/lowercase.mjs +1 -2
  39. package/build/import/type/intrinsic/uncapitalize.mjs +1 -2
  40. package/build/import/type/intrinsic/uppercase.mjs +1 -2
  41. package/build/import/type/keyof/index.d.mts +1 -0
  42. package/build/import/type/keyof/index.mjs +1 -0
  43. package/build/import/type/keyof/keyof-from-mapped-result.d.mts +13 -0
  44. package/build/import/type/keyof/keyof-from-mapped-result.mjs +14 -0
  45. package/build/import/type/keyof/keyof.d.mts +3 -0
  46. package/build/import/type/keyof/keyof.mjs +9 -2
  47. package/build/import/type/omit/index.d.mts +1 -1
  48. package/build/import/type/omit/index.mjs +1 -1
  49. package/build/import/type/omit/omit-from-mapped-key.d.mts +15 -0
  50. package/build/import/type/omit/omit-from-mapped-key.mjs +20 -0
  51. package/build/import/type/omit/omit.d.mts +2 -2
  52. package/build/import/type/omit/omit.mjs +2 -2
  53. package/build/import/type/partial/index.d.mts +1 -0
  54. package/build/import/type/partial/index.mjs +1 -0
  55. package/build/import/type/partial/partial-from-mapped-result.d.mts +13 -0
  56. package/build/import/type/partial/partial-from-mapped-result.mjs +14 -0
  57. package/build/import/type/partial/partial.d.mts +5 -2
  58. package/build/import/type/partial/partial.mjs +11 -5
  59. package/build/import/type/pick/index.d.mts +1 -1
  60. package/build/import/type/pick/index.mjs +1 -1
  61. package/build/import/type/pick/pick-from-mapped-key.d.mts +15 -0
  62. package/build/import/type/pick/pick-from-mapped-key.mjs +20 -0
  63. package/build/import/type/pick/pick.d.mts +2 -2
  64. package/build/import/type/pick/pick.mjs +2 -2
  65. package/build/import/type/required/index.d.mts +1 -0
  66. package/build/import/type/required/index.mjs +1 -0
  67. package/build/import/type/required/required-from-mapped-result.d.mts +13 -0
  68. package/build/import/type/required/required-from-mapped-result.mjs +14 -0
  69. package/build/import/type/required/required.d.mts +5 -2
  70. package/build/import/type/required/required.mjs +11 -5
  71. package/build/import/type/type/json.d.mts +21 -16
  72. package/build/import/type/type/json.mjs +3 -3
  73. package/build/require/index.d.ts +10 -10
  74. package/build/require/index.js +5 -3
  75. package/build/require/type/exclude/exclude-from-mapped-result.d.ts +13 -0
  76. package/build/require/type/exclude/exclude-from-mapped-result.js +18 -0
  77. package/build/require/type/exclude/exclude.d.ts +4 -1
  78. package/build/require/type/exclude/exclude.js +9 -4
  79. package/build/require/type/exclude/index.d.ts +1 -0
  80. package/build/require/type/exclude/index.js +1 -0
  81. package/build/require/type/extends/extends-from-mapped-key.d.ts +17 -0
  82. package/build/require/type/extends/extends-from-mapped-key.js +25 -0
  83. package/build/require/type/extends/extends-from-mapped-result.d.ts +13 -0
  84. package/build/require/type/extends/extends-from-mapped-result.js +18 -0
  85. package/build/require/type/extends/extends.d.ts +4 -4
  86. package/build/require/type/extends/extends.js +4 -4
  87. package/build/require/type/extends/index.d.ts +2 -2
  88. package/build/require/type/extends/index.js +2 -2
  89. package/build/require/type/extract/extract-from-mapped-result.d.ts +13 -0
  90. package/build/require/type/extract/extract-from-mapped-result.js +18 -0
  91. package/build/require/type/extract/extract.d.ts +3 -0
  92. package/build/require/type/extract/extract.js +8 -2
  93. package/build/require/type/extract/index.d.ts +1 -0
  94. package/build/require/type/extract/index.js +1 -0
  95. package/build/require/type/indexed/index.d.ts +1 -1
  96. package/build/require/type/indexed/index.js +1 -1
  97. package/build/require/type/indexed/{indexed-mapped-result.d.ts → indexed-from-mapped-key.d.ts} +6 -6
  98. package/build/require/type/indexed/indexed-from-mapped-key.js +22 -0
  99. package/build/require/type/indexed/indexed-result.d.ts +2 -2
  100. package/build/require/type/indexed/indexed-result.js +11 -10
  101. package/build/require/type/indexed/indexed.d.ts +2 -2
  102. package/build/require/type/indexed/indexed.js +4 -4
  103. package/build/require/type/intrinsic/capitalize.js +1 -2
  104. package/build/require/type/intrinsic/index.d.ts +1 -1
  105. package/build/require/type/intrinsic/index.js +1 -1
  106. package/build/require/type/intrinsic/{intrinsic-mapped-result.d.ts → intrinsic-from-mapped-key.d.ts} +6 -5
  107. package/build/require/type/intrinsic/intrinsic-from-mapped-key.js +25 -0
  108. package/build/require/type/intrinsic/intrinsic.d.ts +6 -6
  109. package/build/require/type/intrinsic/intrinsic.js +8 -8
  110. package/build/require/type/intrinsic/lowercase.js +1 -2
  111. package/build/require/type/intrinsic/uncapitalize.js +1 -2
  112. package/build/require/type/intrinsic/uppercase.js +1 -2
  113. package/build/require/type/keyof/index.d.ts +1 -0
  114. package/build/require/type/keyof/index.js +1 -0
  115. package/build/require/type/keyof/keyof-from-mapped-result.d.ts +13 -0
  116. package/build/require/type/keyof/keyof-from-mapped-result.js +18 -0
  117. package/build/require/type/keyof/keyof.d.ts +3 -0
  118. package/build/require/type/keyof/keyof.js +9 -2
  119. package/build/require/type/omit/index.d.ts +1 -1
  120. package/build/require/type/omit/index.js +1 -1
  121. package/build/require/type/omit/omit-from-mapped-key.d.ts +15 -0
  122. package/build/require/type/omit/omit-from-mapped-key.js +24 -0
  123. package/build/require/type/omit/omit.d.ts +2 -2
  124. package/build/require/type/omit/omit.js +2 -2
  125. package/build/require/type/partial/index.d.ts +1 -0
  126. package/build/require/type/partial/index.js +1 -0
  127. package/build/require/type/partial/partial-from-mapped-result.d.ts +13 -0
  128. package/build/require/type/partial/partial-from-mapped-result.js +18 -0
  129. package/build/require/type/partial/partial.d.ts +5 -2
  130. package/build/require/type/partial/partial.js +10 -5
  131. package/build/require/type/pick/index.d.ts +1 -1
  132. package/build/require/type/pick/index.js +1 -1
  133. package/build/require/type/pick/pick-from-mapped-key.d.ts +15 -0
  134. package/build/require/type/pick/pick-from-mapped-key.js +24 -0
  135. package/build/require/type/pick/pick.d.ts +2 -2
  136. package/build/require/type/pick/pick.js +2 -2
  137. package/build/require/type/required/index.d.ts +1 -0
  138. package/build/require/type/required/index.js +1 -0
  139. package/build/require/type/required/required-from-mapped-result.d.ts +13 -0
  140. package/build/require/type/required/required-from-mapped-result.js +18 -0
  141. package/build/require/type/required/required.d.ts +5 -2
  142. package/build/require/type/required/required.js +10 -5
  143. package/build/require/type/type/json.d.ts +21 -16
  144. package/build/require/type/type/json.js +3 -3
  145. package/package.json +1 -1
  146. package/readme.md +79 -91
  147. package/build/import/type/extends/extends-mapped-result-from-result.d.mts +0 -13
  148. package/build/import/type/extends/extends-mapped-result-from-result.mjs +0 -14
  149. package/build/import/type/extends/extends-mapped-result.d.mts +0 -17
  150. package/build/import/type/extends/extends-mapped-result.mjs +0 -21
  151. package/build/import/type/indexed/indexed-mapped-result.mjs +0 -18
  152. package/build/import/type/intrinsic/intrinsic-mapped-result.mjs +0 -21
  153. package/build/import/type/omit/omit-mapped-result.d.mts +0 -15
  154. package/build/import/type/omit/omit-mapped-result.mjs +0 -20
  155. package/build/import/type/pick/pick-mapped-result.d.mts +0 -15
  156. package/build/import/type/pick/pick-mapped-result.mjs +0 -20
  157. package/build/require/type/extends/extends-mapped-result-from-result.d.ts +0 -13
  158. package/build/require/type/extends/extends-mapped-result-from-result.js +0 -18
  159. package/build/require/type/extends/extends-mapped-result.d.ts +0 -17
  160. package/build/require/type/extends/extends-mapped-result.js +0 -25
  161. package/build/require/type/indexed/indexed-mapped-result.js +0 -22
  162. package/build/require/type/intrinsic/intrinsic-mapped-result.js +0 -25
  163. package/build/require/type/omit/omit-mapped-result.d.ts +0 -15
  164. package/build/require/type/omit/omit-mapped-result.js +0 -24
  165. package/build/require/type/pick/pick-mapped-result.d.ts +0 -15
  166. package/build/require/type/pick/pick-mapped-result.js +0 -24
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PickFromMappedKey = void 0;
4
+ const index_1 = require("../mapped/index");
5
+ const pick_1 = require("./pick");
6
+ function FromPropertyKey(T, K, options) {
7
+ return {
8
+ [K]: (0, pick_1.Pick)(T, [K], options)
9
+ };
10
+ }
11
+ function FromPropertyKeys(T, K, options) {
12
+ const [LK, ...RK] = K;
13
+ return (K.length > 0
14
+ ? { ...FromPropertyKey(T, LK, options), ...FromPropertyKeys(T, RK, options) }
15
+ : {});
16
+ }
17
+ function FromMappedKey(T, K, options) {
18
+ return FromPropertyKeys(T, K.keys, options);
19
+ }
20
+ function PickFromMappedKey(T, K, options) {
21
+ const P = FromMappedKey(T, K, options);
22
+ return (0, index_1.MappedResult)(P);
23
+ }
24
+ exports.PickFromMappedKey = PickFromMappedKey;
@@ -6,7 +6,7 @@ import { type TUnion } from '../union/index';
6
6
  import { type TObject, type TProperties } from '../object/index';
7
7
  import { type TIndexPropertyKeys } from '../indexed/index';
8
8
  import { TMappedKey } from '../mapped/index';
9
- import { type TPickMappedResult } from './pick-mapped-result';
9
+ import { type TPickFromMappedKey } from './pick-from-mapped-key';
10
10
  type FromIntersect<T extends TSchema[], K extends PropertyKey[]> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [PickResolve<L, K>, ...FromIntersect<R, K>] : [];
11
11
  declare function FromIntersect<T extends TSchema[], K extends PropertyKey[]>(T: T, K: K): FromIntersect<T, K>;
12
12
  type FromUnion<T extends TSchema[], K extends PropertyKey[]> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [PickResolve<L, K>, ...FromUnion<R, K>] : [];
@@ -16,7 +16,7 @@ declare function FromProperties<T extends TProperties, K extends PropertyKey[]>(
16
16
  export type PickResolve<T extends TProperties, K extends PropertyKey[]> = T extends TRecursive<infer S> ? TRecursive<PickResolve<S, K>> : T extends TIntersect<infer S> ? TIntersect<FromIntersect<S, K>> : T extends TUnion<infer S> ? TUnion<FromUnion<S, K>> : T extends TObject<infer S> ? TObject<FromProperties<S, K>> : TObject<{}>;
17
17
  export declare function PickResolve<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K]): PickResolve<T, K>;
18
18
  export type TPick<T extends TSchema, K extends PropertyKey[]> = PickResolve<T, K>;
19
- export declare function Pick<T extends TSchema, K extends TMappedKey>(T: T, K: K): TPickMappedResult<T, K>;
19
+ export declare function Pick<T extends TSchema, K extends TMappedKey>(T: T, K: K): TPickFromMappedKey<T, K>;
20
20
  export declare function Pick<T extends TSchema, K extends TSchema, I extends PropertyKey[] = TIndexPropertyKeys<K>>(T: T, K: K, options?: SchemaOptions): TPick<T, I>;
21
21
  export declare function Pick<T extends TSchema, K extends PropertyKey[]>(T: T, K: readonly [...K], options?: SchemaOptions): TPick<T, K>;
22
22
  export {};
@@ -8,7 +8,7 @@ const index_4 = require("../indexed/index");
8
8
  const index_5 = require("../discard/index");
9
9
  const index_6 = require("../symbols/index");
10
10
  const type_1 = require("../clone/type");
11
- const pick_mapped_result_1 = require("./pick-mapped-result");
11
+ const pick_from_mapped_key_1 = require("./pick-from-mapped-key");
12
12
  const type_2 = require("../guard/type");
13
13
  function FromIntersect(T, K) {
14
14
  return T.map((T) => PickResolve(T, K));
@@ -30,7 +30,7 @@ function PickResolve(T, K) {
30
30
  exports.PickResolve = PickResolve;
31
31
  function Pick(T, K, options = {}) {
32
32
  if ((0, type_2.TMappedKey)(K)) {
33
- return (0, pick_mapped_result_1.PickMappedResult)(T, K);
33
+ return (0, pick_from_mapped_key_1.PickFromMappedKey)(T, K, options);
34
34
  }
35
35
  else {
36
36
  const I = (0, type_2.TSchema)(K) ? (0, index_4.IndexPropertyKeys)(K) : K;
@@ -1 +1,2 @@
1
+ export * from './required-from-mapped-result';
1
2
  export * from './required';
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./required-from-mapped-result"), exports);
17
18
  __exportStar(require("./required"), exports);
@@ -0,0 +1,13 @@
1
+ import type { SchemaOptions } from '../schema/index';
2
+ import type { TProperties } from '../object/index';
3
+ import { type TMappedResult } from '../mapped/index';
4
+ import { type TRequired } from './required';
5
+ type FromProperties<K extends TProperties> = ({
6
+ [K2 in keyof K]: TRequired<K[K2]>;
7
+ });
8
+ declare function FromProperties<K extends TProperties>(K: K, options: SchemaOptions): FromProperties<K>;
9
+ type FromMappedResult<K extends TMappedResult> = (FromProperties<K['properties']>);
10
+ declare function FromMappedResult<K extends TMappedResult>(K: K, options: SchemaOptions): FromMappedResult<K>;
11
+ export type TRequiredFromMappedResult<T extends TMappedResult, P extends TProperties = FromMappedResult<T>> = (TMappedResult<P>);
12
+ export declare function RequiredFromMappedResult<T extends TMappedResult, P extends TProperties = FromMappedResult<T>>(T: T, options: SchemaOptions): TMappedResult<P>;
13
+ export {};
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RequiredFromMappedResult = void 0;
4
+ const index_1 = require("../mapped/index");
5
+ const required_1 = require("./required");
6
+ function FromProperties(K, options) {
7
+ return globalThis.Object.getOwnPropertyNames(K).reduce((Acc, K2) => {
8
+ return { ...Acc, [K2]: (0, required_1.Required)(K[K2], options) };
9
+ }, {});
10
+ }
11
+ function FromMappedResult(K, options) {
12
+ return FromProperties(K.properties, options);
13
+ }
14
+ function RequiredFromMappedResult(T, options) {
15
+ const P = FromMappedResult(T, options);
16
+ return (0, index_1.MappedResult)(P);
17
+ }
18
+ exports.RequiredFromMappedResult = RequiredFromMappedResult;
@@ -1,5 +1,6 @@
1
1
  import type { TSchema, SchemaOptions } from '../schema/index';
2
2
  import type { Evaluate } from '../helpers/index';
3
+ import type { TMappedResult } from '../mapped/index';
3
4
  import { type TReadonlyOptional } from '../readonly-optional/index';
4
5
  import { type TOptional } from '../optional/index';
5
6
  import { type TReadonly } from '../readonly/index';
@@ -7,6 +8,7 @@ import { type TRecursive } from '../recursive/index';
7
8
  import { type TIntersect } from '../intersect/index';
8
9
  import { type TUnion } from '../union/index';
9
10
  import { type TObject, type TProperties } from '../object/index';
11
+ import { type TRequiredFromMappedResult } from './required-from-mapped-result';
10
12
  type FromIntersect<T extends TSchema[]> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [RequiredResolve<L>, ...FromIntersect<R>] : []);
11
13
  declare function FromIntersect<T extends TSchema[]>(T: [...T]): FromIntersect<T>;
12
14
  type FromUnion<T extends TSchema[]> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [RequiredResolve<L>, ...FromUnion<R>] : []);
@@ -15,8 +17,9 @@ type FromProperties<T extends TProperties> = Evaluate<{
15
17
  [K in keyof T]: T[K] extends (TReadonlyOptional<infer S>) ? TReadonly<S> : T[K] extends (TReadonly<infer S>) ? TReadonly<S> : T[K] extends (TOptional<infer S>) ? S : T[K];
16
18
  }>;
17
19
  declare function FromProperties<T extends TProperties>(T: T): TProperties;
18
- export type RequiredResolve<T extends TSchema> = (T extends TRecursive<infer S> ? TRecursive<RequiredResolve<S>> : T extends TIntersect<infer S> ? TIntersect<FromIntersect<S>> : T extends TUnion<infer S> ? TUnion<FromUnion<S>> : T extends TObject<infer S> ? TObject<FromProperties<S>> : TObject<{}>);
19
- export declare function RequiredResolve<T extends TSchema>(T: T): RequiredResolve<T>;
20
+ type RequiredResolve<T extends TSchema> = (T extends TRecursive<infer S> ? TRecursive<RequiredResolve<S>> : T extends TIntersect<infer S> ? TIntersect<FromIntersect<S>> : T extends TUnion<infer S> ? TUnion<FromUnion<S>> : T extends TObject<infer S> ? TObject<FromProperties<S>> : TObject<{}>);
21
+ declare function RequiredResolve<T extends TSchema>(T: T): RequiredResolve<T>;
20
22
  export type TRequired<T extends TSchema> = RequiredResolve<T>;
23
+ export declare function Required<T extends TMappedResult>(T: T, options?: SchemaOptions): TRequiredFromMappedResult<T>;
21
24
  export declare function Required<T extends TSchema>(T: T, options?: SchemaOptions): TRequired<T>;
22
25
  export {};
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Required = exports.RequiredResolve = void 0;
3
+ exports.Required = void 0;
4
4
  const index_1 = require("../intersect/index");
5
5
  const index_2 = require("../union/index");
6
6
  const index_3 = require("../object/index");
7
7
  const index_4 = require("../symbols/index");
8
8
  const type_1 = require("../clone/type");
9
9
  const index_5 = require("../discard/index");
10
+ const required_from_mapped_result_1 = require("./required-from-mapped-result");
10
11
  const type_2 = require("../guard/type");
11
12
  function FromIntersect(T) {
12
13
  const [L, ...R] = T;
@@ -31,10 +32,14 @@ function RequiredResolve(T) {
31
32
  (0, type_2.TObject)(T) ? (0, index_3.Object)(FromProperties(T.properties)) :
32
33
  (0, index_3.Object)({}));
33
34
  }
34
- exports.RequiredResolve = RequiredResolve;
35
35
  function Required(T, options = {}) {
36
- const D = (0, index_5.Discard)(T, [index_4.TransformKind, '$id', 'required']);
37
- const R = (0, type_1.CloneType)(RequiredResolve(T), options);
38
- return { ...D, ...R };
36
+ if ((0, type_2.TMappedResult)(T)) {
37
+ return (0, required_from_mapped_result_1.RequiredFromMappedResult)(T, options);
38
+ }
39
+ else {
40
+ const D = (0, index_5.Discard)(T, [index_4.TransformKind, '$id', 'required']);
41
+ const R = (0, type_1.CloneType)(RequiredResolve(T), options);
42
+ return { ...D, ...R };
43
+ }
39
44
  }
40
45
  exports.Required = Required;
@@ -5,14 +5,14 @@ import { type TComposite } from '../composite/index';
5
5
  import { type TConst } from '../const/index';
6
6
  import { type TDeref } from '../deref/index';
7
7
  import { type TEnum, type TEnumKey, type TEnumValue } from '../enum/index';
8
- import { type TExclude } from '../exclude/index';
9
- import { type TExtends, type TExtendsMappedResult, type TExtendsMappedResultFromResult } from '../extends/index';
10
- import { type TExtract } from '../extract/index';
11
- import { TIndex, type TIndexPropertyKeys, type TIndexMappedResult } from '../indexed/index';
8
+ import { type TExclude, type TExcludeFromMappedResult } from '../exclude/index';
9
+ import { type TExtends, type TExtendsFromMappedKey, type TExtendsFromMappedResult } from '../extends/index';
10
+ import { type TExtract, type TExtractFromMappedResult } from '../extract/index';
11
+ import { TIndex, type TIndexPropertyKeys, type TIndexFromMappedKey } from '../indexed/index';
12
12
  import { type IntegerOptions, type TInteger } from '../integer/index';
13
13
  import { type IntersectOptions, type IntersectResolve } from '../intersect/index';
14
14
  import { type TCapitalize, type TUncapitalize, type TLowercase, type TUppercase } from '../intrinsic/index';
15
- import { type TKeyOf } from '../keyof/index';
15
+ import { type TKeyOf, type TKeyOfFromMappedResult } from '../keyof/index';
16
16
  import { type TLiteral, type TLiteralValue } from '../literal/index';
17
17
  import { type TMappedFunction, type TMapped, type TMappedResult } from '../mapped/index';
18
18
  import { type TNever } from '../never/index';
@@ -21,16 +21,16 @@ import { type TNull } from '../null/index';
21
21
  import { type TMappedKey } from '../mapped/index';
22
22
  import { type TNumber, type NumberOptions } from '../number/index';
23
23
  import { type TObject, type TProperties, type ObjectOptions } from '../object/index';
24
- import { type TOmit, type TOmitMappedResult } from '../omit/index';
24
+ import { type TOmit, type TOmitFromMappedKey } from '../omit/index';
25
25
  import { type TOptional } from '../optional/index';
26
- import { type TPartial } from '../partial/index';
27
- import { type TPick, type TPickMappedResult } from '../pick/index';
26
+ import { type TPartial, type TPartialFromMappedResult } from '../partial/index';
27
+ import { type TPick, type TPickFromMappedKey } from '../pick/index';
28
28
  import { type TReadonly } from '../readonly/index';
29
29
  import { type TReadonlyOptional } from '../readonly-optional/index';
30
30
  import { type RecordResolve } from '../record/index';
31
31
  import { type TRecursive, type TThis } from '../recursive/index';
32
32
  import { type TRef } from '../ref/index';
33
- import { type TRequired } from '../required/index';
33
+ import { type TRequired, type TRequiredFromMappedResult } from '../required/index';
34
34
  import { type TRest } from '../rest/index';
35
35
  import { type TSchema, type SchemaOptions } from '../schema/index';
36
36
  import { type TString, type StringOptions } from '../string/index';
@@ -53,16 +53,19 @@ export declare class JsonTypeBuilder {
53
53
  Const<T>(value: T, options?: SchemaOptions): TConst<T>;
54
54
  Deref<T extends TSchema>(schema: T, references: TSchema[]): TDeref<T>;
55
55
  Enum<V extends TEnumValue, T extends Record<TEnumKey, V>>(item: T, options?: SchemaOptions): TEnum<T>;
56
- Extends<L extends TMappedResult, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsMappedResultFromResult<L, R, T, F>;
57
- Extends<L extends TMappedKey, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsMappedResult<L, R, T, F>;
58
- Extends<L extends TSchema, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtends<L, R, T, F>;
56
+ Exclude<L extends TMappedResult, R extends TSchema>(unionType: L, excludedMembers: R, options?: SchemaOptions): TExcludeFromMappedResult<L, R>;
59
57
  Exclude<L extends TSchema, R extends TSchema>(unionType: L, excludedMembers: R, options?: SchemaOptions): TExclude<L, R>;
58
+ Extends<L extends TMappedResult, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsFromMappedResult<L, R, T, F>;
59
+ Extends<L extends TMappedKey, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsFromMappedKey<L, R, T, F>;
60
+ Extends<L extends TSchema, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtends<L, R, T, F>;
61
+ Extract<L extends TMappedResult, R extends TSchema>(type: L, union: R, options?: SchemaOptions): TExtractFromMappedResult<L, R>;
60
62
  Extract<L extends TSchema, R extends TSchema>(type: L, union: R, options?: SchemaOptions): TExtract<L, R>;
61
- Index<T extends TSchema, K extends TMappedKey>(T: T, K: K): TIndexMappedResult<T, K>;
63
+ Index<T extends TSchema, K extends TMappedKey>(T: T, K: K, options?: SchemaOptions): TIndexFromMappedKey<T, K>;
62
64
  Index<T extends TSchema, K extends TSchema, I extends PropertyKey[] = TIndexPropertyKeys<K>>(T: T, K: K, options?: SchemaOptions): TIndex<T, I>;
63
65
  Index<T extends TSchema, K extends PropertyKey[]>(T: T, K: readonly [...K], options?: SchemaOptions): TIndex<T, K>;
64
66
  Integer(options?: IntegerOptions): TInteger;
65
67
  Intersect<T extends TSchema[]>(T: [...T], options?: IntersectOptions): IntersectResolve<T>;
68
+ KeyOf<T extends TMappedResult>(schema: T, options?: SchemaOptions): TKeyOfFromMappedResult<T>;
66
69
  KeyOf<T extends TSchema>(schema: T, options?: SchemaOptions): TKeyOf<T>;
67
70
  Literal<T extends TLiteralValue>(value: T, options?: SchemaOptions): TLiteral<T>;
68
71
  Lowercase<T extends TSchema>(schema: T, options?: SchemaOptions): TLowercase<T>;
@@ -73,18 +76,20 @@ export declare class JsonTypeBuilder {
73
76
  Null(options?: SchemaOptions): TNull;
74
77
  Number(options?: NumberOptions): TNumber;
75
78
  Object<T extends TProperties>(properties: T, options?: ObjectOptions): TObject<T>;
76
- Omit<T extends TSchema, K extends TMappedKey>(T: T, K: K): TOmitMappedResult<T, K>;
79
+ Omit<T extends TSchema, K extends TMappedKey>(T: T, K: K): TOmitFromMappedKey<T, K>;
77
80
  Omit<T extends TSchema, K extends TSchema, I extends PropertyKey[] = TIndexPropertyKeys<K>>(T: T, K: K, options?: SchemaOptions): TOmit<T, I>;
78
81
  Omit<T extends TSchema, K extends PropertyKey[]>(T: T, K: readonly [...K], options?: SchemaOptions): TOmit<T, K>;
82
+ Partial<T extends TMappedResult>(T: T, options?: ObjectOptions): TPartialFromMappedResult<T>;
79
83
  Partial<T extends TSchema>(schema: T, options?: ObjectOptions): TPartial<T>;
80
- Pick<T extends TSchema, K extends TMappedKey>(T: T, K: K): TPickMappedResult<T, K>;
84
+ Pick<T extends TSchema, K extends TMappedKey>(T: T, K: K): TPickFromMappedKey<T, K>;
81
85
  Pick<T extends TSchema, K extends TSchema, I extends PropertyKey[] = TIndexPropertyKeys<K>>(T: T, K: K, options?: SchemaOptions): TPick<T, I>;
82
86
  Pick<T extends TSchema, K extends PropertyKey[]>(T: T, K: readonly [...K], options?: SchemaOptions): TPick<T, K>;
83
87
  Record<K extends TSchema, T extends TSchema>(key: K, schema: T, options?: ObjectOptions): RecordResolve<K, T>;
84
88
  Recursive<T extends TSchema>(callback: (thisType: TThis) => T, options?: SchemaOptions): TRecursive<T>;
85
89
  Ref<T extends TSchema>(schema: T, options?: SchemaOptions): TRef<T>;
86
90
  Ref<T extends TSchema>($ref: string, options?: SchemaOptions): TRef<T>;
87
- Required<T extends TSchema>(schema: T, options?: SchemaOptions): TRequired<T>;
91
+ Required<T extends TMappedResult>(T: T, options?: ObjectOptions): TRequiredFromMappedResult<T>;
92
+ Required<T extends TSchema>(schema: T, options?: ObjectOptions): TRequired<T>;
88
93
  Rest<T extends TSchema>(schema: T): TRest<T>;
89
94
  String(options?: StringOptions): TString;
90
95
  TemplateLiteral<T extends string>(syntax: T, options?: SchemaOptions): TemplateLiteralSyntax<T>;
@@ -79,12 +79,12 @@ class JsonTypeBuilder {
79
79
  Enum(item, options = {}) {
80
80
  return (0, index_7.Enum)(item, options);
81
81
  }
82
- Extends(L, R, T, F, options = {}) {
83
- return (0, index_9.Extends)(L, R, T, F, options);
84
- }
85
82
  Exclude(unionType, excludedMembers, options = {}) {
86
83
  return (0, index_8.Exclude)(unionType, excludedMembers, options);
87
84
  }
85
+ Extends(L, R, T, F, options = {}) {
86
+ return (0, index_9.Extends)(L, R, T, F, options);
87
+ }
88
88
  Extract(type, union, options = {}) {
89
89
  return (0, index_10.Extract)(type, union, options);
90
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinclair/typebox",
3
- "version": "0.32.0-dev-14",
3
+ "version": "0.32.0-dev-15",
4
4
  "description": "Json Schema Type Builder with Static Type Resolution for TypeScript",
5
5
  "keywords": [
6
6
  "typescript",
package/readme.md CHANGED
@@ -52,9 +52,9 @@ type T = Static<typeof T> // type T = {
52
52
 
53
53
  ## Overview
54
54
 
55
- TypeBox is a runtime type builder that creates in-memory JSON Schema objects that can be statically inferred as TypeScript types. The schemas produced by this library are designed to match the static type assertion rules of the TypeScript compiler. TypeBox enables one to create a unified type that can be statically checked by TypeScript and runtime asserted using standard JSON Schema validation.
55
+ TypeBox is a runtime type builder that creates in-memory Json Schema objects that can be statically inferred as TypeScript types. The schemas produced by this library are designed to match the static type checking rules of the TypeScript compiler. TypeBox enables one to create a unified type that can be statically checked by TypeScript and runtime asserted using standard Json Schema validation.
56
56
 
57
- This library is designed to enable JSON schema to compose with the same flexibility as TypeScript's type system. It can be used as a simple tool to build up complex schemas or integrated into REST or RPC services to help validate data received over the wire.
57
+ This library enables Json Schema to compose with the same flexibility as TypeScript's type system. It can be used as a simple tool to build up complex schemas or integrated into REST or RPC services to help validate data received over the wire.
58
58
 
59
59
  License MIT
60
60
 
@@ -67,7 +67,7 @@ License MIT
67
67
  - [JavaScript](#types-javascript)
68
68
  - [Options](#types-options)
69
69
  - [Properties](#types-properties)
70
- - [Imports](#types-imports)
70
+ - [Modular](#types-modular)
71
71
  - [Generics](#types-generics)
72
72
  - [References](#types-references)
73
73
  - [Recursive](#types-recursive)
@@ -717,30 +717,19 @@ Object properties can be modified with Readonly and Optional. The following tabl
717
717
  └────────────────────────────────┴─────────────────────────────┴────────────────────────────────┘
718
718
  ```
719
719
 
720
- <a name='types-imports'></a>
720
+ <a name='types-modular'></a>
721
721
 
722
- ### Import Types
722
+ ### Modular Types
723
723
 
724
- TypeBox supports a modular type system. For most users, importing the full type system is generally recommended as it offers the best overall user experience as well as enabling easier discovery of available types.
724
+ TypeBox implements a modular type system. The following imports the full type system (recommended)
725
725
 
726
726
  ```typescript
727
- import { Type } from '@sinclair/typebox' // 34.9 kb minified
728
-
729
- const T = Type.Object({
730
- x: Type.Number(),
731
- y: Type.Number()
732
- })
727
+ import { Type } from '@sinclair/typebox' // 36.5 kb minified
733
728
  ```
734
- For developers building for resource constrained environments, selective imports can allow bundle optimizers to tree shake unused types. This can dramatically reduce bundle output sizes.
729
+ The following imports types individually which enables modern bundlers to optimize bundle sizes via tree shaking.
735
730
  ```typescript
736
731
  import { Object, Number } from '@sinclair/typebox' // 6.4 kb minified
737
-
738
- const T = Object({
739
- x: Number(),
740
- y: Number()
741
- })
742
732
  ```
743
- For additional information on bundle optimizations, refer to the documentation provided by your bundler of choice.
744
733
 
745
734
  <a name='types-generics'></a>
746
735
 
@@ -811,7 +800,7 @@ type VectorRef = Static<typeof VectorRef> // type VectorRef = {
811
800
  // y: number
812
801
  // }
813
802
  ```
814
- Use Type.Deref to dereference a type. This type will recursively reconstruct interior referenced types.
803
+ Use Type.Deref to dereference a type. This will replace any `$ref` with the target type.
815
804
  ```typescript
816
805
  const Vertex = Type.Object({ // const Vertex = {
817
806
  position: VectorRef, // type: 'object',
@@ -890,7 +879,7 @@ function test(node: Node) {
890
879
 
891
880
  ### Conditional Types
892
881
 
893
- TypeBox supports runtime Conditional Types with Type.Extends. This type runs a structural assignability check against the first and second arguments and will return either the third (`true`) or fourth (`false`) argument based on the result. Additionally, the conditional backed types Exclude and Extract are also supported. The following shows both TypeScript and TypeBox examples of this feature.
882
+ TypeBox supports runtime Conditional types with Type.Extends. This type runs a structural assignability check against the first and second arguments and will return either the third (`true`) or fourth (`false`) argument based on the result. The conditional types Exclude and Extract are also supported. The following shows both TypeScript and TypeBox examples of conditional types.
894
883
 
895
884
  ```typescript
896
885
  // Extends
@@ -935,7 +924,7 @@ const T = Type.Exclude( // const T: TUnion<[
935
924
 
936
925
  ### Mapped Types
937
926
 
938
- TypeBox supports Mapped Types with Type.Mapped. This type accepts a union set of property keys as the first argument, and a type mapping function which accepts each key (`K`) as the second. This type can be used with Conditional and Indexed Access types to allow for generalized property remapping irrespective of property type. The following example remaps each property of `T` to be `T[K] | null`.
927
+ TypeBox supports Mapped types with Type.Mapped. This type accepts a union of property keys as the first argument, and a type mapping function which accepts each key (`K`) as the second. This type can be used with Conditional and Indexed Access types to allow for generalized property remapping irrespective of property type. The following example remaps each property of `T` to be `T[K] | null`.
939
928
 
940
929
  ```typescript
941
930
  const T = Type.Object({ // const T: TObject<{
@@ -996,7 +985,7 @@ const R = Type.Record(K, Type.String()) // const R: TObject<{
996
985
 
997
986
  ### Indexed Access Types
998
987
 
999
- TypeBox supports Indexed Access Types with Type.Index. This type enables uniform access to interior property and array element types without having to extract them from the underlying schema representation. This type is supported for Object, Array, Tuple, Union and Intersect types.
988
+ TypeBox supports Indexed Access types with Type.Index. This type enables uniform access to interior property and array element types without having to extract them from the underlying schema representation. This type is supported for Object, Array, Tuple, Union and Intersect types.
1000
989
 
1001
990
  ```typescript
1002
991
  const T = Type.Object({ // const T: TObject<{
@@ -1140,7 +1129,7 @@ type S = Static<typeof T> // type S = 'A' | 'B' | 'C'
1140
1129
 
1141
1130
  ### TypeGuard
1142
1131
 
1143
- TypeBox can type check its own types with the TypeGuard module. This module is written for reflection and provides structural tests for every TypeBox type. Functions of this module return `is` guards which can be used with TypeScript control flow assertions to obtain schema inference. The following guards that the value A is TString.
1132
+ TypeBox can type check its own types with the TypeGuard module. This module is written for reflection and provides structural tests for every built-in TypeBox type. Functions of this module return `is` guards which can be used with TypeScript control flow assertions to obtain schema inference. The following guards that the value A is TString.
1144
1133
 
1145
1134
  ```typescript
1146
1135
  import { Type, TypeGuard } from '@sinclair/typebox'
@@ -1593,7 +1582,7 @@ const C = TypeCompiler.Code(Type.String()) // const C = `return functi
1593
1582
 
1594
1583
  ## TypeSystem
1595
1584
 
1596
- The TypeBox TypeSystem module provides functionality to define types above and beyond the built-in Json and JavaScript type sets. They also manage TypeBox's localization options (i18n) for error message generation and can control various assertion policies used when type checking. Configurations made to the TypeSystem module are observed by the TypeCompiler, Value and Error modules.
1585
+ The TypeBox TypeSystem module provides configurations to use either Json Schema or TypeScript type checking semantics. Configurations made to the TypeSystem module are observed by the TypeCompiler, Value and Error modules.
1597
1586
 
1598
1587
  <a name='typesystem-policies'></a>
1599
1588
 
@@ -1635,7 +1624,7 @@ TypeSystemPolicy.AllowNullVoid = true
1635
1624
 
1636
1625
  ## Error Function
1637
1626
 
1638
- Error messages in TypeBox can be customized by defining an ErrorFunction. This function allows for the localization of error messages as well as enabling custom error messages for custom types. By default, TypeBox will generate messages using the `en-US` locale. To support additional locales, you can replicate the function found in `src/errors/function.ts` and create a locale specific translations. The function can then be set via SetErrorFunction.
1627
+ Error messages in TypeBox can be customized by defining an ErrorFunction. This function allows for the localization of error messages as well as enabling custom error messages for custom types. By default, TypeBox will generate messages using the `en-US` locale. To support additional locales, you can replicate the function found in `src/errors/function.ts` and create a locale specific translation. The function can then be set via SetErrorFunction.
1639
1628
 
1640
1629
  The following example shows an inline error function that intercepts errors for String, Number and Boolean only. The DefaultErrorFunction is used to return a default error message.
1641
1630
 
@@ -1719,7 +1708,7 @@ The following is a list of community packages that offer general tooling, extend
1719
1708
 
1720
1709
  ## Benchmark
1721
1710
 
1722
- This project maintains a set of benchmarks that measure Ajv, Value and TypeCompiler compilation and validation performance. These benchmarks can be run locally by cloning this repository and running `npm run benchmark`. The results below show for Ajv version 8.12.0 running on Node 20.0.0.
1711
+ This project maintains a set of benchmarks that measure Ajv, Value and TypeCompiler compilation and validation performance. These benchmarks can be run locally by cloning this repository and running `npm run benchmark`. The results below show for Ajv version 8.12.0 running on Node 20.10.0.
1723
1712
 
1724
1713
  For additional comparative benchmarks, please refer to [typescript-runtime-type-benchmarks](https://moltar.github.io/typescript-runtime-type-benchmarks/).
1725
1714
 
@@ -1733,35 +1722,35 @@ This benchmark measures compilation performance for varying types. You can revie
1733
1722
  ┌────────────────────────────┬────────────┬──────────────┬──────────────┬──────────────┐
1734
1723
  │ (index) │ Iterations │ Ajv │ TypeCompiler │ Performance │
1735
1724
  ├────────────────────────────┼────────────┼──────────────┼──────────────┼──────────────┤
1736
- │ Literal_String │ 1000 │ ' 216 ms' │ ' 9 ms' │ ' 24.00 x' │
1737
- │ Literal_Number │ 1000 │ ' 169 ms' │ ' 7 ms' │ ' 24.14 x' │
1738
- │ Literal_Boolean │ 1000 │ ' 150 ms' │ ' 5 ms' │ ' 30.00 x' │
1739
- │ Primitive_Number │ 1000 │ ' 161 ms' │ ' 7 ms' │ ' 23.00 x' │
1740
- │ Primitive_String │ 1000 │ ' 148 ms' │ ' 6 ms' │ ' 24.67 x' │
1741
- │ Primitive_String_Pattern │ 1000 │ ' 185 ms' │ ' 9 ms' │ ' 20.56 x' │
1742
- │ Primitive_Boolean │ 1000 │ ' 132 ms' │ ' 4 ms' │ ' 33.00 x' │
1743
- │ Primitive_Null │ 1000 │ ' 141 ms' │ ' 3 ms' │ ' 47.00 x' │
1744
- │ Object_Unconstrained │ 1000 │ ' 1109 ms' │ ' 30 ms' │ ' 36.97 x' │
1745
- │ Object_Constrained │ 1000 │ ' 1200 ms' │ ' 24 ms' │ ' 50.00 x' │
1746
- │ Object_Vector3 │ 1000 │ ' 379 ms' │ ' 9 ms' │ ' 42.11 x' │
1747
- │ Object_Box3D │ 1000 │ ' 1709 ms' │ ' 30 ms' │ ' 56.97 x' │
1748
- │ Tuple_Primitive │ 1000 │ ' 456 ms' │ ' 14 ms' │ ' 32.57 x' │
1749
- │ Tuple_Object │ 1000 │ ' 1229 ms' │ ' 17 ms' │ ' 72.29 x' │
1750
- │ Composite_Intersect │ 1000 │ ' 570 ms' │ ' 17 ms' │ ' 33.53 x' │
1751
- │ Composite_Union │ 1000 │ ' 513 ms' │ ' 19 ms' │ ' 27.00 x' │
1752
- │ Math_Vector4 │ 1000 │ ' 782 ms' │ ' 13 ms' │ ' 60.15 x' │
1753
- │ Math_Matrix4 │ 1000 │ ' 393 ms' │ ' 12 ms' │ ' 32.75 x' │
1754
- │ Array_Primitive_Number │ 1000 │ ' 361 ms' │ ' 12 ms' │ ' 30.08 x' │
1755
- │ Array_Primitive_String │ 1000 │ ' 296 ms' │ ' 5 ms' │ ' 59.20 x' │
1756
- │ Array_Primitive_Boolean │ 1000 │ ' 315 ms' │ ' 4 ms' │ ' 78.75 x' │
1757
- │ Array_Object_Unconstrained │ 1000 │ ' 1721 ms' │ ' 22 ms' │ ' 78.23 x' │
1758
- │ Array_Object_Constrained │ 1000 │ ' 1450 ms' │ ' 21 ms' │ ' 69.05 x' │
1759
- │ Array_Tuple_Primitive │ 1000 │ ' 813 ms' │ ' 13 ms' │ ' 62.54 x' │
1760
- │ Array_Tuple_Object │ 1000 │ ' 1537 ms' │ ' 17 ms' │ ' 90.41 x' │
1761
- │ Array_Composite_Intersect │ 1000 │ ' 753 ms' │ ' 17 ms' │ ' 44.29 x' │
1762
- │ Array_Composite_Union │ 1000 │ ' 808 ms' │ ' 16 ms' │ ' 50.50 x' │
1763
- │ Array_Math_Vector4 │ 1000 │ ' 1118 ms' │ ' 16 ms' │ ' 69.88 x' │
1764
- │ Array_Math_Matrix4 │ 1000 │ ' 690 ms' │ ' 9 ms' │ ' 76.67 x' │
1725
+ │ Literal_String │ 1000 │ ' 236 ms' │ ' 9 ms' │ ' 26.22 x' │
1726
+ │ Literal_Number │ 1000 │ ' 205 ms' │ ' 13 ms' │ ' 15.77 x' │
1727
+ │ Literal_Boolean │ 1000 │ ' 168 ms' │ ' 4 ms' │ ' 42.00 x' │
1728
+ │ Primitive_Number │ 1000 │ ' 170 ms' │ ' 8 ms' │ ' 21.25 x' │
1729
+ │ Primitive_String │ 1000 │ ' 162 ms' │ ' 7 ms' │ ' 23.14 x' │
1730
+ │ Primitive_String_Pattern │ 1000 │ ' 211 ms' │ ' 10 ms' │ ' 21.10 x' │
1731
+ │ Primitive_Boolean │ 1000 │ ' 139 ms' │ ' 4 ms' │ ' 34.75 x' │
1732
+ │ Primitive_Null │ 1000 │ ' 146 ms' │ ' 5 ms' │ ' 29.20 x' │
1733
+ │ Object_Unconstrained │ 1000 │ ' 1160 ms' │ ' 33 ms' │ ' 35.15 x' │
1734
+ │ Object_Constrained │ 1000 │ ' 1257 ms' │ ' 26 ms' │ ' 48.35 x' │
1735
+ │ Object_Vector3 │ 1000 │ ' 393 ms' │ ' 8 ms' │ ' 49.13 x' │
1736
+ │ Object_Box3D │ 1000 │ ' 1795 ms' │ ' 30 ms' │ ' 59.83 x' │
1737
+ │ Tuple_Primitive │ 1000 │ ' 542 ms' │ ' 16 ms' │ ' 33.88 x' │
1738
+ │ Tuple_Object │ 1000 │ ' 1330 ms' │ ' 17 ms' │ ' 78.24 x' │
1739
+ │ Composite_Intersect │ 1000 │ ' 624 ms' │ ' 17 ms' │ ' 36.71 x' │
1740
+ │ Composite_Union │ 1000 │ ' 565 ms' │ ' 19 ms' │ ' 29.74 x' │
1741
+ │ Math_Vector4 │ 1000 │ ' 853 ms' │ ' 10 ms' │ ' 85.30 x' │
1742
+ │ Math_Matrix4 │ 1000 │ ' 406 ms' │ ' 12 ms' │ ' 33.83 x' │
1743
+ │ Array_Primitive_Number │ 1000 │ ' 401 ms' │ ' 11 ms' │ ' 36.45 x' │
1744
+ │ Array_Primitive_String │ 1000 │ ' 385 ms' │ ' 6 ms' │ ' 64.17 x' │
1745
+ │ Array_Primitive_Boolean │ 1000 │ ' 347 ms' │ ' 8 ms' │ ' 43.38 x' │
1746
+ │ Array_Object_Unconstrained │ 1000 │ ' 1904 ms' │ ' 25 ms' │ ' 76.16 x' │
1747
+ │ Array_Object_Constrained │ 1000 │ ' 1582 ms' │ ' 20 ms' │ ' 79.10 x' │
1748
+ │ Array_Tuple_Primitive │ 1000 │ ' 864 ms' │ ' 11 ms' │ ' 78.55 x' │
1749
+ │ Array_Tuple_Object │ 1000 │ ' 1658 ms' │ ' 16 ms' │ ' 103.63 x' │
1750
+ │ Array_Composite_Intersect │ 1000 │ ' 786 ms' │ ' 17 ms' │ ' 46.24 x' │
1751
+ │ Array_Composite_Union │ 1000 │ ' 844 ms' │ ' 16 ms' │ ' 52.75 x' │
1752
+ │ Array_Math_Vector4 │ 1000 │ ' 1192 ms' │ ' 10 ms' │ ' 119.20 x' │
1753
+ │ Array_Math_Matrix4 │ 1000 │ ' 688 ms' │ ' 10 ms' │ ' 68.80 x' │
1765
1754
  └────────────────────────────┴────────────┴──────────────┴──────────────┴──────────────┘
1766
1755
  ```
1767
1756
 
@@ -1775,37 +1764,37 @@ This benchmark measures validation performance for varying types. You can review
1775
1764
  ┌────────────────────────────┬────────────┬──────────────┬──────────────┬──────────────┬──────────────┐
1776
1765
  │ (index) │ Iterations │ ValueCheck │ Ajv │ TypeCompiler │ Performance │
1777
1766
  ├────────────────────────────┼────────────┼──────────────┼──────────────┼──────────────┼──────────────┤
1778
- │ Literal_String │ 1000000 │ ' 24 ms' │ ' 5 ms' │ ' 4 ms' │ ' 1.25 x' │
1779
- │ Literal_Number │ 1000000 │ ' 15 ms' │ ' 20 ms' │ ' 10 ms' │ ' 2.00 x' │
1767
+ │ Literal_String │ 1000000 │ ' 19 ms' │ ' 5 ms' │ ' 4 ms' │ ' 1.25 x' │
1768
+ │ Literal_Number │ 1000000 │ ' 14 ms' │ ' 19 ms' │ ' 10 ms' │ ' 1.90 x' │
1780
1769
  │ Literal_Boolean │ 1000000 │ ' 14 ms' │ ' 19 ms' │ ' 9 ms' │ ' 2.11 x' │
1781
- │ Primitive_Number │ 1000000 │ ' 25 ms' │ ' 18 ms' │ ' 10 ms' │ ' 1.80 x' │
1782
- │ Primitive_String │ 1000000 │ ' 21 ms' │ ' 24 ms' │ ' 9 ms' │ ' 2.67 x' │
1783
- │ Primitive_String_Pattern │ 1000000 │ ' 156 ms' │ ' 43 ms' │ ' 38 ms' │ ' 1.13 x' │
1784
- │ Primitive_Boolean │ 1000000 │ ' 18 ms' │ ' 17 ms' │ ' 9 ms' │ ' 1.89 x' │
1785
- │ Primitive_Null │ 1000000 │ ' 20 ms' │ ' 17 ms' │ ' 9 ms' │ ' 1.89 x' │
1786
- │ Object_Unconstrained │ 1000000 │ ' 1055 ms' │ ' 32 ms' │ ' 24 ms' │ ' 1.33 x' │
1787
- │ Object_Constrained │ 1000000 │ ' 1232 ms' │ ' 49 ms' │ ' 43 ms' │ ' 1.14 x' │
1788
- │ Object_Vector3 │ 1000000 │ ' 432 ms' │ ' 23 ms' │ ' 13 ms' │ ' 1.77 x' │
1789
- │ Object_Box3D │ 1000000 │ ' 1993 ms' │ ' 54 ms' │ ' 46 ms' │ ' 1.17 x' │
1790
- │ Object_Recursive │ 1000000 │ ' 5115 ms' │ ' 342 ms' │ ' 159 ms' │ ' 2.15 x' │
1791
- │ Tuple_Primitive │ 1000000 │ ' 156 ms' │ ' 21 ms' │ ' 13 ms' │ ' 1.62 x' │
1792
- │ Tuple_Object │ 1000000 │ ' 740 ms' │ ' 29 ms' │ ' 18 ms' │ ' 1.61 x' │
1793
- │ Composite_Intersect │ 1000000 │ ' 797 ms' │ ' 26 ms' │ ' 14 ms' │ ' 1.86 x' │
1794
- │ Composite_Union │ 1000000 │ ' 530 ms' │ ' 23 ms' │ ' 13 ms' │ ' 1.77 x' │
1795
- │ Math_Vector4 │ 1000000 │ ' 240 ms' │ ' 22 ms' │ ' 11 ms' │ ' 2.00 x' │
1796
- │ Math_Matrix4 │ 1000000 │ ' 1036 ms' │ ' 39 ms' │ ' 27 ms' │ ' 1.44 x' │
1797
- │ Array_Primitive_Number │ 1000000 │ ' 248 ms' │ ' 20 ms' │ ' 12 ms' │ ' 1.67 x' │
1798
- │ Array_Primitive_String │ 1000000 │ ' 227 ms' │ ' 22 ms' │ ' 13 ms' │ ' 1.69 x' │
1799
- │ Array_Primitive_Boolean │ 1000000 │ ' 138 ms' │ ' 21 ms' │ ' 13 ms' │ ' 1.62 x' │
1800
- │ Array_Object_Unconstrained │ 1000000 │ ' 5540 ms' │ ' 66 ms' │ ' 59 ms' │ ' 1.12 x' │
1801
- │ Array_Object_Constrained │ 1000000 │ ' 5750 ms' │ ' 123 ms' │ ' 108 ms' │ ' 1.14 x' │
1802
- │ Array_Object_Recursive │ 1000000 │ ' 21842 ms' │ ' 1771 ms' │ ' 599 ms' │ ' 2.96 x' │
1803
- │ Array_Tuple_Primitive │ 1000000 │ ' 715 ms' │ ' 36 ms' │ ' 29 ms' │ ' 1.24 x' │
1804
- │ Array_Tuple_Object │ 1000000 │ ' 3131 ms' │ ' 63 ms' │ ' 50 ms' │ ' 1.26 x' │
1805
- │ Array_Composite_Intersect │ 1000000 │ ' 3064 ms' │ ' 44 ms' │ ' 35 ms' │ ' 1.26 x' │
1806
- │ Array_Composite_Union │ 1000000 │ ' 2172 ms' │ ' 65 ms' │ ' 31 ms' │ ' 2.10 x' │
1807
- │ Array_Math_Vector4 │ 1000000 │ ' 1032 ms' │ ' 37 ms' │ ' 24 ms' │ ' 1.54 x' │
1808
- │ Array_Math_Matrix4 │ 1000000 │ ' 4859 ms' │ ' 114 ms' │ ' 86 ms' │ ' 1.33 x' │
1770
+ │ Primitive_Number │ 1000000 │ ' 21 ms' │ ' 18 ms' │ ' 10 ms' │ ' 1.80 x' │
1771
+ │ Primitive_String │ 1000000 │ ' 22 ms' │ ' 17 ms' │ ' 9 ms' │ ' 1.89 x' │
1772
+ │ Primitive_String_Pattern │ 1000000 │ ' 164 ms' │ ' 44 ms' │ ' 36 ms' │ ' 1.22 x' │
1773
+ │ Primitive_Boolean │ 1000000 │ ' 18 ms' │ ' 18 ms' │ ' 9 ms' │ ' 2.00 x' │
1774
+ │ Primitive_Null │ 1000000 │ ' 19 ms' │ ' 17 ms' │ ' 9 ms' │ ' 1.89 x' │
1775
+ │ Object_Unconstrained │ 1000000 │ ' 966 ms' │ ' 33 ms' │ ' 24 ms' │ ' 1.38 x' │
1776
+ │ Object_Constrained │ 1000000 │ ' 1275 ms' │ ' 52 ms' │ ' 42 ms' │ ' 1.24 x' │
1777
+ │ Object_Vector3 │ 1000000 │ ' 427 ms' │ ' 23 ms' │ ' 14 ms' │ ' 1.64 x' │
1778
+ │ Object_Box3D │ 1000000 │ ' 2024 ms' │ ' 56 ms' │ ' 50 ms' │ ' 1.12 x' │
1779
+ │ Object_Recursive │ 1000000 │ ' 5263 ms' │ ' 358 ms' │ ' 164 ms' │ ' 2.18 x' │
1780
+ │ Tuple_Primitive │ 1000000 │ ' 157 ms' │ ' 22 ms' │ ' 12 ms' │ ' 1.83 x' │
1781
+ │ Tuple_Object │ 1000000 │ ' 767 ms' │ ' 29 ms' │ ' 18 ms' │ ' 1.61 x' │
1782
+ │ Composite_Intersect │ 1000000 │ ' 769 ms' │ ' 26 ms' │ ' 15 ms' │ ' 1.73 x' │
1783
+ │ Composite_Union │ 1000000 │ ' 501 ms' │ ' 24 ms' │ ' 13 ms' │ ' 1.85 x' │
1784
+ │ Math_Vector4 │ 1000000 │ ' 250 ms' │ ' 23 ms' │ ' 11 ms' │ ' 2.09 x' │
1785
+ │ Math_Matrix4 │ 1000000 │ ' 1073 ms' │ ' 43 ms' │ ' 28 ms' │ ' 1.54 x' │
1786
+ │ Array_Primitive_Number │ 1000000 │ ' 264 ms' │ ' 21 ms' │ ' 12 ms' │ ' 1.75 x' │
1787
+ │ Array_Primitive_String │ 1000000 │ ' 242 ms' │ ' 23 ms' │ ' 14 ms' │ ' 1.64 x' │
1788
+ │ Array_Primitive_Boolean │ 1000000 │ ' 151 ms' │ ' 24 ms' │ ' 14 ms' │ ' 1.71 x' │
1789
+ │ Array_Object_Unconstrained │ 1000000 │ ' 5864 ms' │ ' 66 ms' │ ' 58 ms' │ ' 1.14 x' │
1790
+ │ Array_Object_Constrained │ 1000000 │ ' 5996 ms' │ ' 138 ms' │ ' 116 ms' │ ' 1.19 x' │
1791
+ │ Array_Object_Recursive │ 1000000 │ ' 22515 ms' │ ' 1625 ms' │ ' 585 ms' │ ' 2.78 x' │
1792
+ │ Array_Tuple_Primitive │ 1000000 │ ' 737 ms' │ ' 38 ms' │ ' 31 ms' │ ' 1.23 x' │
1793
+ │ Array_Tuple_Object │ 1000000 │ ' 3257 ms' │ ' 77 ms' │ ' 56 ms' │ ' 1.38 x' │
1794
+ │ Array_Composite_Intersect │ 1000000 │ ' 3119 ms' │ ' 49 ms' │ ' 38 ms' │ ' 1.29 x' │
1795
+ │ Array_Composite_Union │ 1000000 │ ' 2108 ms' │ ' 72 ms' │ ' 33 ms' │ ' 2.18 x' │
1796
+ │ Array_Math_Vector4 │ 1000000 │ ' 1078 ms' │ ' 38 ms' │ ' 26 ms' │ ' 1.46 x' │
1797
+ │ Array_Math_Matrix4 │ 1000000 │ ' 4967 ms' │ ' 126 ms' │ ' 88 ms' │ ' 1.43 x' │
1809
1798
  └────────────────────────────┴────────────┴──────────────┴──────────────┴──────────────┴──────────────┘
1810
1799
  ```
1811
1800
 
@@ -1819,12 +1808,11 @@ The following table lists esbuild compiled and minified sizes for each TypeBox m
1819
1808
  ┌──────────────────────┬────────────┬────────────┬─────────────┐
1820
1809
  │ (index) │ Compiled │ Minified │ Compression │
1821
1810
  ├──────────────────────┼────────────┼────────────┼─────────────┤
1822
- │ typebox/compiler │ '109.2 kb' │ ' 48.6 kb' │ '2.25 x' │
1823
- │ typebox/errors │ ' 55.0 kb' │ ' 25.1 kb' │ '2.19 x' │
1811
+ │ typebox/compiler │ '118.3 kb' │ ' 52.4 kb' │ '2.26 x' │
1812
+ │ typebox/errors │ ' 55.1 kb' │ ' 25.2 kb' │ '2.19 x' │
1824
1813
  │ typebox/system │ ' 4.6 kb' │ ' 2.0 kb' │ '2.31 x' │
1825
- │ typebox/type │ ' 82.9 kb' │ ' 34.9 kb' │ '2.38 x' │
1826
- │ typebox/value │ '144.2 kb' │ ' 61.5 kb' │ '2.34 x' │
1827
- │ typebox │ ' 82.9 kb' │ ' 34.9 kb' │ '2.37 x' │
1814
+ │ typebox/value │ '144.0 kb' │ ' 61.5 kb' │ '2.34 x' │
1815
+ │ typebox │ ' 87.0 kb' │ ' 36.5 kb' │ '2.39 x' │
1828
1816
  └──────────────────────┴────────────┴────────────┴─────────────┘
1829
1817
  ```
1830
1818