@sinclair/typebox 0.32.0-dev-13 → 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 (174) 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/guard/type.d.mts +47 -46
  24. package/build/import/type/guard/type.mjs +294 -293
  25. package/build/import/type/indexed/index.d.mts +1 -1
  26. package/build/import/type/indexed/index.mjs +1 -1
  27. package/build/import/type/indexed/{indexed-mapped-result.d.mts → indexed-from-mapped-key.d.mts} +6 -6
  28. package/build/import/type/indexed/indexed-from-mapped-key.mjs +18 -0
  29. package/build/import/type/indexed/indexed-result.d.mts +2 -2
  30. package/build/import/type/indexed/indexed-result.mjs +3 -2
  31. package/build/import/type/indexed/indexed.d.mts +2 -2
  32. package/build/import/type/indexed/indexed.mjs +4 -4
  33. package/build/import/type/intrinsic/capitalize.mjs +1 -2
  34. package/build/import/type/intrinsic/index.d.mts +1 -1
  35. package/build/import/type/intrinsic/index.mjs +1 -1
  36. package/build/import/type/intrinsic/{intrinsic-mapped-result.d.mts → intrinsic-from-mapped-key.d.mts} +6 -5
  37. package/build/import/type/intrinsic/intrinsic-from-mapped-key.mjs +21 -0
  38. package/build/import/type/intrinsic/intrinsic.d.mts +6 -6
  39. package/build/import/type/intrinsic/intrinsic.mjs +8 -8
  40. package/build/import/type/intrinsic/lowercase.mjs +1 -2
  41. package/build/import/type/intrinsic/uncapitalize.mjs +1 -2
  42. package/build/import/type/intrinsic/uppercase.mjs +1 -2
  43. package/build/import/type/keyof/index.d.mts +1 -0
  44. package/build/import/type/keyof/index.mjs +1 -0
  45. package/build/import/type/keyof/keyof-from-mapped-result.d.mts +13 -0
  46. package/build/import/type/keyof/keyof-from-mapped-result.mjs +14 -0
  47. package/build/import/type/keyof/keyof.d.mts +3 -0
  48. package/build/import/type/keyof/keyof.mjs +9 -2
  49. package/build/import/type/mapped/mapped.d.mts +9 -6
  50. package/build/import/type/mapped/mapped.mjs +11 -4
  51. package/build/import/type/omit/index.d.mts +1 -1
  52. package/build/import/type/omit/index.mjs +1 -1
  53. package/build/import/type/omit/omit-from-mapped-key.d.mts +15 -0
  54. package/build/import/type/omit/omit-from-mapped-key.mjs +20 -0
  55. package/build/import/type/omit/omit.d.mts +2 -2
  56. package/build/import/type/omit/omit.mjs +2 -2
  57. package/build/import/type/partial/index.d.mts +1 -0
  58. package/build/import/type/partial/index.mjs +1 -0
  59. package/build/import/type/partial/partial-from-mapped-result.d.mts +13 -0
  60. package/build/import/type/partial/partial-from-mapped-result.mjs +14 -0
  61. package/build/import/type/partial/partial.d.mts +5 -2
  62. package/build/import/type/partial/partial.mjs +11 -5
  63. package/build/import/type/pick/index.d.mts +1 -1
  64. package/build/import/type/pick/index.mjs +1 -1
  65. package/build/import/type/pick/pick-from-mapped-key.d.mts +15 -0
  66. package/build/import/type/pick/pick-from-mapped-key.mjs +20 -0
  67. package/build/import/type/pick/pick.d.mts +2 -2
  68. package/build/import/type/pick/pick.mjs +2 -2
  69. package/build/import/type/required/index.d.mts +1 -0
  70. package/build/import/type/required/index.mjs +1 -0
  71. package/build/import/type/required/required-from-mapped-result.d.mts +13 -0
  72. package/build/import/type/required/required-from-mapped-result.mjs +14 -0
  73. package/build/import/type/required/required.d.mts +5 -2
  74. package/build/import/type/required/required.mjs +11 -5
  75. package/build/import/type/type/json.d.mts +21 -16
  76. package/build/import/type/type/json.mjs +3 -3
  77. package/build/require/index.d.ts +10 -10
  78. package/build/require/index.js +5 -3
  79. package/build/require/type/exclude/exclude-from-mapped-result.d.ts +13 -0
  80. package/build/require/type/exclude/exclude-from-mapped-result.js +18 -0
  81. package/build/require/type/exclude/exclude.d.ts +4 -1
  82. package/build/require/type/exclude/exclude.js +9 -4
  83. package/build/require/type/exclude/index.d.ts +1 -0
  84. package/build/require/type/exclude/index.js +1 -0
  85. package/build/require/type/extends/extends-from-mapped-key.d.ts +17 -0
  86. package/build/require/type/extends/extends-from-mapped-key.js +25 -0
  87. package/build/require/type/extends/extends-from-mapped-result.d.ts +13 -0
  88. package/build/require/type/extends/extends-from-mapped-result.js +18 -0
  89. package/build/require/type/extends/extends.d.ts +4 -4
  90. package/build/require/type/extends/extends.js +4 -4
  91. package/build/require/type/extends/index.d.ts +2 -2
  92. package/build/require/type/extends/index.js +2 -2
  93. package/build/require/type/extract/extract-from-mapped-result.d.ts +13 -0
  94. package/build/require/type/extract/extract-from-mapped-result.js +18 -0
  95. package/build/require/type/extract/extract.d.ts +3 -0
  96. package/build/require/type/extract/extract.js +8 -2
  97. package/build/require/type/extract/index.d.ts +1 -0
  98. package/build/require/type/extract/index.js +1 -0
  99. package/build/require/type/guard/type.d.ts +47 -46
  100. package/build/require/type/guard/type.js +252 -250
  101. package/build/require/type/indexed/index.d.ts +1 -1
  102. package/build/require/type/indexed/index.js +1 -1
  103. package/build/require/type/indexed/{indexed-mapped-result.d.ts → indexed-from-mapped-key.d.ts} +6 -6
  104. package/build/require/type/indexed/indexed-from-mapped-key.js +22 -0
  105. package/build/require/type/indexed/indexed-result.d.ts +2 -2
  106. package/build/require/type/indexed/indexed-result.js +11 -10
  107. package/build/require/type/indexed/indexed.d.ts +2 -2
  108. package/build/require/type/indexed/indexed.js +4 -4
  109. package/build/require/type/intrinsic/capitalize.js +1 -2
  110. package/build/require/type/intrinsic/index.d.ts +1 -1
  111. package/build/require/type/intrinsic/index.js +1 -1
  112. package/build/require/type/intrinsic/{intrinsic-mapped-result.d.ts → intrinsic-from-mapped-key.d.ts} +6 -5
  113. package/build/require/type/intrinsic/intrinsic-from-mapped-key.js +25 -0
  114. package/build/require/type/intrinsic/intrinsic.d.ts +6 -6
  115. package/build/require/type/intrinsic/intrinsic.js +8 -8
  116. package/build/require/type/intrinsic/lowercase.js +1 -2
  117. package/build/require/type/intrinsic/uncapitalize.js +1 -2
  118. package/build/require/type/intrinsic/uppercase.js +1 -2
  119. package/build/require/type/keyof/index.d.ts +1 -0
  120. package/build/require/type/keyof/index.js +1 -0
  121. package/build/require/type/keyof/keyof-from-mapped-result.d.ts +13 -0
  122. package/build/require/type/keyof/keyof-from-mapped-result.js +18 -0
  123. package/build/require/type/keyof/keyof.d.ts +3 -0
  124. package/build/require/type/keyof/keyof.js +9 -2
  125. package/build/require/type/mapped/mapped.d.ts +9 -6
  126. package/build/require/type/mapped/mapped.js +24 -17
  127. package/build/require/type/omit/index.d.ts +1 -1
  128. package/build/require/type/omit/index.js +1 -1
  129. package/build/require/type/omit/omit-from-mapped-key.d.ts +15 -0
  130. package/build/require/type/omit/omit-from-mapped-key.js +24 -0
  131. package/build/require/type/omit/omit.d.ts +2 -2
  132. package/build/require/type/omit/omit.js +2 -2
  133. package/build/require/type/partial/index.d.ts +1 -0
  134. package/build/require/type/partial/index.js +1 -0
  135. package/build/require/type/partial/partial-from-mapped-result.d.ts +13 -0
  136. package/build/require/type/partial/partial-from-mapped-result.js +18 -0
  137. package/build/require/type/partial/partial.d.ts +5 -2
  138. package/build/require/type/partial/partial.js +10 -5
  139. package/build/require/type/pick/index.d.ts +1 -1
  140. package/build/require/type/pick/index.js +1 -1
  141. package/build/require/type/pick/pick-from-mapped-key.d.ts +15 -0
  142. package/build/require/type/pick/pick-from-mapped-key.js +24 -0
  143. package/build/require/type/pick/pick.d.ts +2 -2
  144. package/build/require/type/pick/pick.js +2 -2
  145. package/build/require/type/required/index.d.ts +1 -0
  146. package/build/require/type/required/index.js +1 -0
  147. package/build/require/type/required/required-from-mapped-result.d.ts +13 -0
  148. package/build/require/type/required/required-from-mapped-result.js +18 -0
  149. package/build/require/type/required/required.d.ts +5 -2
  150. package/build/require/type/required/required.js +10 -5
  151. package/build/require/type/type/json.d.ts +21 -16
  152. package/build/require/type/type/json.js +3 -3
  153. package/package.json +1 -1
  154. package/readme.md +79 -91
  155. package/build/import/type/extends/extends-mapped-result-from-result.d.mts +0 -13
  156. package/build/import/type/extends/extends-mapped-result-from-result.mjs +0 -14
  157. package/build/import/type/extends/extends-mapped-result.d.mts +0 -17
  158. package/build/import/type/extends/extends-mapped-result.mjs +0 -21
  159. package/build/import/type/indexed/indexed-mapped-result.mjs +0 -18
  160. package/build/import/type/intrinsic/intrinsic-mapped-result.mjs +0 -21
  161. package/build/import/type/omit/omit-mapped-result.d.mts +0 -15
  162. package/build/import/type/omit/omit-mapped-result.mjs +0 -20
  163. package/build/import/type/pick/pick-mapped-result.d.mts +0 -15
  164. package/build/import/type/pick/pick-mapped-result.mjs +0 -20
  165. package/build/require/type/extends/extends-mapped-result-from-result.d.ts +0 -13
  166. package/build/require/type/extends/extends-mapped-result-from-result.js +0 -18
  167. package/build/require/type/extends/extends-mapped-result.d.ts +0 -17
  168. package/build/require/type/extends/extends-mapped-result.js +0 -25
  169. package/build/require/type/indexed/indexed-mapped-result.js +0 -22
  170. package/build/require/type/intrinsic/intrinsic-mapped-result.js +0 -25
  171. package/build/require/type/omit/omit-mapped-result.d.ts +0 -15
  172. package/build/require/type/omit/omit-mapped-result.js +0 -24
  173. package/build/require/type/pick/pick-mapped-result.d.ts +0 -15
  174. package/build/require/type/pick/pick-mapped-result.js +0 -24
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
 
