@sinclair/typebox 0.32.0-dev-26 → 0.32.0-dev-27

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 (198) hide show
  1. package/build/import/index.d.mts +2 -2
  2. package/build/import/type/awaited/awaited.mjs +2 -6
  3. package/build/import/type/composite/composite.d.mts +1 -2
  4. package/build/import/type/composite/composite.mjs +2 -2
  5. package/build/import/type/const/const.mjs +6 -6
  6. package/build/import/type/constructor/constructor.d.mts +1 -1
  7. package/build/import/type/constructor/constructor.mjs +1 -1
  8. package/build/import/type/deref/deref.mjs +1 -2
  9. package/build/import/type/discard/discard.mjs +2 -2
  10. package/build/import/type/enum/enum.mjs +3 -0
  11. package/build/import/type/exclude/exclude-from-mapped-result.d.mts +5 -5
  12. package/build/import/type/exclude/exclude-from-mapped-result.mjs +7 -7
  13. package/build/import/type/exclude/exclude.mjs +0 -1
  14. package/build/import/type/extends/extends-from-mapped-key.d.mts +1 -1
  15. package/build/import/type/extends/extends-from-mapped-key.mjs +4 -5
  16. package/build/import/type/extends/extends-from-mapped-result.d.mts +5 -5
  17. package/build/import/type/extends/extends-from-mapped-result.mjs +7 -7
  18. package/build/import/type/extends/extends.mjs +0 -1
  19. package/build/import/type/extract/extract-from-mapped-result.d.mts +5 -5
  20. package/build/import/type/extract/extract-from-mapped-result.mjs +7 -7
  21. package/build/import/type/extract/extract.d.mts +1 -2
  22. package/build/import/type/extract/extract.mjs +4 -2
  23. package/build/import/type/index.d.mts +1 -1
  24. package/build/import/type/index.mjs +1 -1
  25. package/build/import/type/indexed/indexed-from-mapped-key.d.mts +2 -2
  26. package/build/import/type/indexed/indexed-from-mapped-key.mjs +4 -5
  27. package/build/import/type/indexed/indexed-from-mapped-result.d.mts +1 -1
  28. package/build/import/type/indexed/indexed-property-keys.d.mts +6 -6
  29. package/build/import/type/indexed/indexed-property-keys.mjs +3 -5
  30. package/build/import/type/indexed/indexed.d.mts +1 -1
  31. package/build/import/type/indexed/indexed.mjs +9 -27
  32. package/build/import/type/intersect/intersect-evaluated.mjs +3 -13
  33. package/build/import/type/intrinsic/capitalize.d.mts +2 -2
  34. package/build/import/type/intrinsic/intrinsic-from-mapped-key.d.mts +1 -1
  35. package/build/import/type/intrinsic/intrinsic-from-mapped-key.mjs +4 -5
  36. package/build/import/type/intrinsic/intrinsic.d.mts +2 -3
  37. package/build/import/type/intrinsic/intrinsic.mjs +2 -5
  38. package/build/import/type/intrinsic/lowercase.d.mts +2 -2
  39. package/build/import/type/intrinsic/uncapitalize.d.mts +2 -2
  40. package/build/import/type/intrinsic/uppercase.d.mts +2 -2
  41. package/build/import/type/iterator/iterator.mjs +1 -1
  42. package/build/import/type/keyof/keyof-from-mapped-result.d.mts +3 -3
  43. package/build/import/type/keyof/keyof-from-mapped-result.mjs +4 -4
  44. package/build/import/type/keyof/keyof-property-keys.d.mts +3 -3
  45. package/build/import/type/keyof/keyof-property-keys.mjs +9 -15
  46. package/build/import/type/keyof/keyof.mjs +2 -8
  47. package/build/import/type/mapped/mapped.d.mts +6 -1
  48. package/build/import/type/mapped/mapped.mjs +21 -14
  49. package/build/import/type/not/not.mjs +1 -1
  50. package/build/import/type/object/object.d.mts +1 -1
  51. package/build/import/type/object/object.mjs +0 -1
  52. package/build/import/type/omit/index.d.mts +1 -0
  53. package/build/import/type/omit/index.mjs +1 -0
  54. package/build/import/type/omit/omit-from-mapped-key.mjs +4 -5
  55. package/build/import/type/omit/omit-from-mapped-result.d.mts +11 -0
  56. package/build/import/type/omit/omit-from-mapped-result.mjs +17 -0
  57. package/build/import/type/omit/omit.d.mts +6 -3
  58. package/build/import/type/omit/omit.mjs +11 -9
  59. package/build/import/type/optional/optional-from-mapped-result.d.mts +5 -5
  60. package/build/import/type/optional/optional-from-mapped-result.mjs +7 -7
  61. package/build/import/type/partial/partial-from-mapped-result.d.mts +5 -5
  62. package/build/import/type/partial/partial-from-mapped-result.mjs +4 -4
  63. package/build/import/type/partial/partial.d.mts +2 -3
  64. package/build/import/type/partial/partial.mjs +8 -21
  65. package/build/import/type/pick/index.d.mts +1 -0
  66. package/build/import/type/pick/index.mjs +1 -0
  67. package/build/import/type/pick/pick-from-mapped-key.mjs +4 -5
  68. package/build/import/type/pick/pick-from-mapped-result.d.mts +11 -0
  69. package/build/import/type/pick/pick-from-mapped-result.mjs +17 -0
  70. package/build/import/type/pick/pick.d.mts +5 -2
  71. package/build/import/type/pick/pick.mjs +11 -10
  72. package/build/import/type/promise/promise.mjs +1 -1
  73. package/build/import/type/readonly/readonly-from-mapped-result.d.mts +5 -5
  74. package/build/import/type/readonly/readonly-from-mapped-result.mjs +4 -4
  75. package/build/import/type/record/record.d.mts +2 -2
  76. package/build/import/type/record/record.mjs +3 -0
  77. package/build/import/type/ref/ref.mjs +1 -1
  78. package/build/import/type/required/required-from-mapped-result.d.mts +5 -5
  79. package/build/import/type/required/required-from-mapped-result.mjs +7 -7
  80. package/build/import/type/required/required.d.mts +2 -3
  81. package/build/import/type/required/required.mjs +4 -14
  82. package/build/import/type/rest/rest.d.mts +2 -2
  83. package/build/import/type/rest/rest.mjs +1 -2
  84. package/build/import/type/sets/index.d.mts +1 -0
  85. package/build/import/type/sets/index.mjs +1 -0
  86. package/build/import/type/sets/set.d.mts +24 -0
  87. package/build/import/type/sets/set.mjs +35 -0
  88. package/build/import/type/strict/strict.d.mts +1 -1
  89. package/build/import/type/strict/strict.mjs +1 -1
  90. package/build/import/type/template-literal/syntax.d.mts +1 -1
  91. package/build/import/type/template-literal/template-literal.d.mts +1 -1
  92. package/build/import/type/transform/transform.mjs +1 -1
  93. package/build/import/type/type/json.d.mts +6 -2
  94. package/build/import/type/union/union-evaluated.mjs +3 -14
  95. package/build/require/index.d.ts +2 -2
  96. package/build/require/type/awaited/awaited.js +2 -6
  97. package/build/require/type/composite/composite.d.ts +1 -2
  98. package/build/require/type/composite/composite.js +5 -6
  99. package/build/require/type/const/const.js +6 -6
  100. package/build/require/type/constructor/constructor.d.ts +1 -1
  101. package/build/require/type/constructor/constructor.js +1 -1
  102. package/build/require/type/deref/deref.js +0 -1
  103. package/build/require/type/discard/discard.js +2 -2
  104. package/build/require/type/enum/enum.js +3 -0
  105. package/build/require/type/exclude/exclude-from-mapped-result.d.ts +5 -5
  106. package/build/require/type/exclude/exclude-from-mapped-result.js +7 -7
  107. package/build/require/type/exclude/exclude.js +0 -1
  108. package/build/require/type/extends/extends-from-mapped-key.d.ts +1 -1
  109. package/build/require/type/extends/extends-from-mapped-key.js +4 -5
  110. package/build/require/type/extends/extends-from-mapped-result.d.ts +5 -5
  111. package/build/require/type/extends/extends-from-mapped-result.js +7 -7
  112. package/build/require/type/extends/extends.js +0 -1
  113. package/build/require/type/extract/extract-from-mapped-result.d.ts +5 -5
  114. package/build/require/type/extract/extract-from-mapped-result.js +7 -7
  115. package/build/require/type/extract/extract.d.ts +1 -2
  116. package/build/require/type/extract/extract.js +4 -3
  117. package/build/require/type/index.d.ts +1 -1
  118. package/build/require/type/index.js +1 -1
  119. package/build/require/type/indexed/indexed-from-mapped-key.d.ts +2 -2
  120. package/build/require/type/indexed/indexed-from-mapped-key.js +4 -5
  121. package/build/require/type/indexed/indexed-from-mapped-result.d.ts +1 -1
  122. package/build/require/type/indexed/indexed-property-keys.d.ts +6 -6
  123. package/build/require/type/indexed/indexed-property-keys.js +3 -5
  124. package/build/require/type/indexed/indexed.d.ts +1 -1
  125. package/build/require/type/indexed/indexed.js +9 -27
  126. package/build/require/type/intersect/intersect-evaluated.js +3 -13
  127. package/build/require/type/intrinsic/capitalize.d.ts +2 -2
  128. package/build/require/type/intrinsic/intrinsic-from-mapped-key.d.ts +1 -1
  129. package/build/require/type/intrinsic/intrinsic-from-mapped-key.js +4 -5
  130. package/build/require/type/intrinsic/intrinsic.d.ts +2 -3
  131. package/build/require/type/intrinsic/intrinsic.js +2 -5
  132. package/build/require/type/intrinsic/lowercase.d.ts +2 -2
  133. package/build/require/type/intrinsic/uncapitalize.d.ts +2 -2
  134. package/build/require/type/intrinsic/uppercase.d.ts +2 -2
  135. package/build/require/type/iterator/iterator.js +1 -1
  136. package/build/require/type/keyof/keyof-from-mapped-result.d.ts +3 -3
  137. package/build/require/type/keyof/keyof-from-mapped-result.js +4 -4
  138. package/build/require/type/keyof/keyof-property-keys.d.ts +3 -3
  139. package/build/require/type/keyof/keyof-property-keys.js +9 -15
  140. package/build/require/type/keyof/keyof.js +2 -8
  141. package/build/require/type/mapped/mapped.d.ts +6 -1
  142. package/build/require/type/mapped/mapped.js +21 -14
  143. package/build/require/type/not/not.js +1 -1
  144. package/build/require/type/object/object.d.ts +1 -1
  145. package/build/require/type/object/object.js +0 -1
  146. package/build/require/type/omit/index.d.ts +1 -0
  147. package/build/require/type/omit/index.js +1 -0
  148. package/build/require/type/omit/omit-from-mapped-key.js +4 -5
  149. package/build/require/type/omit/omit-from-mapped-result.d.ts +11 -0
  150. package/build/require/type/omit/omit-from-mapped-result.js +22 -0
  151. package/build/require/type/omit/omit.d.ts +6 -3
  152. package/build/require/type/omit/omit.js +10 -8
  153. package/build/require/type/optional/optional-from-mapped-result.d.ts +5 -5
  154. package/build/require/type/optional/optional-from-mapped-result.js +7 -7
  155. package/build/require/type/partial/partial-from-mapped-result.d.ts +5 -5
  156. package/build/require/type/partial/partial-from-mapped-result.js +4 -4
  157. package/build/require/type/partial/partial.d.ts +2 -3
  158. package/build/require/type/partial/partial.js +8 -21
  159. package/build/require/type/pick/index.d.ts +1 -0
  160. package/build/require/type/pick/index.js +1 -0
  161. package/build/require/type/pick/pick-from-mapped-key.js +4 -5
  162. package/build/require/type/pick/pick-from-mapped-result.d.ts +11 -0
  163. package/build/require/type/pick/pick-from-mapped-result.js +22 -0
  164. package/build/require/type/pick/pick.d.ts +5 -2
  165. package/build/require/type/pick/pick.js +10 -9
  166. package/build/require/type/promise/promise.js +1 -1
  167. package/build/require/type/readonly/readonly-from-mapped-result.d.ts +5 -5
  168. package/build/require/type/readonly/readonly-from-mapped-result.js +4 -4
  169. package/build/require/type/record/record.d.ts +2 -2
  170. package/build/require/type/record/record.js +3 -0
  171. package/build/require/type/ref/ref.js +1 -1
  172. package/build/require/type/required/required-from-mapped-result.d.ts +5 -5
  173. package/build/require/type/required/required-from-mapped-result.js +7 -7
  174. package/build/require/type/required/required.d.ts +2 -3
  175. package/build/require/type/required/required.js +4 -14
  176. package/build/require/type/rest/rest.d.ts +2 -2
  177. package/build/require/type/rest/rest.js +1 -3
  178. package/build/require/type/sets/index.d.ts +1 -0
  179. package/build/require/type/{operators → sets}/index.js +1 -1
  180. package/build/require/type/sets/set.d.ts +24 -0
  181. package/build/require/type/sets/set.js +47 -0
  182. package/build/require/type/strict/strict.d.ts +1 -1
  183. package/build/require/type/strict/strict.js +1 -1
  184. package/build/require/type/template-literal/parse.js +1 -1
  185. package/build/require/type/template-literal/syntax.d.ts +1 -1
  186. package/build/require/type/template-literal/template-literal.d.ts +1 -1
  187. package/build/require/type/transform/transform.js +1 -1
  188. package/build/require/type/type/json.d.ts +6 -2
  189. package/build/require/type/union/union-evaluated.js +3 -14
  190. package/package.json +1 -1
  191. package/readme.md +64 -64
  192. package/build/import/type/operators/index.d.mts +0 -1
  193. package/build/import/type/operators/index.mjs +0 -1
  194. package/build/import/type/operators/operators.d.mts +0 -24
  195. package/build/import/type/operators/operators.mjs +0 -77
  196. package/build/require/type/operators/index.d.ts +0 -1
  197. package/build/require/type/operators/operators.d.ts +0 -24
  198. package/build/require/type/operators/operators.js +0 -89
