@sinclair/typebox 0.34.0 → 0.34.2

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 (146) hide show
  1. package/build/cjs/syntax/runtime.d.ts +4 -1
  2. package/build/cjs/syntax/runtime.js +3 -1
  3. package/build/cjs/syntax/static.d.ts +3 -3
  4. package/build/cjs/type/array/array.d.ts +1 -1
  5. package/build/cjs/type/awaited/awaited.d.ts +8 -3
  6. package/build/cjs/type/awaited/awaited.js +20 -20
  7. package/build/cjs/type/computed/computed.d.ts +9 -0
  8. package/build/cjs/type/computed/computed.js +10 -0
  9. package/build/cjs/type/computed/index.d.ts +1 -0
  10. package/build/cjs/type/computed/index.js +18 -0
  11. package/build/cjs/type/guard/kind.d.ts +9 -4
  12. package/build/cjs/type/guard/kind.js +10 -0
  13. package/build/cjs/type/guard/type.d.ts +6 -3
  14. package/build/cjs/type/guard/type.js +6 -0
  15. package/build/cjs/type/indexed/indexed-from-mapped-key.d.ts +6 -6
  16. package/build/cjs/type/indexed/indexed-from-mapped-key.js +10 -10
  17. package/build/cjs/type/indexed/indexed-from-mapped-result.d.ts +5 -5
  18. package/build/cjs/type/indexed/indexed-from-mapped-result.js +11 -10
  19. package/build/cjs/type/indexed/indexed-property-keys.d.ts +6 -6
  20. package/build/cjs/type/indexed/indexed-property-keys.js +14 -14
  21. package/build/cjs/type/indexed/indexed.d.ts +34 -20
  22. package/build/cjs/type/indexed/indexed.js +59 -46
  23. package/build/cjs/type/intersect/intersect-evaluated.d.ts +6 -6
  24. package/build/cjs/type/intersect/intersect-evaluated.js +16 -16
  25. package/build/cjs/type/intersect/intersect.d.ts +2 -2
  26. package/build/cjs/type/intersect/intersect.js +6 -6
  27. package/build/cjs/type/keyof/keyof-from-mapped-result.d.ts +6 -6
  28. package/build/cjs/type/keyof/keyof-from-mapped-result.js +10 -10
  29. package/build/cjs/type/keyof/keyof-property-keys.d.ts +7 -7
  30. package/build/cjs/type/keyof/keyof-property-keys.js +22 -22
  31. package/build/cjs/type/keyof/keyof.d.ts +11 -6
  32. package/build/cjs/type/keyof/keyof.js +22 -13
  33. package/build/cjs/type/module/compute.d.ts +54 -0
  34. package/build/cjs/type/module/compute.js +154 -0
  35. package/build/cjs/type/module/infer.d.ts +43 -0
  36. package/build/cjs/type/module/infer.js +3 -0
  37. package/build/cjs/type/module/module.d.ts +8 -52
  38. package/build/cjs/type/module/module.js +14 -11
  39. package/build/cjs/type/not/not.d.ts +1 -1
  40. package/build/cjs/type/not/not.js +2 -2
  41. package/build/cjs/type/omit/omit-from-mapped-key.d.ts +6 -6
  42. package/build/cjs/type/omit/omit-from-mapped-key.js +10 -12
  43. package/build/cjs/type/omit/omit-from-mapped-result.d.ts +5 -5
  44. package/build/cjs/type/omit/omit-from-mapped-result.js +10 -10
  45. package/build/cjs/type/omit/omit.d.ts +26 -14
  46. package/build/cjs/type/omit/omit.js +46 -35
  47. package/build/cjs/type/partial/partial.d.ts +11 -7
  48. package/build/cjs/type/partial/partial.js +36 -24
  49. package/build/cjs/type/pick/pick-from-mapped-key.d.ts +6 -6
  50. package/build/cjs/type/pick/pick-from-mapped-key.js +10 -10
  51. package/build/cjs/type/pick/pick-from-mapped-result.d.ts +5 -5
  52. package/build/cjs/type/pick/pick-from-mapped-result.js +10 -10
  53. package/build/cjs/type/pick/pick.d.ts +25 -15
  54. package/build/cjs/type/pick/pick.js +47 -36
  55. package/build/cjs/type/record/record.d.ts +4 -2
  56. package/build/cjs/type/record/record.js +31 -28
  57. package/build/cjs/type/required/required.d.ts +12 -8
  58. package/build/cjs/type/required/required.js +37 -25
  59. package/build/cjs/type/tuple/tuple.d.ts +1 -1
  60. package/build/cjs/type/tuple/tuple.js +4 -4
  61. package/build/cjs/type/type/javascript.d.ts +10 -10
  62. package/build/cjs/type/type/javascript.js +6 -6
  63. package/build/cjs/type/type/json.d.ts +41 -51
  64. package/build/cjs/type/type/json.js +40 -40
  65. package/build/cjs/type/union/union-evaluated.d.ts +6 -6
  66. package/build/cjs/type/union/union-evaluated.js +11 -10
  67. package/build/cjs/type/union/union.d.ts +1 -1
  68. package/build/cjs/type/union/union.js +4 -4
  69. package/build/cjs/value/check/check.js +3 -3
  70. package/build/cjs/value/transform/decode.js +7 -7
  71. package/build/cjs/value/transform/encode.js +7 -7
  72. package/build/cjs/value/transform/has.js +18 -18
  73. package/build/esm/syntax/runtime.d.mts +4 -1
  74. package/build/esm/syntax/runtime.mjs +3 -1
  75. package/build/esm/syntax/static.d.mts +3 -3
  76. package/build/esm/type/array/array.d.mts +1 -1
  77. package/build/esm/type/awaited/awaited.d.mts +8 -3
  78. package/build/esm/type/awaited/awaited.mjs +20 -20
  79. package/build/esm/type/computed/computed.d.mts +9 -0
  80. package/build/esm/type/computed/computed.mjs +6 -0
  81. package/build/esm/type/computed/index.d.mts +1 -0
  82. package/build/esm/type/computed/index.mjs +1 -0
  83. package/build/esm/type/guard/kind.d.mts +9 -4
  84. package/build/esm/type/guard/kind.mjs +8 -0
  85. package/build/esm/type/guard/type.d.mts +6 -3
  86. package/build/esm/type/guard/type.mjs +5 -0
  87. package/build/esm/type/indexed/indexed-from-mapped-key.d.mts +6 -6
  88. package/build/esm/type/indexed/indexed-from-mapped-key.mjs +10 -10
  89. package/build/esm/type/indexed/indexed-from-mapped-result.d.mts +5 -5
  90. package/build/esm/type/indexed/indexed-from-mapped-result.mjs +11 -10
  91. package/build/esm/type/indexed/indexed-property-keys.d.mts +6 -6
  92. package/build/esm/type/indexed/indexed-property-keys.mjs +14 -14
  93. package/build/esm/type/indexed/indexed.d.mts +34 -20
  94. package/build/esm/type/indexed/indexed.mjs +55 -42
  95. package/build/esm/type/intersect/intersect-evaluated.d.mts +6 -6
  96. package/build/esm/type/intersect/intersect-evaluated.mjs +16 -16
  97. package/build/esm/type/intersect/intersect.d.mts +2 -2
  98. package/build/esm/type/intersect/intersect.mjs +6 -6
  99. package/build/esm/type/keyof/keyof-from-mapped-result.d.mts +6 -6
  100. package/build/esm/type/keyof/keyof-from-mapped-result.mjs +10 -10
  101. package/build/esm/type/keyof/keyof-property-keys.d.mts +7 -7
  102. package/build/esm/type/keyof/keyof-property-keys.mjs +22 -22
  103. package/build/esm/type/keyof/keyof.d.mts +11 -6
  104. package/build/esm/type/keyof/keyof.mjs +22 -13
  105. package/build/esm/type/module/compute.d.mts +54 -0
  106. package/build/esm/type/module/compute.mjs +148 -0
  107. package/build/esm/type/module/infer.d.mts +43 -0
  108. package/build/esm/type/module/infer.mjs +1 -0
  109. package/build/esm/type/module/module.d.mts +8 -52
  110. package/build/esm/type/module/module.mjs +14 -11
  111. package/build/esm/type/not/not.d.mts +1 -1
  112. package/build/esm/type/not/not.mjs +2 -2
  113. package/build/esm/type/omit/omit-from-mapped-key.d.mts +6 -6
  114. package/build/esm/type/omit/omit-from-mapped-key.mjs +10 -12
  115. package/build/esm/type/omit/omit-from-mapped-result.d.mts +5 -5
  116. package/build/esm/type/omit/omit-from-mapped-result.mjs +10 -10
  117. package/build/esm/type/omit/omit.d.mts +26 -14
  118. package/build/esm/type/omit/omit.mjs +43 -32
  119. package/build/esm/type/partial/partial.d.mts +11 -7
  120. package/build/esm/type/partial/partial.mjs +29 -17
  121. package/build/esm/type/pick/pick-from-mapped-key.d.mts +6 -6
  122. package/build/esm/type/pick/pick-from-mapped-key.mjs +10 -10
  123. package/build/esm/type/pick/pick-from-mapped-result.d.mts +5 -5
  124. package/build/esm/type/pick/pick-from-mapped-result.mjs +10 -10
  125. package/build/esm/type/pick/pick.d.mts +25 -15
  126. package/build/esm/type/pick/pick.mjs +43 -32
  127. package/build/esm/type/record/record.d.mts +4 -2
  128. package/build/esm/type/record/record.mjs +15 -12
  129. package/build/esm/type/required/required.d.mts +12 -8
  130. package/build/esm/type/required/required.mjs +33 -21
  131. package/build/esm/type/tuple/tuple.d.mts +1 -1
  132. package/build/esm/type/tuple/tuple.mjs +4 -4
  133. package/build/esm/type/type/javascript.d.mts +10 -10
  134. package/build/esm/type/type/javascript.mjs +6 -6
  135. package/build/esm/type/type/json.d.mts +41 -51
  136. package/build/esm/type/type/json.mjs +40 -40
  137. package/build/esm/type/union/union-evaluated.d.mts +6 -6
  138. package/build/esm/type/union/union-evaluated.mjs +11 -10
  139. package/build/esm/type/union/union.d.mts +1 -1
  140. package/build/esm/type/union/union.mjs +4 -4
  141. package/build/esm/value/check/check.mjs +2 -2
  142. package/build/esm/value/transform/decode.mjs +2 -2
  143. package/build/esm/value/transform/encode.mjs +2 -2
  144. package/build/esm/value/transform/has.mjs +2 -2
  145. package/package.json +1 -1
  146. package/readme.md +30 -19