@@ -1,13 +0,0 @@
1
- import type { TSchema } from '../schema/index.mjs';
2
- import type { TProperties } from '../object/index.mjs';
3
- import { type TMappedResult } from '../mapped/index.mjs';
4
- import { type TExtends } from './extends.mjs';
5
- type MappedResultExtendsPropertyKeys<K extends TProperties, U extends TSchema, L extends TSchema, R extends TSchema> = ({
6
- [K2 in keyof K]: TExtends<K[K2], U, L, R>;
7
- });
8
- declare function MappedResultExtendsPropertyKeys<K extends TProperties, U extends TSchema, L extends TSchema, R extends TSchema>(K: K, U: U, L: L, R: R): MappedResultExtendsPropertyKeys<K, U, L, R>;
9
- type MappedResultExtendsProperties<K extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema> = (MappedResultExtendsPropertyKeys<K['properties'], U, L, R>);
10
- declare function MappedResultExtendsProperties<K extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema>(K: K, U: U, L: L, R: R): MappedResultExtendsProperties<K, U, L, R>;
11
- export type TExtendsMappedResultFromResult<T extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = MappedResultExtendsProperties<T, U, L, R>> = (TMappedResult<P>);
12
- export declare function ExtendsMappedResultFromResult<T extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = MappedResultExtendsProperties<T, U, L, R>>(T: T, U: U, L: L, R: R): TMappedResult<P>;
13
- export {};
@@ -1,14 +0,0 @@
1
- import { MappedResult } from '../mapped/index.mjs';
2
- import { Extends } from './extends.mjs';
3
- function MappedResultExtendsPropertyKeys(K, U, L, R) {
4
- return globalThis.Object.getOwnPropertyNames(K).reduce((Acc, K2) => {
5
- return { ...Acc, [K2]: Extends(K[K2], U, L, R) };
6
- }, {});
7
- }
8
- function MappedResultExtendsProperties(K, U, L, R) {
9
- return MappedResultExtendsPropertyKeys(K.properties, U, L, R);
10
- }
11
- export function ExtendsMappedResultFromResult(T, U, L, R) {
12
- const P = MappedResultExtendsProperties(T, U, L, R);
13
- return MappedResult(P);
14
- }
@@ -1,17 +0,0 @@
1
- import type { TSchema } from '../schema/index.mjs';
2
- import type { TProperties } from '../object/index.mjs';
3
- import type { Assert } from '../helpers/index.mjs';
4
- import { type TMappedResult, type TMappedKey } from '../mapped/index.mjs';
5
- import { TLiteral, TLiteralValue } from '../literal/index.mjs';
6
- import { type TExtends } from './extends.mjs';
7
- type MappedExtendsPropertyKey<K extends PropertyKey, U extends TSchema, L extends TSchema, R extends TSchema> = {
8
- [_ in K]: TExtends<TLiteral<Assert<K, TLiteralValue>>, U, L, R>;
9
- };
10
- declare function MappedExtendsPropertyKey<K extends PropertyKey, U extends TSchema, L extends TSchema, R extends TSchema>(K: K, U: U, L: L, R: R): MappedExtendsPropertyKey<K, U, L, R>;
11
- type MappedExtendsPropertyKeys<K extends PropertyKey[], U extends TSchema, L extends TSchema, R extends TSchema> = (K extends [infer LK extends PropertyKey, ...infer RK extends PropertyKey[]] ? MappedExtendsPropertyKey<LK, U, L, R> & MappedExtendsPropertyKeys<RK, U, L, R> : {});
12
- declare function MappedExtendsPropertyKeys<K extends PropertyKey[], U extends TSchema, L extends TSchema, R extends TSchema>(K: [...K], U: U, L: L, R: R): MappedExtendsPropertyKeys<K, U, L, R>;
13
- type MappedExtendsProperties<K extends TMappedKey, U extends TSchema, L extends TSchema, R extends TSchema> = (MappedExtendsPropertyKeys<K['keys'], U, L, R>);
14
- declare function MappedExtendsProperties<K extends TMappedKey, U extends TSchema, L extends TSchema, R extends TSchema>(K: K, U: U, L: L, R: R): MappedExtendsProperties<K, U, L, R>;
15
- export type TExtendsMappedResult<T extends TMappedKey, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = MappedExtendsProperties<T, U, L, R>> = (TMappedResult<P>);
16
- export declare function ExtendsMappedResult<T extends TMappedKey, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = MappedExtendsProperties<T, U, L, R>>(T: T, U: U, L: L, R: R): TMappedResult<P>;
17
- export {};
@@ -1,21 +0,0 @@
1
- import { MappedResult } from '../mapped/index.mjs';
2
- import { Literal } from '../literal/index.mjs';
3
- import { Extends } from './extends.mjs';
4
- function MappedExtendsPropertyKey(K, U, L, R) {
5
- return {
6
- [K]: Extends(Literal(K), U, L, R)
7
- };
8
- }
9
- function MappedExtendsPropertyKeys(K, U, L, R) {
10
- const [LK, ...RK] = K;
11
- return (K.length > 0
12
- ? { ...MappedExtendsPropertyKey(LK, U, L, R), ...MappedExtendsPropertyKeys(RK, U, L, R) }
13
- : {});
14
- }
15
- function MappedExtendsProperties(K, U, L, R) {
16
- return MappedExtendsPropertyKeys(K.keys, U, L, R);
17
- }
18
- export function ExtendsMappedResult(T, U, L, R) {
19
- const P = MappedExtendsProperties(T, U, L, R);
20
- return MappedResult(P);
21
- }
@@ -1,18 +0,0 @@
1
- import { IndexResult } from './indexed-result.mjs';
2
- import { MappedResult } from '../mapped/index.mjs';
3
- function MappedIndexPropertyKey(T, K) {
4
- return { [K]: IndexResult(T, [K]) };
5
- }
6
- function MappedIndexPropertyKeys(T, K) {
7
- const [L, ...R] = K;
8
- return (K.length > 0
9
- ? { ...MappedIndexPropertyKey(T, L), ...MappedIndexPropertyKeys(T, R) }
10
- : {});
11
- }
12
- function MappedIndexProperties(T, K) {
13
- return MappedIndexPropertyKeys(T, K.keys);
14
- }
15
- export function IndexMappedResult(T, K) {
16
- const P = MappedIndexProperties(T, K);
17
- return MappedResult(P);
18
- }
@@ -1,21 +0,0 @@
1
- import { MappedResult } from '../mapped/index.mjs';
2
- import { Intrinsic } from './intrinsic.mjs';
3
- import { Literal } from '../literal/index.mjs';
4
- function MappedIntrinsicPropertyKey(K, M) {
5
- return {
6
- [K]: Intrinsic(Literal(K), M)
7
- };
8
- }
9
- function MappedIntrinsicPropertyKeys(K, M) {
10
- const [L, ...R] = K;
11
- return (K.length > 0
12
- ? { ...MappedIntrinsicPropertyKey(L, M), ...MappedIntrinsicPropertyKeys(R, M) }
13
- : {});
14
- }
15
- function MappedIntrinsicProperties(T, M) {
16
- return MappedIntrinsicPropertyKeys(T['keys'], M);
17
- }
18
- export function IntrinsicMappedResult(T, M) {
19
- const P = MappedIntrinsicProperties(T, M);
20
- return MappedResult(P);
21
- }
@@ -1,15 +0,0 @@
1
- import type { TSchema } from '../schema/index.mjs';
2
- import type { TProperties } from '../object/index.mjs';
3
- import { type TMappedResult, type TMappedKey } from '../mapped/index.mjs';
4
- import { type TOmit } from './omit.mjs';
5
- type MappedOmitPropertyKey<T extends TSchema, K extends PropertyKey> = {
6
- [_ in K]: TOmit<T, [K]>;
7
- };
8
- declare function MappedOmitPropertyKey<T extends TSchema, K extends PropertyKey>(T: T, K: K): MappedOmitPropertyKey<T, K>;
9
- type MappedOmitPropertyKeys<T extends TSchema, K extends PropertyKey[]> = (K extends [infer LK extends PropertyKey, ...infer RK extends PropertyKey[]] ? MappedOmitPropertyKey<T, LK> & MappedOmitPropertyKeys<T, RK> : {});
10
- declare function MappedOmitPropertyKeys<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K]): MappedOmitPropertyKeys<T, K>;
11
- type MappedOmitProperties<T extends TSchema, K extends TMappedKey> = (MappedOmitPropertyKeys<T, K['keys']>);
12
- declare function MappedOmitProperties<T extends TSchema, K extends TMappedKey>(T: T, K: K): MappedOmitProperties<T, K>;
13
- export type TOmitMappedResult<T extends TSchema, K extends TMappedKey, P extends TProperties = MappedOmitProperties<T, K>> = (TMappedResult<P>);
14
- export declare function OmitMappedResult<T extends TSchema, K extends TMappedKey, P extends TProperties = MappedOmitProperties<T, K>>(T: T, K: K): TMappedResult<P>;
15
- export {};
@@ -1,20 +0,0 @@
1
- import { MappedResult } from '../mapped/index.mjs';
2
- import { Omit } from './omit.mjs';
3
- function MappedOmitPropertyKey(T, K) {
4
- return {
5
- [K]: Omit(T, [K])
6
- };
7
- }
8
- function MappedOmitPropertyKeys(T, K) {
9
- const [LK, ...RK] = K;
10
- return (K.length > 0
11
- ? { ...MappedOmitPropertyKey(T, LK), ...MappedOmitPropertyKeys(T, RK) }
12
- : {});
13
- }
14
- function MappedOmitProperties(T, K) {
15
- return MappedOmitPropertyKeys(T, K.keys);
16
- }
17
- export function OmitMappedResult(T, K) {
18
- const P = MappedOmitProperties(T, K);
19
- return MappedResult(P);
20
- }
@@ -1,15 +0,0 @@
1
- import type { TSchema } from '../schema/index.mjs';
2
- import type { TProperties } from '../object/index.mjs';
3
- import { type TMappedResult, type TMappedKey } from '../mapped/index.mjs';
4
- import { type TPick } from './pick.mjs';
5
- type MappedPickPropertyKey<T extends TSchema, K extends PropertyKey> = {
6
- [_ in K]: TPick<T, [K]>;
7
- };
8
- declare function MappedPickPropertyKey<T extends TSchema, K extends PropertyKey>(T: T, K: K): MappedPickPropertyKey<T, K>;
9
- type MappedPickPropertyKeys<T extends TSchema, K extends PropertyKey[]> = (K extends [infer LK extends PropertyKey, ...infer RK extends PropertyKey[]] ? MappedPickPropertyKey<T, LK> & MappedPickPropertyKeys<T, RK> : {});
10
- declare function MappedPickPropertyKeys<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K]): MappedPickPropertyKeys<T, K>;
11
- type MappedPickProperties<T extends TSchema, K extends TMappedKey> = (MappedPickPropertyKeys<T, K['keys']>);
12
- declare function MappedPickProperties<T extends TSchema, K extends TMappedKey>(T: T, K: K): MappedPickProperties<T, K>;
13
- export type TPickMappedResult<T extends TSchema, K extends TMappedKey, P extends TProperties = MappedPickProperties<T, K>> = (TMappedResult<P>);
14
- export declare function PickMappedResult<T extends TSchema, K extends TMappedKey, P extends TProperties = MappedPickProperties<T, K>>(T: T, K: K): TMappedResult<P>;
15
- export {};
@@ -1,20 +0,0 @@
1
- import { MappedResult } from '../mapped/index.mjs';
2
- import { Pick } from './pick.mjs';
3
- function MappedPickPropertyKey(T, K) {
4
- return {
5
- [K]: Pick(T, [K])
6
- };
7
- }
8
- function MappedPickPropertyKeys(T, K) {
9
- const [LK, ...RK] = K;
10
- return (K.length > 0
11
- ? { ...MappedPickPropertyKey(T, LK), ...MappedPickPropertyKeys(T, RK) }
12
- : {});
13
- }
14
- function MappedPickProperties(T, K) {
15
- return MappedPickPropertyKeys(T, K.keys);
16
- }
17
- export function PickMappedResult(T, K) {
18
- const P = MappedPickProperties(T, K);
19
- return MappedResult(P);
20
- }
@@ -1,13 +0,0 @@
1
- import type { TSchema } from '../schema/index';
2
- import type { TProperties } from '../object/index';
3
- import { type TMappedResult } from '../mapped/index';
4
- import { type TExtends } from './extends';
5
- type MappedResultExtendsPropertyKeys<K extends TProperties, U extends TSchema, L extends TSchema, R extends TSchema> = ({
6
- [K2 in keyof K]: TExtends<K[K2], U, L, R>;
7
- });
8
- declare function MappedResultExtendsPropertyKeys<K extends TProperties, U extends TSchema, L extends TSchema, R extends TSchema>(K: K, U: U, L: L, R: R): MappedResultExtendsPropertyKeys<K, U, L, R>;
9
- type MappedResultExtendsProperties<K extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema> = (MappedResultExtendsPropertyKeys<K['properties'], U, L, R>);
10
- declare function MappedResultExtendsProperties<K extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema>(K: K, U: U, L: L, R: R): MappedResultExtendsProperties<K, U, L, R>;
11
- export type TExtendsMappedResultFromResult<T extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = MappedResultExtendsProperties<T, U, L, R>> = (TMappedResult<P>);
12
- export declare function ExtendsMappedResultFromResult<T extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = MappedResultExtendsProperties<T, U, L, R>>(T: T, U: U, L: L, R: R): TMappedResult<P>;
13
- export {};
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExtendsMappedResultFromResult = void 0;
4
- const index_1 = require("../mapped/index");
5
- const extends_1 = require("./extends");
6
- function MappedResultExtendsPropertyKeys(K, U, L, R) {
7
- return globalThis.Object.getOwnPropertyNames(K).reduce((Acc, K2) => {
8
- return { ...Acc, [K2]: (0, extends_1.Extends)(K[K2], U, L, R) };
9
- }, {});
10
- }
11
- function MappedResultExtendsProperties(K, U, L, R) {
12
- return MappedResultExtendsPropertyKeys(K.properties, U, L, R);
13
- }
14
- function ExtendsMappedResultFromResult(T, U, L, R) {
15
- const P = MappedResultExtendsProperties(T, U, L, R);
16
- return (0, index_1.MappedResult)(P);
17
- }
18
- exports.ExtendsMappedResultFromResult = ExtendsMappedResultFromResult;
@@ -1,17 +0,0 @@
1
- import type { TSchema } from '../schema/index';
2
- import type { TProperties } from '../object/index';
3
- import type { Assert } from '../helpers/index';
4
- import { type TMappedResult, type TMappedKey } from '../mapped/index';
5
- import { TLiteral, TLiteralValue } from '../literal/index';
6
- import { type TExtends } from './extends';
7
- type MappedExtendsPropertyKey<K extends PropertyKey, U extends TSchema, L extends TSchema, R extends TSchema> = {
8
- [_ in K]: TExtends<TLiteral<Assert<K, TLiteralValue>>, U, L, R>;
9
- };
10
- declare function MappedExtendsPropertyKey<K extends PropertyKey, U extends TSchema, L extends TSchema, R extends TSchema>(K: K, U: U, L: L, R: R): MappedExtendsPropertyKey<K, U, L, R>;
11
- type MappedExtendsPropertyKeys<K extends PropertyKey[], U extends TSchema, L extends TSchema, R extends TSchema> = (K extends [infer LK extends PropertyKey, ...infer RK extends PropertyKey[]] ? MappedExtendsPropertyKey<LK, U, L, R> & MappedExtendsPropertyKeys<RK, U, L, R> : {});
12
- declare function MappedExtendsPropertyKeys<K extends PropertyKey[], U extends TSchema, L extends TSchema, R extends TSchema>(K: [...K], U: U, L: L, R: R): MappedExtendsPropertyKeys<K, U, L, R>;
13
- type MappedExtendsProperties<K extends TMappedKey, U extends TSchema, L extends TSchema, R extends TSchema> = (MappedExtendsPropertyKeys<K['keys'], U, L, R>);
14
- declare function MappedExtendsProperties<K extends TMappedKey, U extends TSchema, L extends TSchema, R extends TSchema>(K: K, U: U, L: L, R: R): MappedExtendsProperties<K, U, L, R>;
15
- export type TExtendsMappedResult<T extends TMappedKey, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = MappedExtendsProperties<T, U, L, R>> = (TMappedResult<P>);
16
- export declare function ExtendsMappedResult<T extends TMappedKey, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = MappedExtendsProperties<T, U, L, R>>(T: T, U: U, L: L, R: R): TMappedResult<P>;
17
- export {};
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExtendsMappedResult = void 0;
4
- const index_1 = require("../mapped/index");
5
- const index_2 = require("../literal/index");
6
- const extends_1 = require("./extends");
7
- function MappedExtendsPropertyKey(K, U, L, R) {
8
- return {
9
- [K]: (0, extends_1.Extends)((0, index_2.Literal)(K), U, L, R)
10
- };
11
- }
12
- function MappedExtendsPropertyKeys(K, U, L, R) {
13
- const [LK, ...RK] = K;
14
- return (K.length > 0
15
- ? { ...MappedExtendsPropertyKey(LK, U, L, R), ...MappedExtendsPropertyKeys(RK, U, L, R) }
16
- : {});
17
- }
18
- function MappedExtendsProperties(K, U, L, R) {
19
- return MappedExtendsPropertyKeys(K.keys, U, L, R);
20
- }
21
- function ExtendsMappedResult(T, U, L, R) {
22
- const P = MappedExtendsProperties(T, U, L, R);
23
- return (0, index_1.MappedResult)(P);
24
- }
25
- exports.ExtendsMappedResult = ExtendsMappedResult;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IndexMappedResult = void 0;
4
- const indexed_result_1 = require("./indexed-result");
5
- const index_1 = require("../mapped/index");
6
- function MappedIndexPropertyKey(T, K) {
7
- return { [K]: (0, indexed_result_1.IndexResult)(T, [K]) };
8
- }
9
- function MappedIndexPropertyKeys(T, K) {
10
- const [L, ...R] = K;
11
- return (K.length > 0
12
- ? { ...MappedIndexPropertyKey(T, L), ...MappedIndexPropertyKeys(T, R) }
13
- : {});
14
- }
15
- function MappedIndexProperties(T, K) {
16
- return MappedIndexPropertyKeys(T, K.keys);
17
- }
18
- function IndexMappedResult(T, K) {
19
- const P = MappedIndexProperties(T, K);
20
- return (0, index_1.MappedResult)(P);
21
- }
22
- exports.IndexMappedResult = IndexMappedResult;