@@ -36,11 +36,11 @@ export { Not, type TNot } from './type/not/index.mjs';
36
36
  export { Null, type TNull } from './type/null/index.mjs';
37
37
  export { Number, type TNumber, type NumberOptions } from './type/number/index.mjs';
38
38
  export { Object, type TObject, type TProperties, type ObjectOptions } from './type/object/index.mjs';
39
- export { Omit, type TOmit, type TOmitFromMappedKey } from './type/omit/index.mjs';
39
+ export { Omit, type TOmit, type TOmitFromMappedKey, type TOmitFromMappedResult } from './type/omit/index.mjs';
40
40
  export { Optional, OptionalFromMappedResult, type TOptional, type TOptionalWithFlag, type TOptionalFromMappedResult } from './type/optional/index.mjs';
41
41
  export { Parameters, type TParameters } from './type/parameters/index.mjs';
42
42
  export { Partial, PartialFromMappedResult, type TPartial, type TPartialFromMappedResult } from './type/partial/index.mjs';
43
- export { Pick, type TPick, type TPickFromMappedKey } from './type/pick/index.mjs';
43
+ export { Pick, type TPick, type TPickFromMappedKey, type TPickFromMappedResult } from './type/pick/index.mjs';
44
44
  export { Promise, type TPromise } from './type/promise/index.mjs';
