@sinclair/typebox 0.33.3 → 0.33.4

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 (56) hide show
  1. package/build/cjs/compiler/compiler.d.ts +2 -2
  2. package/build/cjs/compiler/compiler.js +1 -1
  3. package/build/cjs/value/assert/assert.d.ts +15 -0
  4. package/build/cjs/value/assert/assert.js +55 -0
  5. package/build/cjs/value/assert/index.d.ts +1 -0
  6. package/build/cjs/value/assert/index.js +18 -0
  7. package/build/cjs/value/cast/cast.js +1 -1
  8. package/build/cjs/value/clean/clean.js +6 -6
  9. package/build/cjs/value/clone/clone.js +21 -11
  10. package/build/cjs/value/convert/convert.d.ts +2 -2
  11. package/build/cjs/value/convert/convert.js +15 -18
  12. package/build/cjs/value/create/create.js +5 -1
  13. package/build/cjs/value/default/default.js +14 -16
  14. package/build/cjs/value/equal/equal.js +3 -3
  15. package/build/cjs/value/hash/hash.js +1 -1
  16. package/build/cjs/value/index.d.ts +2 -0
  17. package/build/cjs/value/index.js +2 -0
  18. package/build/cjs/value/mutate/mutate.js +4 -4
  19. package/build/cjs/value/parse/index.d.ts +1 -0
  20. package/build/cjs/value/parse/index.js +18 -0
  21. package/build/cjs/value/parse/parse.d.ts +6 -0
  22. package/build/cjs/value/parse/parse.js +29 -0
  23. package/build/cjs/value/transform/decode.js +8 -4
  24. package/build/cjs/value/transform/encode.js +9 -5
  25. package/build/cjs/value/transform/has.js +5 -1
  26. package/build/cjs/value/value/value.d.ts +10 -2
  27. package/build/cjs/value/value/value.js +38 -26
  28. package/build/esm/compiler/compiler.d.mts +2 -2
  29. package/build/esm/compiler/compiler.mjs +1 -1
  30. package/build/esm/value/assert/assert.d.mts +15 -0
  31. package/build/esm/value/assert/assert.mjs +49 -0
  32. package/build/esm/value/assert/index.d.mts +1 -0
  33. package/build/esm/value/assert/index.mjs +1 -0
  34. package/build/esm/value/cast/cast.mjs +2 -2
  35. package/build/esm/value/clean/clean.mjs +7 -7
  36. package/build/esm/value/clone/clone.mjs +22 -12
  37. package/build/esm/value/convert/convert.d.mts +2 -2
  38. package/build/esm/value/convert/convert.mjs +16 -19
  39. package/build/esm/value/create/create.mjs +5 -1
  40. package/build/esm/value/default/default.mjs +14 -16
  41. package/build/esm/value/equal/equal.mjs +4 -4
  42. package/build/esm/value/hash/hash.mjs +2 -2
  43. package/build/esm/value/index.d.mts +2 -0
  44. package/build/esm/value/index.mjs +2 -0
  45. package/build/esm/value/mutate/mutate.mjs +5 -5
  46. package/build/esm/value/parse/index.d.mts +1 -0
  47. package/build/esm/value/parse/index.mjs +1 -0
  48. package/build/esm/value/parse/parse.d.mts +6 -0
  49. package/build/esm/value/parse/parse.mjs +25 -0
  50. package/build/esm/value/transform/decode.mjs +9 -5
  51. package/build/esm/value/transform/encode.mjs +10 -6
  52. package/build/esm/value/transform/has.mjs +5 -1
  53. package/build/esm/value/value/value.d.mts +10 -2
  54. package/build/esm/value/value/value.mjs +11 -1
  55. package/package.json +1 -1
  56. package/readme.md +114 -130