@@ -17,9 +17,9 @@ const index_9 = require("../../type/never/index");
17
17
  // ------------------------------------------------------------------
18
18
  const index_10 = require("../guard/index");
19
19
  // ------------------------------------------------------------------
20
- // TypeGuard
20
+ // KindGuard
21
21
  // ------------------------------------------------------------------
22
- const type_1 = require("../../type/guard/type");
22
+ const kind_1 = require("../../type/guard/kind");
23
23
  // ------------------------------------------------------------------
24
24
  // Errors
25
25
  // ------------------------------------------------------------------
@@ -174,7 +174,7 @@ function FromIntersect(schema, references, value) {
174
174
  const check2 = Object.getOwnPropertyNames(value).every((key) => keyPattern.test(key));
175
175
  return check1 && check2;
176
176
  }
177
- else if ((0, type_1.IsSchema)(schema.unevaluatedProperties)) {
177
+ else if ((0, kind_1.IsSchema)(schema.unevaluatedProperties)) {
178
178
  const keyCheck = new RegExp((0, index_5.KeyOfPattern)(schema));
179
179
  const check2 = Object.getOwnPropertyNames(value).every((key) => keyCheck.test(key) || Visit(schema.unevaluatedProperties, references, value[key]));
180
180
  return check1 && check2;
@@ -14,9 +14,9 @@ const index_5 = require("../check/index");
14
14
  // ------------------------------------------------------------------
15
15
  const index_6 = require("../guard/index");
16
16
  // ------------------------------------------------------------------
17
- // TypeGuard
17
+ // KindGuard
18
18
  // ------------------------------------------------------------------
19
- const type_1 = require("../../type/guard/type");
19
+ const kind_1 = require("../../type/guard/kind");
20
20
  // ------------------------------------------------------------------
21
21
  // Errors
22
22
  // ------------------------------------------------------------------
@@ -48,7 +48,7 @@ exports.TransformDecodeError = TransformDecodeError;
48
48
  // prettier-ignore
49
49
  function Default(schema, path, value) {
50
50
  try {
51
- return (0, type_1.IsTransform)(schema) ? schema[index_1.TransformKind].Decode(value) : value;
51
+ return (0, kind_1.IsTransform)(schema) ? schema[index_1.TransformKind].Decode(value) : value;
52
52
  }
53
53
  catch (error) {
54
54
  throw new TransformDecodeError(schema, path, value, error);
@@ -71,7 +71,7 @@ function FromIntersect(schema, references, path, value) {
71
71
  if (knownKey in knownProperties) {
72
72
  knownProperties[knownKey] = Visit(knownSchema, references, `${path}/${knownKey}`, knownProperties[knownKey]);
73
73
  }
74
- if (!(0, type_1.IsTransform)(schema.unevaluatedProperties)) {
74
+ if (!(0, kind_1.IsTransform)(schema.unevaluatedProperties)) {
75
75
  return Default(schema, path, knownProperties);
76
76
  }
77
77
  const unknownKeys = Object.getOwnPropertyNames(knownProperties);
@@ -107,13 +107,13 @@ function FromObject(schema, references, path, value) {
107
107
  // if the property value is undefined, but the target is not, nor does it satisfy exact optional
108
108
  // property policy, then we need to continue. This is a special case for optional property handling
109
109
  // where a transforms wrapped in a optional modifiers should not run.
110
- if ((0, index_6.IsUndefined)(knownProperties[key]) && (!(0, type_1.IsUndefined)(schema.properties[key]) ||
110
+ if ((0, index_6.IsUndefined)(knownProperties[key]) && (!(0, kind_1.IsUndefined)(schema.properties[key]) ||
111
111
  policy_1.TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
112
112
  continue;
113
113
  // decode property
114
114
  knownProperties[key] = Visit(schema.properties[key], references, `${path}/${key}`, knownProperties[key]);
115
115
  }
116
- if (!(0, type_1.IsSchema)(schema.additionalProperties)) {
116
+ if (!(0, kind_1.IsSchema)(schema.additionalProperties)) {
117
117
  return Default(schema, path, knownProperties);
118
118
  }
119
119
  const unknownKeys = Object.getOwnPropertyNames(knownProperties);
@@ -136,7 +136,7 @@ function FromRecord(schema, references, path, value) {
136
136
  if (knownKeys.test(key)) {
137
137
  knownProperties[key] = Visit(schema.patternProperties[pattern], references, `${path}/${key}`, knownProperties[key]);
138
138
  }
139
- if (!(0, type_1.IsSchema)(schema.additionalProperties)) {
139
+ if (!(0, kind_1.IsSchema)(schema.additionalProperties)) {
140
140
  return Default(schema, path, knownProperties);
141
141
  }
142
142
  const unknownKeys = Object.getOwnPropertyNames(knownProperties);
@@ -14,9 +14,9 @@ const index_5 = require("../check/index");
14
14
  // ------------------------------------------------------------------
15
15
  const index_6 = require("../guard/index");
16
16
  // ------------------------------------------------------------------
17
- // TypeGuard
17
+ // KindGuard
18
18
  // ------------------------------------------------------------------
19
- const type_1 = require("../../type/guard/type");
19
+ const kind_1 = require("../../type/guard/kind");
20
20
  // ------------------------------------------------------------------
21
21
  // Errors
22
22
  // ------------------------------------------------------------------
@@ -47,7 +47,7 @@ exports.TransformEncodeError = TransformEncodeError;
47
47
  // prettier-ignore
48
48
  function Default(schema, path, value) {
49
49
  try {
50
- return (0, type_1.IsTransform)(schema) ? schema[index_1.TransformKind].Encode(value) : value;
50
+ return (0, kind_1.IsTransform)(schema) ? schema[index_1.TransformKind].Encode(value) : value;
51
51
  }
52
52
  catch (error) {
53
53
  throw new TransformEncodeError(schema, path, value, error);
@@ -81,7 +81,7 @@ function FromIntersect(schema, references, path, value) {
81
81
  if (knownKey in knownProperties) {
82
82
  knownProperties[knownKey] = Visit(knownSchema, references, `${path}/${knownKey}`, knownProperties[knownKey]);
83
83
  }
84
- if (!(0, type_1.IsTransform)(schema.unevaluatedProperties)) {
84
+ if (!(0, kind_1.IsTransform)(schema.unevaluatedProperties)) {
85
85
  return knownProperties;
86
86
  }
87
87
  const unknownKeys = Object.getOwnPropertyNames(knownProperties);
@@ -110,13 +110,13 @@ function FromObject(schema, references, path, value) {
110
110
  // if the property value is undefined, but the target is not, nor does it satisfy exact optional
111
111
  // property policy, then we need to continue. This is a special case for optional property handling
112
112
  // where a transforms wrapped in a optional modifiers should not run.
113
- if ((0, index_6.IsUndefined)(knownProperties[key]) && (!(0, type_1.IsUndefined)(schema.properties[key]) ||
113
+ if ((0, index_6.IsUndefined)(knownProperties[key]) && (!(0, kind_1.IsUndefined)(schema.properties[key]) ||
114
114
  policy_1.TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
115
115
  continue;
116
116
  // encode property
117
117
  knownProperties[key] = Visit(schema.properties[key], references, `${path}/${key}`, knownProperties[key]);
118
118
  }
119
- if (!(0, type_1.IsSchema)(schema.additionalProperties)) {
119
+ if (!(0, kind_1.IsSchema)(schema.additionalProperties)) {
120
120
  return knownProperties;
121
121
  }
122
122
  const unknownKeys = Object.getOwnPropertyNames(knownProperties);
@@ -140,7 +140,7 @@ function FromRecord(schema, references, path, value) {
140
140
  if (knownKeys.test(key)) {
141
141
  knownProperties[key] = Visit(schema.patternProperties[pattern], references, `${path}/${key}`, knownProperties[key]);
142
142
  }
143
- if (!(0, type_1.IsSchema)(schema.additionalProperties)) {
143
+ if (!(0, kind_1.IsSchema)(schema.additionalProperties)) {
144
144
  return knownProperties;
145
145
  }
146
146
  const unknownKeys = Object.getOwnPropertyNames(knownProperties);
@@ -5,76 +5,76 @@ exports.HasTransform = HasTransform;
5
5
  const index_1 = require("../deref/index");
6
6
  const index_2 = require("../../type/symbols/index");
7
7
  // ------------------------------------------------------------------
8
- // TypeGuard
8
+ // KindGuard
9
9
  // ------------------------------------------------------------------
10
- const type_1 = require("../../type/guard/type");
10
+ const kind_1 = require("../../type/guard/kind");
11
11
  // ------------------------------------------------------------------
12
12
  // ValueGuard
13
13
  // ------------------------------------------------------------------
14
14
  const index_3 = require("../guard/index");
15
15
  // prettier-ignore
16
16
  function FromArray(schema, references) {
17
- return (0, type_1.IsTransform)(schema) || Visit(schema.items, references);
17
+ return (0, kind_1.IsTransform)(schema) || Visit(schema.items, references);
18
18
  }
19
19
  // prettier-ignore
20
20
  function FromAsyncIterator(schema, references) {
21
- return (0, type_1.IsTransform)(schema) || Visit(schema.items, references);
21
+ return (0, kind_1.IsTransform)(schema) || Visit(schema.items, references);
22
22
  }
23
23
  // prettier-ignore
24
24
  function FromConstructor(schema, references) {
25
- return (0, type_1.IsTransform)(schema) || Visit(schema.returns, references) || schema.parameters.some((schema) => Visit(schema, references));
25
+ return (0, kind_1.IsTransform)(schema) || Visit(schema.returns, references) || schema.parameters.some((schema) => Visit(schema, references));
26
26
  }
27
27
  // prettier-ignore
28
28
  function FromFunction(schema, references) {
29
- return (0, type_1.IsTransform)(schema) || Visit(schema.returns, references) || schema.parameters.some((schema) => Visit(schema, references));
29
+ return (0, kind_1.IsTransform)(schema) || Visit(schema.returns, references) || schema.parameters.some((schema) => Visit(schema, references));
30
30
  }
31
31
  // prettier-ignore
32
32
  function FromIntersect(schema, references) {
33
- return (0, type_1.IsTransform)(schema) || (0, type_1.IsTransform)(schema.unevaluatedProperties) || schema.allOf.some((schema) => Visit(schema, references));
33
+ return (0, kind_1.IsTransform)(schema) || (0, kind_1.IsTransform)(schema.unevaluatedProperties) || schema.allOf.some((schema) => Visit(schema, references));
34
34
  }
35
35
  // prettier-ignore
36
36
  function FromIterator(schema, references) {
37
- return (0, type_1.IsTransform)(schema) || Visit(schema.items, references);
37
+ return (0, kind_1.IsTransform)(schema) || Visit(schema.items, references);
38
38
  }
39
39
  // prettier-ignore
40
40
  function FromNot(schema, references) {
41
- return (0, type_1.IsTransform)(schema) || Visit(schema.not, references);
41
+ return (0, kind_1.IsTransform)(schema) || Visit(schema.not, references);
42
42
  }
43
43
  // prettier-ignore
44
44
  function FromObject(schema, references) {
45
- return ((0, type_1.IsTransform)(schema) ||
45
+ return ((0, kind_1.IsTransform)(schema) ||
46
46
  Object.values(schema.properties).some((schema) => Visit(schema, references)) ||
47
- ((0, type_1.IsSchema)(schema.additionalProperties) && Visit(schema.additionalProperties, references)));
47
+ ((0, kind_1.IsSchema)(schema.additionalProperties) && Visit(schema.additionalProperties, references)));
48
48
  }
49
49
  // prettier-ignore
50
50
  function FromPromise(schema, references) {
51
- return (0, type_1.IsTransform)(schema) || Visit(schema.item, references);
51
+ return (0, kind_1.IsTransform)(schema) || Visit(schema.item, references);
52
52
  }
53
53
  // prettier-ignore
54
54
  function FromRecord(schema, references) {
55
55
  const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
56
56
  const property = schema.patternProperties[pattern];
57
- return (0, type_1.IsTransform)(schema) || Visit(property, references) || ((0, type_1.IsSchema)(schema.additionalProperties) && (0, type_1.IsTransform)(schema.additionalProperties));
57
+ return (0, kind_1.IsTransform)(schema) || Visit(property, references) || ((0, kind_1.IsSchema)(schema.additionalProperties) && (0, kind_1.IsTransform)(schema.additionalProperties));
58
58
  }
59
59
  // prettier-ignore
60
60
  function FromRef(schema, references) {
61
- if ((0, type_1.IsTransform)(schema))
61
+ if ((0, kind_1.IsTransform)(schema))
62
62
  return true;
63
63
  return Visit((0, index_1.Deref)(schema, references), references);
64
64
  }
65
65
  // prettier-ignore
66
66
  function FromThis(schema, references) {
67
- if ((0, type_1.IsTransform)(schema))
67
+ if ((0, kind_1.IsTransform)(schema))
68
68
  return true;
69
69
  return Visit((0, index_1.Deref)(schema, references), references);
70
70
  }
71
71
  // prettier-ignore
72
72
  function FromTuple(schema, references) {
73
- return (0, type_1.IsTransform)(schema) || (!(0, index_3.IsUndefined)(schema.items) && schema.items.some((schema) => Visit(schema, references)));
73
+ return (0, kind_1.IsTransform)(schema) || (!(0, index_3.IsUndefined)(schema.items) && schema.items.some((schema) => Visit(schema, references)));
74
74
  }
75
75
  // prettier-ignore
76
76
  function FromUnion(schema, references) {
77
- return (0, type_1.IsTransform)(schema) || schema.anyOf.some((schema) => Visit(schema, references));
77
+ return (0, kind_1.IsTransform)(schema) || schema.anyOf.some((schema) => Visit(schema, references));
78
78
  }
79
79
  // prettier-ignore
80
80
  function Visit(schema, references) {
@@ -114,7 +114,7 @@ function Visit(schema, references) {
114
114
  case 'Union':
115
115
  return FromUnion(schema_, references_);
116
116
  default:
117
- return (0, type_1.IsTransform)(schema);
117
+ return (0, kind_1.IsTransform)(schema);
118
118
  }
119
119
  }
120
120
  const visited = new Set();
@@ -12,7 +12,10 @@ export declare const Module: Runtime.Module<{
12
12
  }>;
13
13
  ModuleType: Runtime.IUnion<unknown>;
14
14
  ModuleProperties: Runtime.IUnion<Types.TProperties>;
15
- ModuleDeclaration: Runtime.ITuple<Types.TModule<Types.TProperties>>;
15
+ ModuleDeclaration: Runtime.ITuple<Types.TModule<Types.TProperties, {
16
+ [x: string]: Types.TSchema;
17
+ [x: number]: Types.TSchema;
18
+ }>>;
16
19
  Literal: Runtime.IUnion<Types.TLiteral<string> | Types.TLiteral<number> | Types.TLiteral<boolean>>;
17
20
  Keyword: Runtime.IUnion<Types.TAny | Types.TNever | Types.TString | Types.TBoolean | Types.TNumber | Types.TInteger | Types.TBigInt | Types.TNull | Types.TSymbol | Types.TUndefined | Types.TUnknown | Types.TVoid>;
18
21
  KeyOf: Runtime.IUnion<boolean>;
@@ -279,7 +279,9 @@ const FactorExtends = (Type, Extends) => {
279
279
  // prettier-ignore
280
280
  const FactorIndexArray = (Type, IndexArray) => {
281
281
  const [Left, Right] = DestructureRight(IndexArray);
282
- return (!Types.ValueGuard.IsUndefined(Right) ? (Right.length === 1 ? Types.Index(FactorIndexArray(Type, Left), Right[0]) :
282
+ return (!Types.ValueGuard.IsUndefined(Right) ? (
283
+ // note: Indexed types require reimplementation to replace `[number]` indexers
284
+ Right.length === 1 ? Types.Index(FactorIndexArray(Type, Left), Right[0]) :
283
285
  Right.length === 0 ? Types.Array(FactorIndexArray(Type, Left)) :
284
286
  Types.Never()) : Type);
285
287
  };
@@ -456,7 +456,7 @@ type Partial = Static.Tuple<[
456
456
  Static.Const<RAngle>
457
457
  ], PartialMapping>;
458
458
  interface RequiredMapping extends Static.IMapping {
459
- output: this['input'] extends ['Required', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TPartial<Type> : never;
459
+ output: this['input'] extends ['Required', LAngle, infer Type extends Types.TSchema, RAngle] ? Types.TRequired<Type> : never;
460
460
  }
461
461
  type Required = Static.Tuple<[
462
462
  Static.Const<'Required'>,
@@ -465,7 +465,7 @@ type Required = Static.Tuple<[
465
465
  Static.Const<RAngle>
466
466
  ], RequiredMapping>;
467
467
  interface PickMapping extends Static.IMapping {
468
- output: this['input'] extends ['Pick', LAngle, infer Type extends Types.TSchema, Comma, infer PropertyKey extends Types.TSchema, RAngle] ? Types.TPick<Type, Types.TIndexPropertyKeys<PropertyKey>> : never;
468
+ output: this['input'] extends ['Pick', LAngle, infer Type extends Types.TSchema, Comma, infer Key extends Types.TSchema, RAngle] ? Types.TPick<Type, Key> : never;
469
469
  }
470
470
  type Pick = Static.Tuple<[
471
471
  Static.Const<'Pick'>,
@@ -476,7 +476,7 @@ type Pick = Static.Tuple<[
476
476
  Static.Const<RAngle>
477
477
  ], PickMapping>;
478
478
  interface OmitMapping extends Static.IMapping {
479
- output: this['input'] extends ['Omit', LAngle, infer Type extends Types.TSchema, Comma, infer PropertyKey extends Types.TSchema, RAngle] ? Types.TOmit<Type, Types.TIndexPropertyKeys<PropertyKey>> : never;
479
+ output: this['input'] extends ['Omit', LAngle, infer Type extends Types.TSchema, Comma, infer Key extends Types.TSchema, RAngle] ? Types.TOmit<Type, Key> : never;
480
480
  }
481
481
  type Omit = Static.Tuple<[
482
482
  Static.Const<'Omit'>,
@@ -24,5 +24,5 @@ export interface TArray<T extends TSchema = TSchema> extends TSchema, ArrayOptio
24
24
  items: T;
25
25
  }
26
26
  /** `[Json]` Creates an Array type */
27
- export declare function Array<T extends TSchema>(items: T, options?: ArrayOptions): TArray<T>;
27
+ export declare function Array<Type extends TSchema>(items: Type, options?: ArrayOptions): TArray<Type>;
28
28
  export {};
@@ -1,9 +1,14 @@
1
+ import { Ensure } from '../helpers/index.mjs';
1
2
  import type { TSchema, SchemaOptions } from '../schema/index.mjs';
3
+ import { type TComputed } from '../computed/index.mjs';
2
4
  import { type TIntersect } from '../intersect/index.mjs';
3
5
  import { type TUnion } from '../union/index.mjs';
4
6
  import { type TPromise } from '../promise/index.mjs';
5
- type TFromRest<T extends TSchema[], Acc extends TSchema[] = []> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest<R, [...Acc, TAwaited<L>]> : Acc;
6
- export type TAwaited<T extends TSchema> = T extends TIntersect<infer S> ? TIntersect<TFromRest<S>> : T extends TUnion<infer S> ? TUnion<TFromRest<S>> : T extends TPromise<infer S> ? TAwaited<S> : T;
7
+ import { type TRef } from '../ref/index.mjs';
8
+ type TFromComputed<Target extends string, Parameters extends TSchema[]> = Ensure<(TComputed<'Awaited', [TComputed<Target, Parameters>]>)>;
9
+ type TFromRef<Ref extends string> = Ensure<TComputed<'Awaited', [TRef<Ref>]>>;
10
+ type TFromRest<Types extends TSchema[], Result extends TSchema[] = []> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromRest<Right, [...Result, TAwaited<Left>]> : Result);
11
+ export type TAwaited<Type extends TSchema> = (Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed<Target, Parameters> : Type extends TRef<infer Ref extends string> ? TFromRef<Ref> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromRest<Types>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromRest<Types>> : Type extends TPromise<infer Type extends TSchema> ? TAwaited<Type> : Type);
7
12
  /** `[JavaScript]` Constructs a type by recursively unwrapping Promise types */
8
- export declare function Awaited<T extends TSchema>(T: T, options?: SchemaOptions): TAwaited<T>;
13
+ export declare function Awaited<T extends TSchema>(type: T, options?: SchemaOptions): TAwaited<T>;
9
14
  export {};
@@ -1,37 +1,37 @@
1
+ import { CreateType } from '../create/type.mjs';
2
+ import { Computed } from '../computed/index.mjs';
1
3
  import { Intersect } from '../intersect/index.mjs';
2
4
  import { Union } from '../union/index.mjs';
3
- import { CreateType } from '../create/type.mjs';
5
+ import { Ref } from '../ref/index.mjs';
4
6
  // ------------------------------------------------------------------
5
7
  // TypeGuard
6
8
  // ------------------------------------------------------------------
7
- import { IsIntersect, IsUnion, IsPromise } from '../guard/kind.mjs';
9
+ import { IsIntersect, IsUnion, IsPromise, IsRef, IsComputed } from '../guard/kind.mjs';
10
+ // prettier-ignore
11
+ function FromComputed(target, parameters) {
12
+ return Computed('Awaited', [Computed(target, parameters)]);
13
+ }
8
14
  // prettier-ignore
9
- function FromRest(T) {
10
- return T.map(L => AwaitedResolve(L));
15
+ function FromRef($ref) {
16
+ return Computed('Awaited', [Ref($ref)]);
11
17
  }
12
18
  // prettier-ignore
13
- function FromIntersect(T) {
14
- return Intersect(FromRest(T));
19
+ function FromIntersect(types) {
20
+ return Intersect(FromRest(types));
15
21
  }
16
22
  // prettier-ignore
17
- function FromUnion(T) {
18
- return Union(FromRest(T));
23
+ function FromUnion(types) {
24
+ return Union(FromRest(types));
19
25
  }
20
26
  // prettier-ignore
21
- function FromPromise(T) {
22
- return AwaitedResolve(T);
27
+ function FromPromise(type) {
28
+ return Awaited(type);
23
29
  }
24
- // ----------------------------------------------------------------
25
- // AwaitedResolve
26
- // ----------------------------------------------------------------
27
30
  // prettier-ignore
28
- function AwaitedResolve(T) {
29
- return (IsIntersect(T) ? FromIntersect(T.allOf) :
30
- IsUnion(T) ? FromUnion(T.anyOf) :
31
- IsPromise(T) ? FromPromise(T.item) :
32
- T);
31
+ function FromRest(types) {
32
+ return types.map(type => Awaited(type));
33
33
  }
34
34
  /** `[JavaScript]` Constructs a type by recursively unwrapping Promise types */
35
- export function Awaited(T, options) {
36
- return CreateType(AwaitedResolve(T), options);
35
+ export function Awaited(type, options) {
36
+ return CreateType(IsComputed(type) ? FromComputed(type.target, type.parameters) : IsIntersect(type) ? FromIntersect(type.allOf) : IsUnion(type) ? FromUnion(type.anyOf) : IsPromise(type) ? FromPromise(type.item) : IsRef(type) ? FromRef(type.$ref) : type, options);
37
37
  }
@@ -0,0 +1,9 @@
1
+ import type { TSchema, SchemaOptions } from '../schema/index.mjs';
2
+ import { Kind } from '../symbols/symbols.mjs';
3
+ export interface TComputed<Target extends string = string, Parameters extends TSchema[] = []> extends TSchema {
4
+ [Kind]: 'Computed';
5
+ target: Target;
6
+ parameters: Parameters;
7
+ }
8
+ /** `[Internal]` Creates a deferred computed type. This type is used exclusively in modules to defer resolution of computable types that contain interior references */
9
+ export declare function Computed<Target extends string, Parameters extends TSchema[]>(target: Target, parameters: [...Parameters], options?: SchemaOptions): TComputed<Target, Parameters>;
@@ -0,0 +1,6 @@
1
+ import { CreateType } from '../create/index.mjs';
2
+ import { Kind } from '../symbols/symbols.mjs';
3
+ /** `[Internal]` Creates a deferred computed type. This type is used exclusively in modules to defer resolution of computable types that contain interior references */
4
+ export function Computed(target, parameters, options) {
5
+ return CreateType({ [Kind]: 'Computed', target, parameters }, options);
6
+ }
@@ -0,0 +1 @@
1
+ export * from './computed.mjs';
@@ -0,0 +1 @@
1
+ export * from './computed.mjs';
@@ -1,8 +1,9 @@
1
1
  import { Kind, Hint, TransformKind } from '../symbols/index.mjs';
2
2
  import { TransformOptions } from '../transform/index.mjs';
3
- import { TTemplateLiteral } from '../template-literal/index.mjs';
4
- import { TArray } from '../array/index.mjs';
5
- import { TBoolean } from '../boolean/index.mjs';
3
+ import type { TTemplateLiteral } from '../template-literal/index.mjs';
4
+ import type { TArray } from '../array/index.mjs';
5
+ import type { TBoolean } from '../boolean/index.mjs';
6
+ import type { TComputed } from '../computed/index.mjs';
6
7
  import type { TRecord } from '../record/index.mjs';
7
8
  import type { TString } from '../string/index.mjs';
8
9
  import type { TUnion } from '../union/index.mjs';
@@ -15,7 +16,7 @@ import type { TImport } from '../module/index.mjs';
15
16
  import type { TInteger } from '../integer/index.mjs';
16
17
  import type { TIntersect } from '../intersect/index.mjs';
17
18
  import type { TIterator } from '../iterator/index.mjs';
18
- import type { TLiteral } from '../literal/index.mjs';
19
+ import type { TLiteral, TLiteralValue } from '../literal/index.mjs';
19
20
  import type { TMappedKey, TMappedResult } from '../mapped/index.mjs';
20
21
  import type { TNever } from '../never/index.mjs';
21
22
  import type { TNot } from '../not/index.mjs';
@@ -51,6 +52,8 @@ export declare function IsAsyncIterator(value: unknown): value is TAsyncIterator
51
52
  export declare function IsBigInt(value: unknown): value is TBigInt;
52
53
  /** `[Kind-Only]` Returns true if the given value is TBoolean */
53
54
  export declare function IsBoolean(value: unknown): value is TBoolean;
55
+ /** `[Kind-Only]` Returns true if the given value is TComputed */
56
+ export declare function IsComputed(value: unknown): value is TComputed;
54
57
  /** `[Kind-Only]` Returns true if the given value is TConstructor */
55
58
  export declare function IsConstructor(value: unknown): value is TConstructor;
56
59
  /** `[Kind-Only]` Returns true if the given value is TDate */
@@ -77,6 +80,8 @@ export declare function IsLiteralString(value: unknown): value is TLiteral<strin
77
80
  export declare function IsLiteralNumber(value: unknown): value is TLiteral<number>;
78
81
  /** `[Kind-Only]` Returns true if the given value is TLiteral<boolean> */
79
82
  export declare function IsLiteralBoolean(value: unknown): value is TLiteral<boolean>;
83
+ /** `[Kind-Only]` Returns true if the given value is TLiteralValue */
84
+ export declare function IsLiteralValue(value: unknown): value is TLiteralValue;
80
85
  /** `[Kind-Only]` Returns true if the given value is TLiteral */
81
86
  export declare function IsLiteral(value: unknown): value is TLiteral;
82
87
  /** `[Kind-Only]` Returns true if the given value is a TMappedKey */
@@ -28,6 +28,10 @@ export function IsBigInt(value) {
28
28
  export function IsBoolean(value) {
29
29
  return IsKindOf(value, 'Boolean');
30
30
  }
31
+ /** `[Kind-Only]` Returns true if the given value is TComputed */
32
+ export function IsComputed(value) {
33
+ return IsKindOf(value, 'Computed');
34
+ }
31
35
  /** `[Kind-Only]` Returns true if the given value is TConstructor */
32
36
  export function IsConstructor(value) {
33
37
  return IsKindOf(value, 'Constructor');
@@ -76,6 +80,10 @@ export function IsLiteralNumber(value) {
76
80
  export function IsLiteralBoolean(value) {
77
81
  return IsLiteral(value) && ValueGuard.IsBoolean(value.const);
78
82
  }
83
+ /** `[Kind-Only]` Returns true if the given value is TLiteralValue */
84
+ export function IsLiteralValue(value) {
85
+ return ValueGuard.IsBoolean(value) || ValueGuard.IsNumber(value) || ValueGuard.IsString(value);
86
+ }
79
87
  /** `[Kind-Only]` Returns true if the given value is TLiteral */
80
88
  export function IsLiteral(value) {
81
89
  return IsKindOf(value, 'Literal');
@@ -1,9 +1,10 @@
1
1
  import { Kind, Hint, TransformKind } from '../symbols/index.mjs';
2
2
  import { TypeBoxError } from '../error/index.mjs';
3
3
  import { TransformOptions } from '../transform/index.mjs';
4
- import { TTemplateLiteral } from '../template-literal/index.mjs';
5
- import { TArray } from '../array/index.mjs';
6
- import { TBoolean } from '../boolean/index.mjs';
4
+ import type { TTemplateLiteral } from '../template-literal/index.mjs';
5
+ import type { TArray } from '../array/index.mjs';
6
+ import type { TBoolean } from '../boolean/index.mjs';
7
+ import type { TComputed } from '../computed/index.mjs';
7
8
  import type { TRecord } from '../record/index.mjs';
8
9
  import type { TString } from '../string/index.mjs';
9
10
  import type { TUnion } from '../union/index.mjs';
@@ -54,6 +55,8 @@ export declare function IsAsyncIterator(value: unknown): value is TAsyncIterator
54
55
  export declare function IsBigInt(value: unknown): value is TBigInt;
55
56
  /** Returns true if the given value is TBoolean */
56
57
  export declare function IsBoolean(value: unknown): value is TBoolean;
58
+ /** Returns true if the given value is TComputed */
59
+ export declare function IsComputed(value: unknown): value is TComputed;
57
60
  /** Returns true if the given value is TConstructor */
58
61
  export declare function IsConstructor(value: unknown): value is TConstructor;
59
62
  /** Returns true if the given value is TDate */
@@ -9,6 +9,7 @@ const KnownTypes = [
9
9
  'AsyncIterator',
10
10
  'BigInt',
11
11
  'Boolean',
12
+ 'Computed',
12
13
  'Constructor',
13
14
  'Date',
14
15
  'Enum',
@@ -142,6 +143,10 @@ export function IsBoolean(value) {
142
143
  value.type === 'boolean' &&
143
144
  IsOptionalString(value.$id));
144
145
  }
146
+ /** Returns true if the given value is TComputed */
147
+ export function IsComputed(value) {
148
+ return IsKindOf(value, 'Computed') && IsString(value.target) && ValueGuard.IsArray(value.parameters) && value.parameters.every((schema) => IsSchema(schema));
149
+ }
145
150
  /** Returns true if the given value is TConstructor */
146
151
  export function IsConstructor(value) {
147
152
  // prettier-ignore
@@ -3,11 +3,11 @@ import type { Ensure, Evaluate } from '../helpers/index.mjs';
3
3
  import type { TProperties } from '../object/index.mjs';
4
4
  import { type TIndex } from './indexed.mjs';
5
5
  import { type TMappedResult, type TMappedKey } from '../mapped/index.mjs';
6
- type TMappedIndexPropertyKey<T extends TSchema, K extends PropertyKey> = {
7
- [_ in K]: TIndex<T, [K]>;
6
+ type TMappedIndexPropertyKey<Type extends TSchema, Key extends PropertyKey> = {
7
+ [_ in Key]: TIndex<Type, [Key]>;
8
8
  };
9
- type TMappedIndexPropertyKeys<T extends TSchema, K extends PropertyKey[], Acc extends TProperties = {}> = (K extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TMappedIndexPropertyKeys<T, R, Acc & TMappedIndexPropertyKey<T, L>> : Acc);
10
- type TMappedIndexProperties<T extends TSchema, K extends TMappedKey> = Evaluate<TMappedIndexPropertyKeys<T, K['keys']>>;
11
- export type TIndexFromMappedKey<T extends TSchema, K extends TMappedKey, P extends TProperties = TMappedIndexProperties<T, K>> = (Ensure<TMappedResult<P>>);
12
- export declare function IndexFromMappedKey<T extends TSchema, K extends TMappedKey, P extends TProperties = TMappedIndexProperties<T, K>>(T: T, K: K, options?: SchemaOptions): TMappedResult<P>;
9
+ type TMappedIndexPropertyKeys<Type extends TSchema, PropertyKeys extends PropertyKey[], Result extends TProperties = {}> = (PropertyKeys extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? TMappedIndexPropertyKeys<Type, Right, Result & TMappedIndexPropertyKey<Type, Left>> : Result);
10
+ type TMappedIndexProperties<Type extends TSchema, MappedKey extends TMappedKey> = Evaluate<TMappedIndexPropertyKeys<Type, MappedKey['keys']>>;
11
+ export type TIndexFromMappedKey<Type extends TSchema, MappedKey extends TMappedKey, Properties extends TProperties = TMappedIndexProperties<Type, MappedKey>> = (Ensure<TMappedResult<Properties>>);
12
+ export declare function IndexFromMappedKey<Type extends TSchema, MappedKey extends TMappedKey, Properties extends TProperties = TMappedIndexProperties<Type, MappedKey>>(type: Type, mappedKey: MappedKey, options?: SchemaOptions): TMappedResult<Properties>;
13
13
  export {};
@@ -2,21 +2,21 @@ import { Index } from './indexed.mjs';
2
2
  import { MappedResult } from '../mapped/index.mjs';
3
3
  import { Clone } from '../clone/value.mjs';
4
4
  // prettier-ignore
5
- function MappedIndexPropertyKey(T, K, options) {
6
- return { [K]: Index(T, [K], Clone(options)) };
5
+ function MappedIndexPropertyKey(type, key, options) {
6
+ return { [key]: Index(type, [key], Clone(options)) };
7
7
  }
8
8
  // prettier-ignore
9
- function MappedIndexPropertyKeys(T, K, options) {
10
- return K.reduce((Acc, L) => {
11
- return { ...Acc, ...MappedIndexPropertyKey(T, L, options) };
9
+ function MappedIndexPropertyKeys(type, propertyKeys, options) {
10
+ return propertyKeys.reduce((result, left) => {
11
+ return { ...result, ...MappedIndexPropertyKey(type, left, options) };
12
12
  }, {});
13
13
  }
14
14
  // prettier-ignore
15
- function MappedIndexProperties(T, K, options) {
16
- return MappedIndexPropertyKeys(T, K.keys, options);
15
+ function MappedIndexProperties(type, mappedKey, options) {
16
+ return MappedIndexPropertyKeys(type, mappedKey.keys, options);
17
17
  }
18
18
  // prettier-ignore
19
- export function IndexFromMappedKey(T, K, options) {
20
- const P = MappedIndexProperties(T, K, options);
21
- return MappedResult(P);
19
+ export function IndexFromMappedKey(type, mappedKey, options) {
20
+ const properties = MappedIndexProperties(type, mappedKey, options);
21
+ return MappedResult(properties);
22
22
  }
@@ -3,10 +3,10 @@ import type { TProperties } from '../object/index.mjs';
3
3
  import { type TMappedResult } from '../mapped/index.mjs';
4
4
  import { type TIndexPropertyKeys } from './indexed-property-keys.mjs';
5
5
  import { type TIndex } from './index.mjs';
6
- type TFromProperties<T extends TSchema, P extends TProperties> = ({
7
- [K2 in keyof P]: TIndex<T, TIndexPropertyKeys<P[K2]>>;
6
+ type TFromProperties<Type extends TSchema, Properties extends TProperties> = ({
7
+ [K2 in keyof Properties]: TIndex<Type, TIndexPropertyKeys<Properties[K2]>>;
8
8
  });
9
- type TFromMappedResult<T extends TSchema, R extends TMappedResult> = (TFromProperties<T, R['properties']>);
10
- export type TIndexFromMappedResult<T extends TSchema, R extends TMappedResult, P extends TProperties = TFromMappedResult<T, R>> = (TMappedResult<P>);
11
- export declare function IndexFromMappedResult<T extends TSchema, R extends TMappedResult, P extends TProperties = TFromMappedResult<T, R>>(T: T, R: R, options?: SchemaOptions): TMappedResult<P>;
9
+ type TFromMappedResult<Type extends TSchema, MappedResult extends TMappedResult> = (TFromProperties<Type, MappedResult['properties']>);
10
+ export type TIndexFromMappedResult<Type extends TSchema, MappedResult extends TMappedResult, Properties extends TProperties = TFromMappedResult<Type, MappedResult>> = (TMappedResult<Properties>);
11
+ export declare function IndexFromMappedResult<Type extends TSchema, MappedResult extends TMappedResult, Properties extends TProperties = TFromMappedResult<Type, MappedResult>>(type: Type, mappedResult: MappedResult, options?: SchemaOptions): TMappedResult<Properties>;
12
12
  export {};
@@ -2,19 +2,20 @@ import { MappedResult } from '../mapped/index.mjs';
2
2
  import { IndexPropertyKeys } from './indexed-property-keys.mjs';
3
3
  import { Index } from './index.mjs';
4
4
  // prettier-ignore
5
- function FromProperties(T, P, options) {
6
- const Acc = {};
7
- for (const K2 of Object.getOwnPropertyNames(P)) {
8
- Acc[K2] = Index(T, IndexPropertyKeys(P[K2]), options);
5
+ function FromProperties(type, properties, options) {
6
+ const result = {};
7
+ for (const K2 of Object.getOwnPropertyNames(properties)) {
8
+ const keys = IndexPropertyKeys(properties[K2]);
9
+ result[K2] = Index(type, keys, options);
9
10
  }
10
- return Acc;
11
+ return result;
11
12
  }
12
13
  // prettier-ignore
13
- function FromMappedResult(T, R, options) {
14
- return FromProperties(T, R.properties, options);
14
+ function FromMappedResult(type, mappedResult, options) {
15
+ return FromProperties(type, mappedResult.properties, options);
15
16
  }
16
17
  // prettier-ignore
17
- export function IndexFromMappedResult(T, R, options) {
18
- const P = FromMappedResult(T, R, options);
19
- return MappedResult(P);
18
+ export function IndexFromMappedResult(type, mappedResult, options) {
19
+ const properties = FromMappedResult(type, mappedResult, options);
20
+ return MappedResult(properties);
20
21
  }