45
45
  export { Readonly, ReadonlyFromMappedResult, type TReadonly, type TReadonlyWithFlag, type TReadonlyFromMappedResult } from './type/readonly/index.mjs';
46
46
  export { ReadonlyOptional, type TReadonlyOptional } from './type/readonly-optional/index.mjs';
@@ -4,14 +4,10 @@ import { CloneType } from '../clone/type.mjs';
4
4
  // ------------------------------------------------------------------
5
5
  // TypeGuard
6
6
  // ------------------------------------------------------------------
7
- // prettier-ignore
8
7
  import { IsIntersect, IsUnion, IsPromise } from '../guard/type.mjs';
9
8
  // prettier-ignore
10
- function FromRest(T, Acc = []) {
11
- const [L, ...R] = T;
12
- return (T.length > 0
13
- ? FromRest(R, [...Acc, FromSchema(L)])
14
- : Acc);
9
+ function FromRest(T) {
10
+ return T.map(L => FromSchema(L));
15
11
  }
16
12
  // prettier-ignore
17
13
  function FromIntersect(T) {
@@ -7,8 +7,7 @@ type TCompositeIndex<T extends TIntersect<TObject[]>, K extends string[], Acc ex
7
7
  [_ in L]: TIndex<T, [L]>;
8
8
  }> : Acc;
9
9
  type TCompositeReduce<T extends TObject[]> = UnionToTuple<TCompositeKeys<T>> extends infer K ? Evaluate<TCompositeIndex<TIntersect<T>, Assert<K, string[]>>> : {};
10
- export type TCompositeResolve<T extends TObject[]> = TIntersect<T> extends TIntersect ? TObject<TCompositeReduce<T>> : TObject<{}>;
11
- export declare function CompositeResolve<T extends TObject[]>(T: [...T]): TCompositeResolve<T>;
10
+ type TCompositeResolve<T extends TObject[]> = TIntersect<T> extends TIntersect ? TObject<TCompositeReduce<T>> : TObject<{}>;
12
11
  export type TComposite<T extends TObject[]> = TCompositeResolve<T>;
13
12
  /** `[Json]` Creates a Composite object type */
14
13
  export declare function Composite<T extends TObject[]>(T: [...T], options?: ObjectOptions): TComposite<T>;
@@ -1,9 +1,9 @@
1
1
  import { Object } from '../object/index.mjs';
2
2
  import { Intersect } from '../intersect/index.mjs';
3
- import { KeyOfPropertyKeys } from '../keyof/index.mjs';
4
3
  import { Index } from '../indexed/index.mjs';
4
+ import { KeyOfPropertyKeys } from '../keyof/index.mjs';
5
5
  import { CloneType } from '../clone/type.mjs';
6
- export function CompositeResolve(T) {
6
+ function CompositeResolve(T) {
7
7
  const intersect = Intersect(T, {});
8
8
  const keys = KeyOfPropertyKeys(intersect);
9
9
  const properties = keys.reduce((acc, key) => ({ ...acc, [key]: Index(intersect, [key]) }), {});
@@ -1,4 +1,3 @@
1
- import { IsArray, IsNumber, IsBigInt, IsUint8Array, IsDate, IsIterator, IsObject, IsAsyncIterator, IsFunction, IsUndefined, IsNull, IsSymbol, IsBoolean, IsString } from '../guard/value.mjs';
2
1
  import { Any } from '../any/index.mjs';
3
2
  import { BigInt } from '../bigint/index.mjs';
4
3
  import { Date } from '../date/index.mjs';
@@ -13,12 +12,13 @@ import { Undefined } from '../undefined/index.mjs';
13
12
  import { Uint8Array } from '../uint8array/index.mjs';
14
13
  import { Unknown } from '../unknown/index.mjs';
15
14
  import { TypeClone } from '../clone/index.mjs';
15
+ // ------------------------------------------------------------------
16
+ // ValueGuard
17
+ // ------------------------------------------------------------------
18
+ import { IsArray, IsNumber, IsBigInt, IsUint8Array, IsDate, IsIterator, IsObject, IsAsyncIterator, IsFunction, IsUndefined, IsNull, IsSymbol, IsBoolean, IsString } from '../guard/value.mjs';
16
19
  // prettier-ignore
17
20
  function FromArray(T) {
18
- const [L, ...R] = T;
19
- return (T.length > 0
20
- ? [FromValue(L, false), ...FromArray(R)]
21
- : []);
21
+ return T.map(L => FromValue(L, false));
22
22
  }
23
23
  // prettier-ignore
24
24
  function FromProperties(value) {
@@ -33,7 +33,7 @@ function ConditionalReadonly(T, root) {
33
33
  function FromValue(value, root) {
34
34
  return (IsAsyncIterator(value) ? ConditionalReadonly(Any(), root) :
35
35
  IsIterator(value) ? ConditionalReadonly(Any(), root) :
36
- IsArray(value) ? Readonly(Tuple(FromArray(value))) : // Always Readonly
36
+ IsArray(value) ? Readonly(Tuple(FromArray(value))) :
37
37
  IsUint8Array(value) ? Uint8Array() :
38
38
  IsDate(value) ? Date() :
39
39
  IsObject(value) ? ConditionalReadonly(Object(FromProperties(value)), root) :
@@ -4,7 +4,7 @@ import type { Ensure } from '../helpers/index.mjs';
4
4
  import { Kind } from '../symbols/index.mjs';
5
5
  type ConstructorStaticReturnType<T extends TSchema, P extends unknown[]> = Static<T, P>;
6
6
  type ConstructorStaticParameters<T extends TSchema[], P extends unknown[], Acc extends unknown[] = []> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? ConstructorStaticParameters<R, P, [...Acc, Static<L, P>]> : Acc;
7
- export type ConstructorStatic<T extends TSchema[], U extends TSchema, P extends unknown[]> = (Ensure<new (...param: ConstructorStaticParameters<T, P>) => ConstructorStaticReturnType<U, P>>);
7
+ type ConstructorStatic<T extends TSchema[], U extends TSchema, P extends unknown[]> = (Ensure<new (...param: ConstructorStaticParameters<T, P>) => ConstructorStaticReturnType<U, P>>);
8
8
  export interface TConstructor<T extends TSchema[] = TSchema[], U extends TSchema = TSchema> extends TSchema {
9
9
  [Kind]: 'Constructor';
10
10
  static: ConstructorStatic<T, U, this['params']>;
@@ -1,5 +1,5 @@
1
- import { Kind } from '../symbols/index.mjs';
2
1
  import { CloneType, CloneRest } from '../clone/type.mjs';
2
+ import { Kind } from '../symbols/index.mjs';
3
3
  /** `[JavaScript]` Creates a Constructor type */
4
4
  export function Constructor(parameters, returns, options) {
5
5
  return {
@@ -4,8 +4,7 @@ import { IsUndefined } from '../guard/value.mjs';
4
4
  // ------------------------------------------------------------------
5
5
  // TypeGuard
6
6
  // ------------------------------------------------------------------
7
- // prettier-ignore
8
- import { IsConstructor, IsFunction, IsIntersect, IsUnion, IsTuple, IsArray, IsObject, IsPromise, IsAsyncIterator, IsIterator, IsRef, } from '../guard/type.mjs';
7
+ import { IsConstructor, IsFunction, IsIntersect, IsUnion, IsTuple, IsArray, IsObject, IsPromise, IsAsyncIterator, IsIterator, IsRef } from '../guard/type.mjs';
9
8
  function FromRest(schema, references) {
10
9
  return schema.map((schema) => Deref(schema, references));
11
10
  }
@@ -1,7 +1,7 @@
1
- function Key(value, key) {
1
+ function DiscardKey(value, key) {
2
2
  const { [key]: _, ...rest } = value;
3
3
  return rest;
4
4
  }
5
5
  export function Discard(value, keys) {
6
- return keys.reduce((acc, key) => Key(acc, key), value);
6
+ return keys.reduce((acc, key) => DiscardKey(acc, key), value);
7
7
  }
@@ -1,6 +1,9 @@
1
1
  import { Literal } from '../literal/index.mjs';
2
2
  import { Kind, Hint } from '../symbols/index.mjs';
3
3
  import { Union } from '../union/index.mjs';
4
+ // ------------------------------------------------------------------
5
+ // ValueGuard
6
+ // ------------------------------------------------------------------
4
7
  import { IsUndefined } from '../guard/value.mjs';
5
8
  /** `[Json]` Creates a Enum type */
6
9
  export function Enum(item, options = {}) {
@@ -2,10 +2,10 @@ import type { TSchema, SchemaOptions } from '../schema/index.mjs';
2
2
  import type { TProperties } from '../object/index.mjs';
3
3
  import { type TMappedResult } from '../mapped/index.mjs';
4
4
  import { type TExclude } from './exclude.mjs';
5
- type TFromProperties<K extends TProperties, U extends TSchema> = ({
6
- [K2 in keyof K]: TExclude<K[K2], U>;
5
+ type TFromProperties<K extends TProperties, T extends TSchema> = ({
6
+ [K2 in keyof K]: TExclude<K[K2], T>;
7
7
  });
8
- type TFromMappedResult<K extends TMappedResult, U extends TSchema> = (TFromProperties<K['properties'], U>);
9
- export type TExcludeFromMappedResult<T extends TMappedResult, U extends TSchema, P extends TProperties = TFromMappedResult<T, U>> = (TMappedResult<P>);
10
- export declare function ExcludeFromMappedResult<T extends TMappedResult, U extends TSchema, P extends TProperties = TFromMappedResult<T, U>>(T: T, U: U, options: SchemaOptions): TMappedResult<P>;
8
+ type TFromMappedResult<R extends TMappedResult, T extends TSchema> = (TFromProperties<R['properties'], T>);
9
+ export type TExcludeFromMappedResult<R extends TMappedResult, T extends TSchema, P extends TProperties = TFromMappedResult<R, T>> = (TMappedResult<P>);
10
+ export declare function ExcludeFromMappedResult<R extends TMappedResult, T extends TSchema, P extends TProperties = TFromMappedResult<R, T>>(R: R, T: T, options: SchemaOptions): TMappedResult<P>;
11
11
  export {};
@@ -1,17 +1,17 @@
1
1
  import { MappedResult } from '../mapped/index.mjs';
2
2
  import { Exclude } from './exclude.mjs';
3
3
  // prettier-ignore
4
- function FromProperties(K, U, options) {
5
- return globalThis.Object.getOwnPropertyNames(K).reduce((Acc, K2) => {
6
- return { ...Acc, [K2]: Exclude(K[K2], U, options) };
4
+ function FromProperties(P, U, options) {
5
+ return globalThis.Object.getOwnPropertyNames(P).reduce((Acc, K2) => {
6
+ return { ...Acc, [K2]: Exclude(P[K2], U, options) };
7
7
  }, {});
8
8
  }
9
9
  // prettier-ignore
10
- function FromMappedResult(K, U, options) {
11
- return FromProperties(K.properties, U, options);
10
+ function FromMappedResult(R, T, options) {
11
+ return FromProperties(R.properties, T, options);
12
12
  }
13
13
  // prettier-ignore
14
- export function ExcludeFromMappedResult(T, U, options) {
15
- const P = FromMappedResult(T, U, options);
14
+ export function ExcludeFromMappedResult(R, T, options) {
15
+ const P = FromMappedResult(R, T, options);
16
16
  return MappedResult(P);
17
17
  }
@@ -7,7 +7,6 @@ import { ExcludeFromMappedResult } from './exclude-from-mapped-result.mjs';
7
7
  // ------------------------------------------------------------------
8
8
  // TypeGuard
9
9
  // ------------------------------------------------------------------
10
- // prettier-ignore
11
10
  import { IsMappedResult, IsTemplateLiteral, IsUnion } from '../guard/type.mjs';
12
11
  // prettier-ignore
13
12
  function ExcludeResolve(L, R) {
@@ -2,7 +2,7 @@ import type { TSchema, SchemaOptions } from '../schema/index.mjs';
2
2
  import type { TProperties } from '../object/index.mjs';
3
3
  import type { Assert } from '../helpers/index.mjs';
4
4
  import { type TMappedResult, type TMappedKey } from '../mapped/index.mjs';
5
- import { TLiteral, TLiteralValue } from '../literal/index.mjs';
5
+ import { type TLiteral, type TLiteralValue } from '../literal/index.mjs';
6
6
  import { type TExtends } from './extends.mjs';
7
7
  type TFromPropertyKey<K extends PropertyKey, U extends TSchema, L extends TSchema, R extends TSchema> = {
8
8
  [_ in K]: TExtends<TLiteral<Assert<K, TLiteralValue>>, U, L, R>;
@@ -8,11 +8,10 @@ function FromPropertyKey(K, U, L, R, options) {
8
8
  };
9
9
  }
10
10
  // prettier-ignore
11
- function FromPropertyKeys(K, U, L, R, options, Acc = {}) {
12
- const [LK, ...RK] = K;
13
- return (K.length > 0
14
- ? FromPropertyKeys(RK, U, L, R, options, { ...Acc, ...FromPropertyKey(LK, U, L, R, options) })
15
- : Acc);
11
+ function FromPropertyKeys(K, U, L, R, options) {
12
+ return K.reduce((Acc, LK) => {
13
+ return { ...Acc, ...FromPropertyKey(LK, U, L, R, options) };
14
+ }, {});
16
15
  }
17
16
  // prettier-ignore
18
17
  function FromMappedKey(K, U, L, R, options) {
@@ -2,10 +2,10 @@ import type { TSchema, SchemaOptions } from '../schema/index.mjs';
2
2
  import type { TProperties } from '../object/index.mjs';
3
3
  import { type TMappedResult } from '../mapped/index.mjs';
4
4
  import { type TExtends } from './extends.mjs';
5
- type TFromProperties<K extends TProperties, U extends TSchema, L extends TSchema, R extends TSchema> = ({
6
- [K2 in keyof K]: TExtends<K[K2], U, L, R>;
5
+ type TFromProperties<P extends TProperties, Right extends TSchema, False extends TSchema, True extends TSchema> = ({
6
+ [K2 in keyof P]: TExtends<P[K2], Right, False, True>;
7
7
  });
8
- type TFromMappedResult<K extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema> = (TFromProperties<K['properties'], U, L, R>);
9
- export type TExtendsFromMappedResult<T extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = TFromMappedResult<T, U, L, R>> = (TMappedResult<P>);
10
- export declare function ExtendsFromMappedResult<T extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = TFromMappedResult<T, U, L, R>>(T: T, U: U, L: L, R: R, options: SchemaOptions): TMappedResult<P>;
8
+ type TFromMappedResult<Left extends TMappedResult, Right extends TSchema, True extends TSchema, False extends TSchema> = (TFromProperties<Left['properties'], Right, True, False>);
9
+ export type TExtendsFromMappedResult<Left extends TMappedResult, Right extends TSchema, True extends TSchema, False extends TSchema, P extends TProperties = TFromMappedResult<Left, Right, True, False>> = (TMappedResult<P>);
10
+ export declare function ExtendsFromMappedResult<Left extends TMappedResult, Right extends TSchema, True extends TSchema, False extends TSchema, P extends TProperties = TFromMappedResult<Left, Right, True, False>>(Left: Left, Right: Right, True: True, False: False, options: SchemaOptions): TMappedResult<P>;
11
11
  export {};
@@ -1,17 +1,17 @@
1
1
  import { MappedResult } from '../mapped/index.mjs';
2
2
  import { Extends } from './extends.mjs';
3
3
  // prettier-ignore
4
- function FromProperties(K, U, L, R, options) {
5
- return globalThis.Object.getOwnPropertyNames(K).reduce((Acc, K2) => {
6
- return { ...Acc, [K2]: Extends(K[K2], U, L, R, options) };
4
+ function FromProperties(P, Right, True, False, options) {
5
+ return globalThis.Object.getOwnPropertyNames(P).reduce((Acc, K2) => {
6
+ return { ...Acc, [K2]: Extends(P[K2], Right, True, False, options) };
7
7
  }, {});
8
8
  }
9
9
  // prettier-ignore
10
- function FromMappedResult(K, U, L, R, options) {
11
- return FromProperties(K.properties, U, L, R, options);
10
+ function FromMappedResult(Left, Right, True, False, options) {
11
+ return FromProperties(Left.properties, Right, True, False, options);
12
12
  }
13
13
  // prettier-ignore
14
- export function ExtendsFromMappedResult(T, U, L, R, options) {
15
- const P = FromMappedResult(T, U, L, R, options);
14
+ export function ExtendsFromMappedResult(Left, Right, True, False, options) {
15
+ const P = FromMappedResult(Left, Right, True, False, options);
16
16
  return MappedResult(P);
17
17
  }
@@ -6,7 +6,6 @@ import { ExtendsFromMappedResult } from './extends-from-mapped-result.mjs';
6
6
  // ------------------------------------------------------------------
7
7
  // TypeGuard
8
8
  // ------------------------------------------------------------------
9
- // prettier-ignore
10
9
  import { IsMappedKey, IsMappedResult } from '../guard/type.mjs';
11
10
  // prettier-ignore
12
11
  function ExtendsResolve(left, right, trueType, falseType) {
@@ -2,10 +2,10 @@ import type { TSchema, SchemaOptions } from '../schema/index.mjs';
2
2
  import type { TProperties } from '../object/index.mjs';
3
3
  import { type TMappedResult } from '../mapped/index.mjs';
4
4
  import { type TExtract } from './extract.mjs';
5
- type TFromProperties<K extends TProperties, U extends TSchema> = ({
6
- [K2 in keyof K]: TExtract<K[K2], U>;
5
+ type TFromProperties<P extends TProperties, T extends TSchema> = ({
6
+ [K2 in keyof P]: TExtract<P[K2], T>;
7
7
  });
8
- type TFromMappedResult<K extends TMappedResult, U extends TSchema> = (TFromProperties<K['properties'], U>);
9
- export type TExtractFromMappedResult<T extends TMappedResult, U extends TSchema, P extends TProperties = TFromMappedResult<T, U>> = (TMappedResult<P>);
10
- export declare function ExtractFromMappedResult<T extends TMappedResult, U extends TSchema, P extends TProperties = TFromMappedResult<T, U>>(T: T, U: U, options: SchemaOptions): TMappedResult<P>;
8
+ type TFromMappedResult<R extends TMappedResult, T extends TSchema> = (TFromProperties<R['properties'], T>);
9
+ export type TExtractFromMappedResult<R extends TMappedResult, T extends TSchema, P extends TProperties = TFromMappedResult<R, T>> = (TMappedResult<P>);
10
+ export declare function ExtractFromMappedResult<R extends TMappedResult, T extends TSchema, P extends TProperties = TFromMappedResult<R, T>>(R: R, T: T, options: SchemaOptions): TMappedResult<P>;
11
11
  export {};
@@ -1,17 +1,17 @@
1
1
  import { MappedResult } from '../mapped/index.mjs';
2
2
  import { Extract } from './extract.mjs';
3
3
  // prettier-ignore
4
- function FromProperties(K, U, options) {
5
- return globalThis.Object.getOwnPropertyNames(K).reduce((Acc, K2) => {
6
- return { ...Acc, [K2]: Extract(K[K2], U, options) };
4
+ function FromProperties(P, T, options) {
5
+ return globalThis.Object.getOwnPropertyNames(P).reduce((Acc, K2) => {
6
+ return { ...Acc, [K2]: Extract(P[K2], T, options) };
7
7
  }, {});
8
8
  }
9
9
  // prettier-ignore
10
- function FromMappedResult(K, U, options) {
11
- return FromProperties(K.properties, U, options);
10
+ function FromMappedResult(R, T, options) {
11
+ return FromProperties(R.properties, T, options);
12
12
  }
13
13
  // prettier-ignore
14
- export function ExtractFromMappedResult(T, U, options) {
15
- const P = FromMappedResult(T, U, options);
14
+ export function ExtractFromMappedResult(R, T, options) {
15
+ const P = FromMappedResult(R, T, options);
16
16
  return MappedResult(P);
17
17
  }
@@ -14,8 +14,7 @@ type TFromTemplateLiteral<T extends TTemplateLiteral, U extends TSchema> = Extra
14
14
  type TFromArray<T extends TSchema[], U extends TSchema> = AssertRest<UnionToTuple<{
15
15
  [K in keyof T]: Static<AssertType<T[K]>> extends Static<U> ? T[K] : never;
16
16
  }[number]>> extends infer R extends TSchema[] ? TUnionEvaluated<R> : never;
17
- export type TExtractResolve<T extends TSchema, U extends TSchema> = (T extends TTemplateLiteral ? TFromTemplateLiteral<T, U> : T extends TUnion<infer S> ? TFromArray<S, U> : T extends U ? T : T);
18
- export declare function ExtractResolve<L extends TSchema, R extends TSchema>(L: L, R: R): TExtractResolve<L, R>;
17
+ type TExtractResolve<T extends TSchema, U extends TSchema> = (T extends TTemplateLiteral ? TFromTemplateLiteral<T, U> : T extends TUnion<infer S> ? TFromArray<S, U> : T);
19
18
  export type TExtract<T extends TSchema, U extends TSchema> = TExtractResolve<T, U>;
20
19
  /** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */
21
20
  export declare function Extract<L extends TMappedResult, R extends TSchema>(type: L, union: R, options?: SchemaOptions): TExtractFromMappedResult<L, R>;
@@ -4,10 +4,12 @@ import { Never } from '../never/index.mjs';
4
4
  import { ExtendsCheck, ExtendsResult } from '../extends/index.mjs';
5
5
  import { CloneType } from '../clone/type.mjs';
6
6
  import { ExtractFromMappedResult } from './extract-from-mapped-result.mjs';
7
- // prettier-ignore
7
+ // ------------------------------------------------------------------
8
+ // TypeGuard
9
+ // ------------------------------------------------------------------
8
10
  import { IsMappedResult, IsTemplateLiteral, IsUnion } from '../guard/type.mjs';
9
11
  // prettier-ignore
10
- export function ExtractResolve(L, R) {
12
+ function ExtractResolve(L, R) {
11
13
  return (IsTemplateLiteral(L) ? ExtractResolve(TemplateLiteralToUnion(L), R) :
12
14
  IsTemplateLiteral(R) ? ExtractResolve(L, TemplateLiteralToUnion(R)) :
13
15
  IsUnion(L) ? (() => {
@@ -35,7 +35,6 @@ export * from './null/index.mjs';
35
35
  export * from './number/index.mjs';
36
36
  export * from './object/index.mjs';
37
37
  export * from './omit/index.mjs';
38
- export * from './operators/index.mjs';
39
38
  export * from './optional/index.mjs';
40
39
  export * from './parameters/index.mjs';
41
40
  export * from './partial/index.mjs';
@@ -53,6 +52,7 @@ export * from './required/index.mjs';
53
52
  export * from './rest/index.mjs';
54
53
  export * from './return-type/index.mjs';
55
54
  export * from './schema/index.mjs';
55
+ export * from './sets/index.mjs';
56
56
  export * from './static/index.mjs';
57
57
  export * from './strict/index.mjs';
58
58
  export * from './string/index.mjs';
@@ -35,7 +35,6 @@ export * from './null/index.mjs';
35
35
  export * from './number/index.mjs';
36
36
  export * from './object/index.mjs';
37
37
  export * from './omit/index.mjs';
38
- export * from './operators/index.mjs';
39
38
  export * from './optional/index.mjs';
40
39
  export * from './parameters/index.mjs';
41
40
  export * from './partial/index.mjs';
@@ -53,6 +52,7 @@ export * from './required/index.mjs';
53
52
  export * from './rest/index.mjs';
54
53
  export * from './return-type/index.mjs';
55
54
  export * from './schema/index.mjs';
55
+ export * from './sets/index.mjs';
56
56
  export * from './static/index.mjs';
57
57
  export * from './strict/index.mjs';
58
58
  export * from './string/index.mjs';
@@ -1,8 +1,8 @@
1
1
  import type { TSchema, SchemaOptions } from '../schema/index.mjs';
2
- import { type TProperties } from '../object/index.mjs';
2
+ import type { Evaluate } from '../helpers/index.mjs';
3
+ import type { TProperties } from '../object/index.mjs';
3
4
  import { type TIndex } from './indexed.mjs';
4
5
  import { type TMappedResult, type TMappedKey } from '../mapped/index.mjs';
5
- import { Evaluate } from '../helpers/index.mjs';
6
6
  type TMappedIndexPropertyKey<T extends TSchema, K extends PropertyKey> = {
7
7
  [_ in K]: TIndex<T, [K]>;
8
8
  };
@@ -5,11 +5,10 @@ function MappedIndexPropertyKey(T, K, options) {
5
5
  return { [K]: Index(T, [K], options) };
6
6
  }
7
7
  // prettier-ignore
8
- function MappedIndexPropertyKeys(T, K, options, Acc = {}) {
9
- const [L, ...R] = K;
10
- return (K.length > 0
11
- ? MappedIndexPropertyKeys(T, R, options, { ...Acc, ...MappedIndexPropertyKey(T, L, options) })
12
- : Acc);
8
+ function MappedIndexPropertyKeys(T, K, options) {
9
+ return K.reduce((Acc, L) => {
10
+ return { ...Acc, ...MappedIndexPropertyKey(T, L, options) };
11
+ }, {});
13
12
  }
14
13
  // prettier-ignore
15
14
  function MappedIndexProperties(T, K, options) {
@@ -6,7 +6,7 @@ import { type TIndex } from './index.mjs';
6
6
  type TFromProperties<T extends TSchema, P extends TProperties> = ({
7
7
  [K2 in keyof P]: TIndex<T, TIndexPropertyKeys<P[K2]>>;
8
8
  });
9
- type TFromMappedResult<T extends TSchema, K extends TMappedResult> = (TFromProperties<T, K['properties']>);
9
+ type TFromMappedResult<T extends TSchema, R extends TMappedResult> = (TFromProperties<T, R['properties']>);
10
10
  export type TIndexFromMappedResult<T extends TSchema, R extends TMappedResult, P extends TProperties = TFromMappedResult<T, R>> = (TMappedResult<P>);
11
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>;
12
12
  export {};
@@ -1,9 +1,9 @@
1
- import { type TTemplateLiteral, TTemplateLiteralGenerate } from '../template-literal/index.mjs';
2
- import { type TLiteral, type TLiteralValue } from '../literal/index.mjs';
3
- import { type TInteger } from '../integer/index.mjs';
4
- import { type TNumber } from '../number/index.mjs';
5
- import { type TSchema } from '../schema/index.mjs';
6
- import { type TUnion } from '../union/index.mjs';
1
+ import { type TTemplateLiteralGenerate, type TTemplateLiteral } from '../template-literal/index.mjs';
2
+ import type { TLiteral, TLiteralValue } from '../literal/index.mjs';
3
+ import type { TInteger } from '../integer/index.mjs';
4
+ import type { TNumber } from '../number/index.mjs';
5
+ import type { TSchema } from '../schema/index.mjs';
6
+ import type { TUnion } from '../union/index.mjs';
7
7
  type TFromTemplateLiteral<T extends TTemplateLiteral, R extends string[] = TTemplateLiteralGenerate<T>> = (R);
8
8
  type TFromUnion<T extends TSchema[], Acc extends string[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromUnion<R, [...TIndexPropertyKeys<L>, ...Acc]> : Acc);
9
9
  type TFromLiteral<T extends TLiteralValue> = (T extends PropertyKey ? [`${T}`] : []);
@@ -2,7 +2,6 @@ import { TemplateLiteralGenerate } from '../template-literal/index.mjs';
2
2
  // ------------------------------------------------------------------
3
3
  // TypeGuard
4
4
  // ------------------------------------------------------------------
5
- // prettier-ignore
6
5
  import { IsTemplateLiteral, IsUnion, IsLiteral, IsNumber, IsInteger } from '../guard/type.mjs';
7
6
  // prettier-ignore
8
7
  function FromTemplateLiteral(T) {
@@ -11,10 +10,9 @@ function FromTemplateLiteral(T) {
11
10
  }
12
11
  // prettier-ignore
13
12
  function FromUnion(T) {
14
- const [L, ...R] = T;
15
- return (T.length > 0
16
- ? [...IndexPropertyKeys(L), ...FromUnion(R)]
17
- : []);
13
+ return T.reduce((Acc, L) => {
14
+ return [...Acc, ...IndexPropertyKeys(L)];
15
+ }, []);
18
16
  }
19
17
  // prettier-ignore
20
18
  function FromLiteral(T) {
@@ -16,7 +16,7 @@ import { type TIndexFromMappedResult } from './indexed-from-mapped-result.mjs';
16
16
  type TFromRest<T extends TSchema[], K extends PropertyKey, Acc extends TSchema[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest<R, K, [...Acc, Assert<TFromKey<L, K>, TSchema>]> : Acc);
17
17
  type TFromIntersectRest<T extends TSchema[], Acc extends TSchema[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? L extends TNever ? TFromIntersectRest<R, [...Acc]> : TFromIntersectRest<R, [...Acc, L]> : Acc);
18
18
  type TFromIntersect<T extends TSchema[], K extends PropertyKey> = (TIntersectEvaluated<TFromIntersectRest<TFromRest<T, K>>>);
19
- type TFromUnionRest<T extends TSchema[], Acc extends TSchema[] = T> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? L extends TNever ? [] : TFromUnionRest<R, Acc> : Acc);
19
+ type TFromUnionRest<T extends TSchema[]> = T;
20
20
  type TFromUnion<T extends TSchema[], K extends PropertyKey> = (TUnionEvaluated<TFromUnionRest<TFromRest<T, K>>>);
21
21
  type TFromTuple<T extends TSchema[], K extends PropertyKey> = (K extends keyof T ? T[K] : K extends '[number]' ? TUnionEvaluated<T> : TNever);
22
22
  type TFromArray<T extends TSchema, K extends PropertyKey> = (K extends '[number]' ? T : TNever);
@@ -10,33 +10,20 @@ import { IndexFromMappedResult } from './indexed-from-mapped-result.mjs';
10
10
  // ------------------------------------------------------------------
11
11
  import { IsArray, IsIntersect, IsObject, IsMappedKey, IsMappedResult, IsNever, IsSchema, IsTuple, IsUnion } from '../guard/type.mjs';
12
12
  // prettier-ignore
13
- function FromRest(T, K, Acc = []) {
14
- const [L, ...R] = T;
15
- return (T.length > 0
16
- ? FromRest(R, K, [...Acc, FromKey(L, K)])
17
- : Acc);
13
+ function FromRest(T, K) {
14
+ return T.map(L => FromKey(L, K));
18
15
  }
19
16
  // prettier-ignore
20
- function FromIntersectRest(T, Acc = []) {
21
- const [L, ...R] = T;
22
- return (T.length > 0
23
- ? IsNever(L)
24
- ? FromIntersectRest(R, [...Acc])
25
- : FromIntersectRest(R, [...Acc, L])
26
- : Acc);
17
+ function FromIntersectRest(T) {
18
+ return T.filter(L => !IsNever(L));
27
19
  }
28
20
  // prettier-ignore
29
21
  function FromIntersect(T, K) {
30
22
  return (IntersectEvaluated(FromIntersectRest(FromRest(T, K))));
31
23
  }
32
24
  // prettier-ignore
33
- function FromUnionRest(T, Acc = T) {
34
- const [L, ...R] = T;
35
- return (T.length > 0
36
- ? IsNever(L)
37
- ? []
38
- : FromUnionRest(R, Acc)
39
- : Acc);
25
+ function FromUnionRest(T) {
26
+ return T; // review this
40
27
  }
41
28
  // prettier-ignore
42
29
  function FromUnion(T, K) {
@@ -56,9 +43,7 @@ function FromArray(T, K) {
56
43
  }
57
44
  // prettier-ignore
58
45
  function FromProperty(T, K) {
59
- return (K in T
60
- ? T[K]
61
- : Never());
46
+ return (K in T ? T[K] : Never());
62
47
  }
63
48
  // prettier-ignore
64
49
  function FromKey(T, K) {
@@ -70,11 +55,8 @@ function FromKey(T, K) {
70
55
  Never());
71
56
  }
72
57
  // prettier-ignore
73
- function FromKeys(T, K, Acc = []) {
74
- const [L, ...R] = K;
75
- return (K.length > 0
76
- ? FromKeys(T, R, [...Acc, FromKey(T, L)])
77
- : Acc);
58
+ function FromKeys(T, K) {
59
+ return K.map(L => FromKey(T, L));
78
60
  }
79
61
  // prettier-ignore
80
62
  function FromSchema(T, K) {
@@ -11,25 +11,15 @@ import { IntersectCreate } from './intersect-create.mjs';
11
11
  import { IsOptional, IsTransform, } from '../guard/type.mjs';
12
12
  // prettier-ignore
13
13
  function IsIntersectOptional(T) {
14
- const [L, ...R] = T;
15
- return (T.length > 0
16
- ? IsOptional(L)
17
- ? IsIntersectOptional(R)
18
- : false
19
- : true);
14
+ return T.every(L => IsOptional(L));
20
15
  }
21
16
  // prettier-ignore
22
17
  function RemoveOptionalFromType(T) {
23
18
  return (Discard(T, [OptionalKind]));
24
19
  }
25
20
  // prettier-ignore
26
- function RemoveOptionalFromRest(T, Acc = []) {
27
- const [L, ...R] = T;
28
- return (T.length > 0
29
- ? IsOptional(L)
30
- ? RemoveOptionalFromRest(R, [...Acc, RemoveOptionalFromType(L)])
31
- : RemoveOptionalFromRest(R, [...Acc, L])
32
- : Acc);
21
+ function RemoveOptionalFromRest(T) {
22
+ return T.map(L => IsOptional(L) ? RemoveOptionalFromType(L) : L);
33
23
  }
34
24
  // prettier-ignore
35
25
  function ResolveIntersect(T, options) {
@@ -1,5 +1,5 @@
1
- import { TSchema, SchemaOptions } from '../schema/index.mjs';
2
- import { TIntrinsic } from './intrinsic.mjs';
1
+ import type { TSchema, SchemaOptions } from '../schema/index.mjs';
2
+ import { type TIntrinsic } from './intrinsic.mjs';
3
3
  export type TCapitalize<T extends TSchema> = TIntrinsic<T, 'Capitalize'>;
4
4
  /** `[Json]` Intrinsic function to Capitalize LiteralString types */
5
5
  export declare function Capitalize<T extends TSchema>(T: T, options?: SchemaOptions): TCapitalize<T>;
@@ -3,7 +3,7 @@ import type { TProperties } from '../object/index.mjs';
3
3
  import { Assert } from '../helpers/index.mjs';
4
4
  import { type TMappedResult, type TMappedKey } from '../mapped/index.mjs';
5
5
  import { type TIntrinsic, type IntrinsicMode } from './intrinsic.mjs';
6
- import { TLiteral, TLiteralValue } from '../literal/index.mjs';
6
+ import { type TLiteral, type TLiteralValue } from '../literal/index.mjs';
7
7
  type TMappedIntrinsicPropertyKey<K extends PropertyKey, M extends IntrinsicMode> = {
8
8
  [_ in K]: TIntrinsic<TLiteral<Assert<K, TLiteralValue>>, M>;
9
9
  };
@@ -8,11 +8,10 @@ function MappedIntrinsicPropertyKey(K, M, options) {
8
8
  };
9
9
  }
10
10
  // prettier-ignore
11
- function MappedIntrinsicPropertyKeys(K, M, options, Acc = {}) {
12
- const [L, ...R] = K;
13
- return (K.length > 0
14
- ? MappedIntrinsicPropertyKeys(R, M, options, { ...Acc, ...MappedIntrinsicPropertyKey(L, M, options) })
15
- : Acc);
11
+ function MappedIntrinsicPropertyKeys(K, M, options) {
12
+ return K.reduce((Acc, L) => {
13
+ return { ...Acc, ...MappedIntrinsicPropertyKey(L, M, options) };
14
+ }, {});
16
15
  }
17
16
  // prettier-ignore
18
17
  function MappedIntrinsicProperties(T, M, options) {