package/readme.md CHANGED
@@ -74,13 +74,12 @@ License MIT
74
74
  - [Indexed](#types-indexed)
75
75
  - [Mapped](#types-mapped)
76
76
  - [Conditional](#types-conditional)
77
- - [Intrinsic](#types-intrinsic)
78
77
  - [Transform](#types-transform)
79
- - [Rest](#types-rest)
80
78
  - [Guard](#types-guard)
81
79
  - [Unsafe](#types-unsafe)
82
80
  - [Strict](#types-strict)
83
81
  - [Values](#values)
82
+ - [Assert](#values-assert)
84
83
  - [Create](#values-create)
85
84
  - [Clone](#values-clone)
86
85
  - [Check](#values-check)
@@ -90,6 +89,7 @@ License MIT
90
89
  - [Cast](#values-cast)
91
90
  - [Decode](#values-decode)
92
91
  - [Encode](#values-decode)
92
+ - [Parse](#values-parse)
93
93
  - [Equal](#values-equal)
94
94
  - [Hash](#values-hash)
95
95
  - [Diff](#values-diff)
@@ -176,19 +176,17 @@ type T = Static<typeof T> // type T = {
176
176
 
177
177
  //--------------------------------------------------------------------------------------------
178
178
  //
179
- // ... then use the type both as Json Schema and as a TypeScript type.
179
+ // ... or use the type to parse JavaScript values.
180
180
  //
181
181
  //--------------------------------------------------------------------------------------------
182
182
 
183
183
  import { Value } from '@sinclair/typebox/value'
184
184
 
185
- function receive(value: T) { // ... as a Static Type
186
-
187
- if(Value.Check(T, value)) { // ... as a Json Schema
188
-
189
- // ok...
190
- }
191
- }
185
+ const R = Value.Parse(T, value) // const R: {
186
+ // id: string,
187
+ // name: string,
188
+ // timestamp: number
189
+ // }
192
190
  ```
193
191
 
194
192
  <a name='types'></a>
@@ -1000,38 +998,6 @@ const C = Type.Exclude( // type C = Exclude<1 | 2 |
1000
998
  ) // ]>
1001
999
  ```
1002
1000
 
1003
- <a name='types-intrinsic'></a>
1004
-
1005
- ### Intrinsic Types
1006
-
1007
- TypeBox supports the TypeScript intrinsic string manipulation types Uppercase, Lowercase, Capitalize and Uncapitalize. These types can be used to remap Literal, Template Literal and Union of Literal types.
1008
-
1009
- ```typescript
1010
- // TypeScript
1011
- type A = Capitalize<'hello'> // type A = 'Hello'
1012
-
1013
- type B = Capitalize<'hello' | 'world'> // type C = 'Hello' | 'World'
1014
-
1015
- type C = Capitalize<`hello${1|2|3}`> // type B = 'Hello1' | 'Hello2' | 'Hello3'
1016
-
1017
- // TypeBox
1018
- const A = Type.Capitalize(Type.Literal('hello')) // const A: TLiteral<'Hello'>
1019
-
1020
- const B = Type.Capitalize(Type.Union([ // const B: TUnion<[
1021
- Type.Literal('hello'), // TLiteral<'Hello'>,
1022
- Type.Literal('world') // TLiteral<'World'>
1023
- ])) // ]>
1024
-
1025
- const C = Type.Capitalize( // const C: TTemplateLiteral<[
1026
- Type.TemplateLiteral('hello${1|2|3}') // TLiteral<'Hello'>,
1027
- ) // TUnion<[
1028
- // TLiteral<'1'>,
1029
- // TLiteral<'2'>,
1030
- // TLiteral<'3'>
1031
- // ]>
1032
- // ]>
1033
- ```
1034
-
1035
1001
  <a name='types-transform'></a>
1036
1002
 
1037
1003
  ### Transform Types
@@ -1061,26 +1027,6 @@ type E = StaticEncode<typeof T> // type E = Array<number>
1061
1027
  type T = Static<typeof T> // type T = Array<number>
1062
1028
  ```
1063
1029
 
1064
- <a name='types-rest'></a>
1065
-
1066
- ### Rest Types
1067
-
1068
- TypeBox provides the Rest type to uniformly extract variadic tuples from Intersect, Union and Tuple types. This type can be useful to remap variadic types into different forms. The following uses Rest to remap a Tuple into a Union.
1069
-
1070
- ```typescript
1071
- const T = Type.Tuple([ // const T: TTuple<[
1072
- Type.String(), // TString,
1073
- Type.Number() // TNumber
1074
- ]) // ]>
1075
-
1076
- const R = Type.Rest(T) // const R: [TString, TNumber]
1077
-
1078
- const U = Type.Union(R) // const T: TUnion<[
1079
- // TString,
1080
- // TNumber
1081
- // ]>
1082
- ```
1083
-
1084
1030
  <a name='types-unsafe'></a>
1085
1031
 
1086
1032
  ### Unsafe Types
@@ -1171,6 +1117,18 @@ TypeBox provides an optional Value submodule that can be used to perform structu
1171
1117
  import { Value } from '@sinclair/typebox/value'
1172
1118
  ```
1173
1119
 
1120
+ <a name='values-assert'></a>
1121
+
1122
+ ### Assert
1123
+
1124
+ Use the Assert function to assert a value is valid.
1125
+
1126
+ ```typescript
1127
+ let value: unknown = 1
1128
+
1129
+ Value.Assert(Type.Number(), value) // throws AssertError if invalid
1130
+ ```
1131
+
1174
1132
  <a name='values-create'></a>
1175
1133
 
1176
1134
  ### Create
@@ -1296,6 +1254,32 @@ const A = Value.Encode(Type.String(), 'hello') // const A = 'hello'
1296
1254
  const B = Value.Encode(Type.String(), 42) // throw
1297
1255
  ```
1298
1256
 
1257
+ <a name='values-parse'></a>
1258
+
1259
+ ### Parse
1260
+
1261
+ Use the Parse function to parse a value or throw if invalid. This function internally uses Default, Clean, Convert and Decode to make a best effort attempt to parse the value into the expected type. This function should not be used in performance critical code paths.
1262
+
1263
+ ```typescript
1264
+ const T = Type.Object({ x: Type.Number({ default: 0 }), y: Type.Number({ default: 0 }) })
1265
+
1266
+ // Default
1267
+
1268
+ const A = Value.Parse(T, { }) // const A = { x: 0, y: 0 }
1269
+
1270
+ // Convert
1271
+
1272
+ const B = Value.Parse(T, { x: '1', y: '2' }) // const B = { x: 1, y: 2 }
1273
+
1274
+ // Clean
1275
+
1276
+ const C = Value.Parse(T, { x: 1, y: 2, z: 3 }) // const C = { x: 1, y: 2 }
1277
+
1278
+ // Assert
1279
+
1280
+ const D = Value.Parse(T, undefined) // throws AssertError
1281
+ ```
1282
+
1299
1283
  <a name='values-equal'></a>
1300
1284
 
1301
1285
  ### Equal
@@ -1716,37 +1700,37 @@ This benchmark measures compilation performance for varying types.
1716
1700
 
1717
1701
  ```typescript
1718
1702
  ┌────────────────────────────┬────────────┬──────────────┬──────────────┬──────────────┐
1719
- (index) │ Iterations │ Ajv │ TypeCompiler │ Performance │
1703
+ (index) │ Iterations │ Ajv │ TypeCompiler │ Performance │
1720
1704
  ├────────────────────────────┼────────────┼──────────────┼──────────────┼──────────────┤
1721
- │ Literal_String │ 1000 │ ' 242 ms' │ ' 10 ms' │ ' 24.20 x' │
1722
- │ Literal_Number │ 1000 │ ' 200 ms' │ ' 8 ms' │ ' 25.00 x' │
1723
- │ Literal_Boolean │ 1000 │ ' 168 ms' │ ' 6 ms' │ ' 28.00 x' │
1724
- │ Primitive_Number │ 1000 │ ' 165 ms' │ ' 8 ms' │ ' 20.63 x' │
1725
- │ Primitive_String │ 1000 │ ' 154 ms' │ ' 6 ms' │ ' 25.67 x' │
1726
- │ Primitive_String_Pattern │ 1000 │ ' 208 ms' │ ' 14 ms' │ ' 14.86 x' │
1727
- │ Primitive_Boolean │ 1000 │ ' 142 ms' │ ' 6 ms' │ ' 23.67 x' │
1728
- │ Primitive_Null │ 1000 │ ' 143 ms' │ ' 6 ms' │ ' 23.83 x' │
1729
- │ Object_Unconstrained │ 1000 │ ' 1217 ms' │ ' 31 ms' │ ' 39.26 x' │
1730
- │ Object_Constrained │ 1000 │ ' 1275 ms' │ ' 26 ms' │ ' 49.04 x' │
1731
- │ Object_Vector3 │ 1000 │ ' 405 ms' │ ' 12 ms' │ ' 33.75 x' │
1732
- │ Object_Box3D │ 1000 │ ' 1833 ms' │ ' 27 ms' │ ' 67.89 x' │
1733
- │ Tuple_Primitive │ 1000 │ ' 475 ms' │ ' 13 ms' │ ' 36.54 x' │
1734
- │ Tuple_Object │ 1000 │ ' 1267 ms' │ ' 30 ms' │ ' 42.23 x' │
1735
- │ Composite_Intersect │ 1000 │ ' 604 ms' │ ' 18 ms' │ ' 33.56 x' │
1736
- │ Composite_Union │ 1000 │ ' 545 ms' │ ' 20 ms' │ ' 27.25 x' │
1737
- │ Math_Vector4 │ 1000 │ ' 829 ms' │ ' 12 ms' │ ' 69.08 x' │
1738
- │ Math_Matrix4 │ 1000 │ ' 405 ms' │ ' 10 ms' │ ' 40.50 x' │
1739
- │ Array_Primitive_Number │ 1000 │ ' 372 ms' │ ' 12 ms' │ ' 31.00 x' │
1740
- │ Array_Primitive_String │ 1000 │ ' 327 ms' │ ' 5 ms' │ ' 65.40 x' │
1741
- │ Array_Primitive_Boolean │ 1000 │ ' 300 ms' │ ' 4 ms' │ ' 75.00 x' │
1742
- │ Array_Object_Unconstrained │ 1000 │ ' 1755 ms' │ ' 21 ms' │ ' 83.57 x' │
1743
- │ Array_Object_Constrained │ 1000 │ ' 1516 ms' │ ' 20 ms' │ ' 75.80 x' │
1744
- │ Array_Tuple_Primitive │ 1000 │ ' 825 ms' │ ' 14 ms' │ ' 58.93 x' │
1745
- │ Array_Tuple_Object │ 1000 │ ' 1616 ms' │ ' 16 ms' │ ' 101.00 x' │
1746
- │ Array_Composite_Intersect │ 1000 │ ' 776 ms' │ ' 16 ms' │ ' 48.50 x' │
1747
- │ Array_Composite_Union │ 1000 │ ' 820 ms' │ ' 14 ms' │ ' 58.57 x' │
1748
- │ Array_Math_Vector4 │ 1000 │ ' 1166 ms' │ ' 15 ms' │ ' 77.73 x' │
1749
- │ Array_Math_Matrix4 │ 1000 │ ' 695 ms' │ ' 8 ms' │ ' 86.88 x' │
1705
+ │ Literal_String │ 1000 │ ' 211 ms' │ ' 8 ms' │ ' 26.38 x' │
1706
+ │ Literal_Number │ 1000 │ ' 185 ms' │ ' 5 ms' │ ' 37.00 x' │
1707
+ │ Literal_Boolean │ 1000 │ ' 195 ms' │ ' 4 ms' │ ' 48.75 x' │
1708
+ │ Primitive_Number │ 1000 │ ' 149 ms' │ ' 7 ms' │ ' 21.29 x' │
1709
+ │ Primitive_String │ 1000 │ ' 135 ms' │ ' 5 ms' │ ' 27.00 x' │
1710
+ │ Primitive_String_Pattern │ 1000 │ ' 193 ms' │ ' 10 ms' │ ' 19.30 x' │
1711
+ │ Primitive_Boolean │ 1000 │ ' 152 ms' │ ' 4 ms' │ ' 38.00 x' │
1712
+ │ Primitive_Null │ 1000 │ ' 147 ms' │ ' 4 ms' │ ' 36.75 x' │
1713
+ │ Object_Unconstrained │ 1000 │ ' 1065 ms' │ ' 26 ms' │ ' 40.96 x' │
1714
+ │ Object_Constrained │ 1000 │ ' 1183 ms' │ ' 26 ms' │ ' 45.50 x' │
1715
+ │ Object_Vector3 │ 1000 │ ' 407 ms' │ ' 9 ms' │ ' 45.22 x' │
1716
+ │ Object_Box3D │ 1000 │ ' 1777 ms' │ ' 24 ms' │ ' 74.04 x' │
1717
+ │ Tuple_Primitive │ 1000 │ ' 485 ms' │ ' 11 ms' │ ' 44.09 x' │
1718
+ │ Tuple_Object │ 1000 │ ' 1344 ms' │ ' 17 ms' │ ' 79.06 x' │
1719
+ │ Composite_Intersect │ 1000 │ ' 606 ms' │ ' 14 ms' │ ' 43.29 x' │
1720
+ │ Composite_Union │ 1000 │ ' 522 ms' │ ' 17 ms' │ ' 30.71 x' │
1721
+ │ Math_Vector4 │ 1000 │ ' 851 ms' │ ' 9 ms' │ ' 94.56 x' │
1722
+ │ Math_Matrix4 │ 1000 │ ' 406 ms' │ ' 10 ms' │ ' 40.60 x' │
1723
+ │ Array_Primitive_Number │ 1000 │ ' 367 ms' │ ' 6 ms' │ ' 61.17 x' │
1724
+ │ Array_Primitive_String │ 1000 │ ' 339 ms' │ ' 7 ms' │ ' 48.43 x' │
1725
+ │ Array_Primitive_Boolean │ 1000 │ ' 325 ms' │ ' 5 ms' │ ' 65.00 x' │
1726
+ │ Array_Object_Unconstrained │ 1000 │ ' 1863 ms' │ ' 21 ms' │ ' 88.71 x' │
1727
+ │ Array_Object_Constrained │ 1000 │ ' 1535 ms' │ ' 18 ms' │ ' 85.28 x' │
1728
+ │ Array_Tuple_Primitive │ 1000 │ ' 829 ms' │ ' 14 ms' │ ' 59.21 x' │
1729
+ │ Array_Tuple_Object │ 1000 │ ' 1674 ms' │ ' 14 ms' │ ' 119.57 x' │
1730
+ │ Array_Composite_Intersect │ 1000 │ ' 789 ms' │ ' 13 ms' │ ' 60.69 x' │
1731
+ │ Array_Composite_Union │ 1000 │ ' 822 ms' │ ' 15 ms' │ ' 54.80 x' │
1732
+ │ Array_Math_Vector4 │ 1000 │ ' 1129 ms' │ ' 14 ms' │ ' 80.64 x' │
1733
+ │ Array_Math_Matrix4 │ 1000 │ ' 673 ms' │ ' 9 ms' │ ' 74.78 x' │
1750
1734
  └────────────────────────────┴────────────┴──────────────┴──────────────┴──────────────┘
1751
1735
  ```
1752
1736
 
@@ -1758,39 +1742,39 @@ This benchmark measures validation performance for varying types.
1758
1742
 
1759
1743
  ```typescript
1760
1744
  ┌────────────────────────────┬────────────┬──────────────┬──────────────┬──────────────┬──────────────┐
1761
- (index) │ Iterations │ ValueCheck Ajv │ TypeCompiler │ Performance │
1745
+ (index) │ Iterations │ ValueCheck Ajv │ TypeCompiler │ Performance │
1762
1746
  ├────────────────────────────┼────────────┼──────────────┼──────────────┼──────────────┼──────────────┤
1763
- │ Literal_String │ 1000000 │ ' 18 ms' │ ' 5 ms' │ ' 4 ms' │ ' 1.25 x' │
1764
- │ Literal_Number │ 1000000 │ ' 16 ms' │ ' 18 ms' │ ' 10 ms' │ ' 1.80 x' │
1765
- │ Literal_Boolean │ 1000000 │ ' 15 ms' │ ' 19 ms' │ ' 10 ms' │ ' 1.90 x' │
1766
- │ Primitive_Number │ 1000000 │ ' 21 ms' │ ' 19 ms' │ ' 10 ms' │ ' 1.90 x' │
1767
- │ Primitive_String │ 1000000 │ ' 22 ms' │ ' 18 ms' │ ' 9 ms' │ ' 2.00 x' │
1768
- │ Primitive_String_Pattern │ 1000000 │ ' 155 ms' │ ' 41 ms' │ ' 34 ms' │ ' 1.21 x' │
1769
- │ Primitive_Boolean │ 1000000 │ ' 18 ms' │ ' 17 ms' │ ' 9 ms' │ ' 1.89 x' │
1770
- │ Primitive_Null │ 1000000 │ ' 19 ms' │ ' 17 ms' │ ' 9 ms' │ ' 1.89 x' │
1771
- │ Object_Unconstrained │ 1000000 │ ' 1003 ms' │ ' 32 ms' │ ' 24 ms' │ ' 1.33 x' │
1772
- │ Object_Constrained │ 1000000 │ ' 1265 ms' │ ' 49 ms' │ ' 38 ms' │ ' 1.29 x' │
1773
- │ Object_Vector3 │ 1000000 │ ' 418 ms' │ ' 22 ms' │ ' 13 ms' │ ' 1.69 x' │
1774
- │ Object_Box3D │ 1000000 │ ' 2035 ms' │ ' 56 ms' │ ' 49 ms' │ ' 1.14 x' │
1775
- │ Object_Recursive │ 1000000 │ ' 5243 ms' │ ' 326 ms' │ ' 157 ms' │ ' 2.08 x' │
1776
- │ Tuple_Primitive │ 1000000 │ ' 153 ms' │ ' 20 ms' │ ' 12 ms' │ ' 1.67 x' │
1777
- │ Tuple_Object │ 1000000 │ ' 781 ms' │ ' 28 ms' │ ' 18 ms' │ ' 1.56 x' │
1778
- │ Composite_Intersect │ 1000000 │ ' 742 ms' │ ' 25 ms' │ ' 14 ms' │ ' 1.79 x' │
1779
- │ Composite_Union │ 1000000 │ ' 558 ms' │ ' 24 ms' │ ' 13 ms' │ ' 1.85 x' │
1780
- │ Math_Vector4 │ 1000000 │ ' 246 ms' │ ' 22 ms' │ ' 11 ms' │ ' 2.00 x' │
1781
- │ Math_Matrix4 │ 1000000 │ ' 1052 ms' │ ' 43 ms' │ ' 28 ms' │ ' 1.54 x' │
1782
- │ Array_Primitive_Number │ 1000000 │ ' 272 ms' │ ' 22 ms' │ ' 12 ms' │ ' 1.83 x' │
1783
- │ Array_Primitive_String │ 1000000 │ ' 235 ms' │ ' 24 ms' │ ' 14 ms' │ ' 1.71 x' │
1784
- │ Array_Primitive_Boolean │ 1000000 │ ' 134 ms' │ ' 23 ms' │ ' 14 ms' │ ' 1.64 x' │
1785
- │ Array_Object_Unconstrained │ 1000000 │ ' 6280 ms' │ ' 65 ms' │ ' 59 ms' │ ' 1.10 x' │
1786
- │ Array_Object_Constrained │ 1000000 │ ' 6076 ms' │ ' 130 ms' │ ' 119 ms' │ ' 1.09 x' │
1787
- │ Array_Object_Recursive │ 1000000 │ ' 22738 ms' │ ' 1730 ms' │ ' 635 ms' │ ' 2.72 x' │
1788
- │ Array_Tuple_Primitive │ 1000000 │ ' 689 ms' │ ' 35 ms' │ ' 30 ms' │ ' 1.17 x' │
1789
- │ Array_Tuple_Object │ 1000000 │ ' 3266 ms' │ ' 63 ms' │ ' 52 ms' │ ' 1.21 x' │
1790
- │ Array_Composite_Intersect │ 1000000 │ ' 3310 ms' │ ' 44 ms' │ ' 36 ms' │ ' 1.22 x' │
1791
- │ Array_Composite_Union │ 1000000 │ ' 2432 ms' │ ' 69 ms' │ ' 33 ms' │ ' 2.09 x' │
1792
- │ Array_Math_Vector4 │ 1000000 │ ' 1158 ms' │ ' 37 ms' │ ' 24 ms' │ ' 1.54 x' │
1793
- │ Array_Math_Matrix4 │ 1000000 │ ' 5435 ms' │ ' 132 ms' │ ' 92 ms' │ ' 1.43 x' │
1747
+ │ Literal_String │ 1000000 │ ' 17 ms' │ ' 5 ms' │ ' 5 ms' │ ' 1.00 x' │
1748
+ │ Literal_Number │ 1000000 │ ' 14 ms' │ ' 18 ms' │ ' 9 ms' │ ' 2.00 x' │
1749
+ │ Literal_Boolean │ 1000000 │ ' 14 ms' │ ' 20 ms' │ ' 9 ms' │ ' 2.22 x' │
1750
+ │ Primitive_Number │ 1000000 │ ' 17 ms' │ ' 19 ms' │ ' 9 ms' │ ' 2.11 x' │
1751
+ │ Primitive_String │ 1000000 │ ' 17 ms' │ ' 18 ms' │ ' 10 ms' │ ' 1.80 x' │
1752
+ │ Primitive_String_Pattern │ 1000000 │ ' 172 ms' │ ' 46 ms' │ ' 41 ms' │ ' 1.12 x' │
1753
+ │ Primitive_Boolean │ 1000000 │ ' 14 ms' │ ' 19 ms' │ ' 10 ms' │ ' 1.90 x' │
1754
+ │ Primitive_Null │ 1000000 │ ' 16 ms' │ ' 19 ms' │ ' 9 ms' │ ' 2.11 x' │
1755
+ │ Object_Unconstrained │ 1000000 │ ' 437 ms' │ ' 28 ms' │ ' 14 ms' │ ' 2.00 x' │
1756
+ │ Object_Constrained │ 1000000 │ ' 653 ms' │ ' 46 ms' │ ' 37 ms' │ ' 1.24 x' │
1757
+ │ Object_Vector3 │ 1000000 │ ' 201 ms' │ ' 22 ms' │ ' 12 ms' │ ' 1.83 x' │
1758
+ │ Object_Box3D │ 1000000 │ ' 961 ms' │ ' 37 ms' │ ' 19 ms' │ ' 1.95 x' │
1759
+ │ Object_Recursive │ 1000000 │ ' 3715 ms' │ ' 363 ms' │ ' 174 ms' │ ' 2.09 x' │
1760
+ │ Tuple_Primitive │ 1000000 │ ' 107 ms' │ ' 23 ms' │ ' 11 ms' │ ' 2.09 x' │
1761
+ │ Tuple_Object │ 1000000 │ ' 375 ms' │ ' 28 ms' │ ' 15 ms' │ ' 1.87 x' │
1762
+ │ Composite_Intersect │ 1000000 │ ' 377 ms' │ ' 22 ms' │ ' 12 ms' │ ' 1.83 x' │
1763
+ │ Composite_Union │ 1000000 │ ' 337 ms' │ ' 30 ms' │ ' 17 ms' │ ' 1.76 x' │
1764
+ │ Math_Vector4 │ 1000000 │ ' 137 ms' │ ' 23 ms' │ ' 11 ms' │ ' 2.09 x' │
1765
+ │ Math_Matrix4 │ 1000000 │ ' 576 ms' │ ' 37 ms' │ ' 28 ms' │ ' 1.32 x' │
1766
+ │ Array_Primitive_Number │ 1000000 │ ' 145 ms' │ ' 23 ms' │ ' 12 ms' │ ' 1.92 x' │
1767
+ │ Array_Primitive_String │ 1000000 │ ' 152 ms' │ ' 22 ms' │ ' 13 ms' │ ' 1.69 x' │
1768
+ │ Array_Primitive_Boolean │ 1000000 │ ' 131 ms' │ ' 20 ms' │ ' 13 ms' │ ' 1.54 x' │
1769
+ │ Array_Object_Unconstrained │ 1000000 │ ' 2821 ms' │ ' 62 ms' │ ' 45 ms' │ ' 1.38 x' │
1770
+ │ Array_Object_Constrained │ 1000000 │ ' 2958 ms' │ ' 119 ms' │ ' 134 ms' │ ' 0.89 x' │
1771
+ │ Array_Object_Recursive │ 1000000 │ ' 14695 ms' │ ' 1621 ms' │ ' 635 ms' │ ' 2.55 x' │
1772
+ │ Array_Tuple_Primitive │ 1000000 │ ' 478 ms' │ ' 35 ms' │ ' 28 ms' │ ' 1.25 x' │
1773
+ │ Array_Tuple_Object │ 1000000 │ ' 1623 ms' │ ' 63 ms' │ ' 48 ms' │ ' 1.31 x' │
1774
+ │ Array_Composite_Intersect │ 1000000 │ ' 1582 ms' │ ' 43 ms' │ ' 30 ms' │ ' 1.43 x' │
1775
+ │ Array_Composite_Union │ 1000000 │ ' 1331 ms' │ ' 76 ms' │ ' 40 ms' │ ' 1.90 x' │
1776
+ │ Array_Math_Vector4 │ 1000000 │ ' 564 ms' │ ' 38 ms' │ ' 24 ms' │ ' 1.58 x' │
1777
+ │ Array_Math_Matrix4 │ 1000000 │ ' 2382 ms' │ ' 111 ms' │ ' 83 ms' │ ' 1.34 x' │
1794
1778
  └────────────────────────────┴────────────┴──────────────┴──────────────┴──────────────┴──────────────┘
1795
1779
  ```
1796
1780
 
@@ -1802,13 +1786,13 @@ The following table lists esbuild compiled and minified sizes for each TypeBox m
1802
1786
 
1803
1787
  ```typescript
1804
1788
  ┌──────────────────────┬────────────┬────────────┬─────────────┐
1805
- (index) Compiled Minified │ Compression │
1789
+ (index) Compiled Minified │ Compression │
1806
1790
  ├──────────────────────┼────────────┼────────────┼─────────────┤
1807
- │ typebox/compiler │ '126.9 kb' │ ' 55.7 kb' │ '2.28 x'
1808
- │ typebox/errors │ ' 46.1 kb' │ ' 20.8 kb' │ '2.22 x'
1809
- │ typebox/system │ ' 4.7 kb' │ ' 2.0 kb' │ '2.33 x'
1810
- │ typebox/value │ '152.2 kb' │ ' 64.5 kb' │ '2.36 x'
1811
- │ typebox │ ' 95.7 kb' │ ' 39.8 kb' │ '2.40 x'
1791
+ │ typebox/compiler │ '119.6 kb' │ ' 52.6 kb' │ '2.27 x'
1792
+ │ typebox/errors │ ' 48.6 kb' │ ' 21.9 kb' │ '2.22 x'
1793
+ │ typebox/system │ ' 7.4 kb' │ ' 3.2 kb' │ '2.33 x'
1794
+ │ typebox/value │ '157.8 kb' │ ' 66.6 kb' │ '2.37 x'
1795
+ │ typebox │ ' 98.3 kb' │ ' 40.9 kb' │ '2.40 x'
1812
1796
  └──────────────────────┴────────────┴────────────┴─────────────┘
1813
1797
  ```
1814
1798