@sinclair/typebox 0.32.0-dev-18 → 0.32.0-dev-19

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 (78) hide show
  1. package/build/import/compiler/compiler.mjs +14 -8
  2. package/build/import/errors/errors.mjs +15 -11
  3. package/build/import/type/awaited/awaited.mjs +4 -4
  4. package/build/import/type/deref/deref.mjs +12 -12
  5. package/build/import/type/exclude/exclude.mjs +8 -5
  6. package/build/import/type/extends/extends-check.mjs +167 -167
  7. package/build/import/type/extends/extends.mjs +3 -3
  8. package/build/import/type/extract/extract.mjs +5 -5
  9. package/build/import/type/guard/type.d.mts +50 -50
  10. package/build/import/type/guard/type.mjs +136 -136
  11. package/build/import/type/indexed/indexed-property-keys.mjs +7 -7
  12. package/build/import/type/indexed/indexed.mjs +9 -9
  13. package/build/import/type/intersect/intersect-create.mjs +4 -4
  14. package/build/import/type/intersect/intersect-evaluated.mjs +1 -1
  15. package/build/import/type/intersect/intersect.mjs +2 -2
  16. package/build/import/type/intrinsic/intrinsic.mjs +5 -5
  17. package/build/import/type/keyof/keyof-property-keys.mjs +7 -7
  18. package/build/import/type/keyof/keyof.mjs +2 -2
  19. package/build/import/type/mapped/mapped.mjs +16 -16
  20. package/build/import/type/modifiers/modifiers.mjs +3 -3
  21. package/build/import/type/object/object.mjs +3 -3
  22. package/build/import/type/omit/omit.mjs +6 -6
  23. package/build/import/type/partial/partial.mjs +5 -5
  24. package/build/import/type/pick/pick.mjs +6 -6
  25. package/build/import/type/record/record.mjs +7 -7
  26. package/build/import/type/required/required.mjs +5 -5
  27. package/build/import/type/rest/rest.mjs +6 -2
  28. package/build/import/type/template-literal/pattern.mjs +9 -9
  29. package/build/import/type/transform/transform.mjs +1 -1
  30. package/build/import/type/union/union-evaluated.mjs +2 -2
  31. package/build/import/value/check/check.mjs +18 -11
  32. package/build/import/value/clean/clean.mjs +9 -7
  33. package/build/import/value/clone/clone.mjs +7 -4
  34. package/build/import/value/convert/convert.mjs +6 -2
  35. package/build/import/value/default/default.mjs +12 -4
  36. package/build/import/value/transform/decode.mjs +12 -6
  37. package/build/import/value/transform/encode.mjs +12 -6
  38. package/build/import/value/transform/has.mjs +24 -18
  39. package/build/require/compiler/compiler.js +77 -71
  40. package/build/require/errors/errors.js +58 -54
  41. package/build/require/type/awaited/awaited.js +3 -3
  42. package/build/require/type/deref/deref.js +11 -11
  43. package/build/require/type/exclude/exclude.js +7 -4
  44. package/build/require/type/extends/extends-check.js +167 -167
  45. package/build/require/type/extends/extends.js +2 -2
  46. package/build/require/type/extract/extract.js +4 -4
  47. package/build/require/type/guard/type.d.ts +50 -50
  48. package/build/require/type/guard/type.js +184 -184
  49. package/build/require/type/indexed/indexed-property-keys.js +6 -6
  50. package/build/require/type/indexed/indexed.js +9 -9
  51. package/build/require/type/intersect/intersect-create.js +3 -3
  52. package/build/require/type/intersect/intersect-evaluated.js +2 -2
  53. package/build/require/type/intersect/intersect.js +1 -1
  54. package/build/require/type/intrinsic/intrinsic.js +4 -4
  55. package/build/require/type/keyof/keyof-property-keys.js +6 -6
  56. package/build/require/type/keyof/keyof.js +1 -1
  57. package/build/require/type/mapped/mapped.js +15 -15
  58. package/build/require/type/modifiers/modifiers.js +2 -2
  59. package/build/require/type/object/object.js +2 -2
  60. package/build/require/type/omit/omit.js +5 -5
  61. package/build/require/type/partial/partial.js +4 -4
  62. package/build/require/type/pick/pick.js +5 -5
  63. package/build/require/type/record/record.js +6 -6
  64. package/build/require/type/required/required.js +4 -4
  65. package/build/require/type/rest/rest.js +5 -1
  66. package/build/require/type/template-literal/pattern.js +8 -8
  67. package/build/require/type/transform/transform.js +1 -1
  68. package/build/require/type/union/union-evaluated.js +1 -1
  69. package/build/require/value/check/check.js +63 -56
  70. package/build/require/value/clean/clean.js +31 -29
  71. package/build/require/value/clone/clone.js +7 -4
  72. package/build/require/value/convert/convert.js +42 -38
  73. package/build/require/value/default/default.js +24 -16
  74. package/build/require/value/transform/decode.js +27 -21
  75. package/build/require/value/transform/encode.js +28 -22
  76. package/build/require/value/transform/has.js +29 -23
  77. package/package.json +1 -1
  78. package/readme.md +5 -5
@@ -24,7 +24,7 @@ function FromRest(T, K) {
24
24
  function FromIntersectRest(T) {
25
25
  const [L, ...R] = T;
26
26
  return (T.length > 0
27
- ? (0, type_2.TNever)(L)
27
+ ? (0, type_2.IsNever)(L)
28
28
  ? [...FromIntersectRest(R)]
29
29
  : [L, ...FromIntersectRest(R)]
30
30
  : []);
@@ -37,7 +37,7 @@ function FromIntersect(T, K) {
37
37
  function FromUnionRest(T, S = T) {
38
38
  const [L, ...R] = T;
39
39
  return (T.length > 0
40
- ? (0, type_2.TNever)(L)
40
+ ? (0, type_2.IsNever)(L)
41
41
  ? []
42
42
  : FromUnionRest(R, S)
43
43
  : S);
@@ -66,11 +66,11 @@ function FromProperty(T, K) {
66
66
  }
67
67
  // prettier-ignore
68
68
  function FromKey(T, K) {
69
- return ((0, type_2.TIntersect)(T) ? FromIntersect(T.allOf, K) :
70
- (0, type_2.TUnion)(T) ? FromUnion(T.anyOf, K) :
71
- (0, type_2.TTuple)(T) ? FromTuple(T.items ?? [], K) :
72
- (0, type_2.TArray)(T) ? FromArray(T.items, K) :
73
- (0, type_2.TObject)(T) ? FromProperty(T.properties, K) :
69
+ return ((0, type_2.IsIntersect)(T) ? FromIntersect(T.allOf, K) :
70
+ (0, type_2.IsUnion)(T) ? FromUnion(T.anyOf, K) :
71
+ (0, type_2.IsTuple)(T) ? FromTuple(T.items ?? [], K) :
72
+ (0, type_2.IsArray)(T) ? FromArray(T.items, K) :
73
+ (0, type_2.IsObject)(T) ? FromProperty(T.properties, K) :
74
74
  (0, index_1.Never)());
75
75
  }
76
76
  // prettier-ignore
@@ -87,8 +87,8 @@ function FromSchema(T, K) {
87
87
  /** `[Json]` Returns an Indexed property type for the given keys */
88
88
  function Index(T, K, options = {}) {
89
89
  // prettier-ignore
90
- return ((0, type_2.TMappedKey)(K) ? (0, type_1.CloneType)((0, indexed_from_mapped_key_1.IndexFromMappedKey)(T, K, options)) :
91
- (0, type_2.TSchema)(K) ? (0, type_1.CloneType)(FromSchema(T, (0, indexed_property_keys_1.IndexPropertyKeys)(K)), options) :
90
+ return ((0, type_2.IsMappedKey)(K) ? (0, type_1.CloneType)((0, indexed_from_mapped_key_1.IndexFromMappedKey)(T, K, options)) :
91
+ (0, type_2.IsSchema)(K) ? (0, type_1.CloneType)(FromSchema(T, (0, indexed_property_keys_1.IndexPropertyKeys)(K)), options) :
92
92
  (0, type_1.CloneType)(FromSchema(T, K), options));
93
93
  }
94
94
  exports.Index = Index;
@@ -14,11 +14,11 @@ const type_2 = require("../guard/type");
14
14
  // ------------------------------------------------------------------
15
15
  // prettier-ignore
16
16
  function IntersectCreate(T, options) {
17
- const allObjects = T.every((schema) => (0, type_2.TObject)(schema));
18
- const clonedUnevaluatedProperties = (0, type_2.TSchema)(options.unevaluatedProperties)
17
+ const allObjects = T.every((schema) => (0, type_2.IsObject)(schema));
18
+ const clonedUnevaluatedProperties = (0, type_2.IsSchema)(options.unevaluatedProperties)
19
19
  ? { unevaluatedProperties: (0, type_1.CloneType)(options.unevaluatedProperties) }
20
20
  : {};
21
- return ((options.unevaluatedProperties === false || (0, type_2.TSchema)(options.unevaluatedProperties) || allObjects
21
+ return ((options.unevaluatedProperties === false || (0, type_2.IsSchema)(options.unevaluatedProperties) || allObjects
22
22
  ? { ...options, ...clonedUnevaluatedProperties, [index_1.Kind]: 'Intersect', type: 'object', allOf: (0, type_1.CloneRest)(T) }
23
23
  : { ...options, ...clonedUnevaluatedProperties, [index_1.Kind]: 'Intersect', allOf: (0, type_1.CloneRest)(T) }));
24
24
  }
@@ -17,7 +17,7 @@ const type_2 = require("../guard/type");
17
17
  function IsIntersectOptional(T) {
18
18
  const [L, ...R] = T;
19
19
  return (T.length > 0
20
- ? (0, type_2.TOptional)(L)
20
+ ? (0, type_2.IsOptional)(L)
21
21
  ? IsIntersectOptional(R)
22
22
  : false
23
23
  : true);
@@ -42,7 +42,7 @@ function IntersectEvaluated(T, options = {}) {
42
42
  return (0, index_3.Never)(options);
43
43
  if (T.length === 1)
44
44
  return (0, type_1.CloneType)(T[0], options);
45
- if (T.some((schema) => (0, type_2.TTransform)(schema)))
45
+ if (T.some((schema) => (0, type_2.IsTransform)(schema)))
46
46
  throw new Error('Cannot intersect transform types');
47
47
  return ResolveIntersect(T, options);
48
48
  }
@@ -16,7 +16,7 @@ function Intersect(T, options = {}) {
16
16
  return (0, index_1.Never)(options);
17
17
  if (T.length === 1)
18
18
  return (0, type_1.CloneType)(T[0], options);
19
- if (T.some((schema) => (0, type_2.TTransform)(schema)))
19
+ if (T.some((schema) => (0, type_2.IsTransform)(schema)))
20
20
  throw new Error('Cannot intersect transform types');
21
21
  return (0, intersect_create_1.IntersectCreate)(T, options);
22
22
  }
@@ -58,11 +58,11 @@ function Intrinsic(schema, mode, options = {}) {
58
58
  // prettier-ignore
59
59
  return (
60
60
  // Intrinsic-Mapped-Inference
61
- (0, type_1.TMappedKey)(schema) ? (0, intrinsic_from_mapped_key_1.IntrinsicFromMappedKey)(schema, mode, options) :
61
+ (0, type_1.IsMappedKey)(schema) ? (0, intrinsic_from_mapped_key_1.IntrinsicFromMappedKey)(schema, mode, options) :
62
62
  // Standard-Inference
63
- (0, type_1.TTemplateLiteral)(schema) ? FromTemplateLiteral(schema, mode, schema) :
64
- (0, type_1.TUnion)(schema) ? (0, index_3.Union)(FromRest(schema.anyOf, mode), options) :
65
- (0, type_1.TLiteral)(schema) ? (0, index_2.Literal)(FromLiteralValue(schema.const, mode), options) :
63
+ (0, type_1.IsTemplateLiteral)(schema) ? FromTemplateLiteral(schema, mode, schema) :
64
+ (0, type_1.IsUnion)(schema) ? (0, index_3.Union)(FromRest(schema.anyOf, mode), options) :
65
+ (0, type_1.IsLiteral)(schema) ? (0, index_2.Literal)(FromLiteralValue(schema.const, mode), options) :
66
66
  schema);
67
67
  }
68
68
  exports.Intrinsic = Intrinsic;
@@ -57,12 +57,12 @@ function FromPatternProperties(patternProperties) {
57
57
  /** Returns a tuple of PropertyKeys derived from the given TSchema. */
58
58
  // prettier-ignore
59
59
  function KeyOfPropertyKeys(T) {
60
- return ((0, type_1.TIntersect)(T) ? FromIntersect(T.allOf) :
61
- (0, type_1.TUnion)(T) ? FromUnion(T.anyOf) :
62
- (0, type_1.TTuple)(T) ? FromTuple(T.items ?? []) :
63
- (0, type_1.TArray)(T) ? FromArray(T.items) :
64
- (0, type_1.TObject)(T) ? FromProperties(T.properties) :
65
- (0, type_1.TRecord)(T) ? FromPatternProperties(T.patternProperties) :
60
+ return ((0, type_1.IsIntersect)(T) ? FromIntersect(T.allOf) :
61
+ (0, type_1.IsUnion)(T) ? FromUnion(T.anyOf) :
62
+ (0, type_1.IsTuple)(T) ? FromTuple(T.items ?? []) :
63
+ (0, type_1.IsArray)(T) ? FromArray(T.items) :
64
+ (0, type_1.IsObject)(T) ? FromProperties(T.properties) :
65
+ (0, type_1.IsRecord)(T) ? FromPatternProperties(T.patternProperties) :
66
66
  []);
67
67
  }
68
68
  exports.KeyOfPropertyKeys = KeyOfPropertyKeys;
@@ -24,7 +24,7 @@ function FromLiterals(T) {
24
24
  }
25
25
  /** `[Json]` Creates a KeyOf type */
26
26
  function KeyOf(T, options = {}) {
27
- if ((0, type_2.TMappedResult)(T)) {
27
+ if ((0, type_2.IsMappedResult)(T)) {
28
28
  return (0, keyof_from_mapped_result_1.KeyOfFromMappedResult)(T, options);
29
29
  }
30
30
  else {
@@ -62,22 +62,22 @@ function FromProperties(K, T) {
62
62
  function FromSchemaType(K, T) {
63
63
  return (
64
64
  // unevaluated modifier types
65
- (0, type_2.TOptional)(T) ? (0, index_12.Optional)(FromSchemaType(K, (0, index_2.Discard)(T, [index_1.OptionalKind]))) :
66
- (0, type_2.TReadonly)(T) ? (0, index_14.Readonly)(FromSchemaType(K, (0, index_2.Discard)(T, [index_1.ReadonlyKind]))) :
65
+ (0, type_2.IsOptional)(T) ? (0, index_12.Optional)(FromSchemaType(K, (0, index_2.Discard)(T, [index_1.OptionalKind]))) :
66
+ (0, type_2.IsReadonly)(T) ? (0, index_14.Readonly)(FromSchemaType(K, (0, index_2.Discard)(T, [index_1.ReadonlyKind]))) :
67
67
  // unevaluated mapped types
68
- (0, type_2.TMappedResult)(T) ? FromMappedResult(K, T.properties) :
69
- (0, type_2.TMappedKey)(T) ? FromMappedKey(K, T.keys) :
68
+ (0, type_2.IsMappedResult)(T) ? FromMappedResult(K, T.properties) :
69
+ (0, type_2.IsMappedKey)(T) ? FromMappedKey(K, T.keys) :
70
70
  // unevaluated types
71
- (0, type_2.TConstructor)(T) ? (0, index_5.Constructor)(FromRest(K, T.parameters), FromSchemaType(K, T.returns)) :
72
- (0, type_2.TFunction)(T) ? (0, index_6.Function)(FromRest(K, T.parameters), FromSchemaType(K, T.returns)) :
73
- (0, type_2.TAsyncIterator)(T) ? (0, index_4.AsyncIterator)(FromSchemaType(K, T.items)) :
74
- (0, type_2.TIterator)(T) ? (0, index_9.Iterator)(FromSchemaType(K, T.items)) :
75
- (0, type_2.TIntersect)(T) ? (0, index_8.Intersect)(FromRest(K, T.allOf)) :
76
- (0, type_2.TUnion)(T) ? (0, index_16.Union)(FromRest(K, T.anyOf)) :
77
- (0, type_2.TTuple)(T) ? (0, index_15.Tuple)(FromRest(K, T.items ?? [])) :
78
- (0, type_2.TObject)(T) ? (0, index_11.Object)(FromProperties(K, T.properties)) :
79
- (0, type_2.TArray)(T) ? (0, index_3.Array)(FromSchemaType(K, T.items)) :
80
- (0, type_2.TPromise)(T) ? (0, index_13.Promise)(FromSchemaType(K, T.item)) :
71
+ (0, type_2.IsConstructor)(T) ? (0, index_5.Constructor)(FromRest(K, T.parameters), FromSchemaType(K, T.returns)) :
72
+ (0, type_2.IsFunction)(T) ? (0, index_6.Function)(FromRest(K, T.parameters), FromSchemaType(K, T.returns)) :
73
+ (0, type_2.IsAsyncIterator)(T) ? (0, index_4.AsyncIterator)(FromSchemaType(K, T.items)) :
74
+ (0, type_2.IsIterator)(T) ? (0, index_9.Iterator)(FromSchemaType(K, T.items)) :
75
+ (0, type_2.IsIntersect)(T) ? (0, index_8.Intersect)(FromRest(K, T.allOf)) :
76
+ (0, type_2.IsUnion)(T) ? (0, index_16.Union)(FromRest(K, T.anyOf)) :
77
+ (0, type_2.IsTuple)(T) ? (0, index_15.Tuple)(FromRest(K, T.items ?? [])) :
78
+ (0, type_2.IsObject)(T) ? (0, index_11.Object)(FromProperties(K, T.properties)) :
79
+ (0, type_2.IsArray)(T) ? (0, index_3.Array)(FromSchemaType(K, T.items)) :
80
+ (0, type_2.IsPromise)(T) ? (0, index_13.Promise)(FromSchemaType(K, T.item)) :
81
81
  T);
82
82
  }
83
83
  // prettier-ignore
@@ -89,7 +89,7 @@ function FromMappedFunctionReturnType(K, T) {
89
89
  }
90
90
  /** `[Json]` Creates a Mapped object type */
91
91
  function Mapped(key, map, options = {}) {
92
- const K = (0, type_2.TSchema)(key) ? (0, index_7.IndexPropertyKeys)(key) : key;
92
+ const K = (0, type_2.IsSchema)(key) ? (0, index_7.IndexPropertyKeys)(key) : key;
93
93
  const RT = map({ [index_1.Kind]: 'MappedKey', keys: K });
94
94
  const R = FromMappedFunctionReturnType(K, RT);
95
95
  return (0, type_1.CloneType)((0, index_11.Object)(R), options);
@@ -16,7 +16,7 @@ const type_1 = require("../guard/type");
16
16
  function IsOptionalFromIntersect(T) {
17
17
  const [L, ...R] = T;
18
18
  return (T.length > 0
19
- ? (0, type_1.TOptional)(L)
19
+ ? (0, type_1.IsOptional)(L)
20
20
  ? IsOptionalFromIntersect(R)
21
21
  : false
22
22
  : true);
@@ -25,7 +25,7 @@ function IsOptionalFromIntersect(T) {
25
25
  function IsOptionalFromUnion(T) {
26
26
  const [L, ...R] = T;
27
27
  return (T.length > 0
28
- ? (0, type_1.TOptional)(L)
28
+ ? (0, type_1.IsOptional)(L)
29
29
  ? true
30
30
  : IsOptionalFromUnion(R)
31
31
  : false);
@@ -12,9 +12,9 @@ const type_2 = require("../guard/type");
12
12
  /** `[Json]` Creates an Object type */
13
13
  function _Object(properties, options = {}) {
14
14
  const propertyKeys = globalThis.Object.getOwnPropertyNames(properties);
15
- const optionalKeys = propertyKeys.filter((key) => (0, type_2.TOptional)(properties[key]));
15
+ const optionalKeys = propertyKeys.filter((key) => (0, type_2.IsOptional)(properties[key]));
16
16
  const requiredKeys = propertyKeys.filter((name) => !optionalKeys.includes(name));
17
- const clonedAdditionalProperties = (0, type_2.TSchema)(options.additionalProperties) ? { additionalProperties: (0, type_1.CloneType)(options.additionalProperties) } : {};
17
+ const clonedAdditionalProperties = (0, type_2.IsSchema)(options.additionalProperties) ? { additionalProperties: (0, type_1.CloneType)(options.additionalProperties) } : {};
18
18
  const clonedProperties = propertyKeys.reduce((acc, key) => ({ ...acc, [key]: (0, type_1.CloneType)(properties[key]) }), {});
19
19
  return (requiredKeys.length > 0
20
20
  ? { ...options, ...clonedAdditionalProperties, [index_1.Kind]: 'Object', type: 'object', properties: clonedProperties, required: requiredKeys }
@@ -39,18 +39,18 @@ function FromProperties(T, K) {
39
39
  }
40
40
  // prettier-ignore
41
41
  function OmitResolve(T, K) {
42
- return ((0, type_2.TIntersect)(T) ? (0, index_1.Intersect)(FromIntersect(T.allOf, K)) :
43
- (0, type_2.TUnion)(T) ? (0, index_2.Union)(FromUnion(T.anyOf, K)) :
44
- (0, type_2.TObject)(T) ? (0, index_3.Object)(FromProperties(T.properties, K)) :
42
+ return ((0, type_2.IsIntersect)(T) ? (0, index_1.Intersect)(FromIntersect(T.allOf, K)) :
43
+ (0, type_2.IsUnion)(T) ? (0, index_2.Union)(FromUnion(T.anyOf, K)) :
44
+ (0, type_2.IsObject)(T) ? (0, index_3.Object)(FromProperties(T.properties, K)) :
45
45
  (0, index_3.Object)({}));
46
46
  }
47
47
  exports.OmitResolve = OmitResolve;
48
48
  function Omit(T, K, options = {}) {
49
- if ((0, type_2.TMappedKey)(K)) {
49
+ if ((0, type_2.IsMappedKey)(K)) {
50
50
  return (0, omit_from_mapped_key_1.OmitFromMappedKey)(T, K, options);
51
51
  }
52
52
  else {
53
- const I = (0, type_2.TSchema)(K) ? (0, index_4.IndexPropertyKeys)(K) : K;
53
+ const I = (0, type_2.IsSchema)(K) ? (0, index_4.IndexPropertyKeys)(K) : K;
54
54
  const D = (0, index_5.Discard)(T, [index_6.TransformKind, '$id', 'required']);
55
55
  const R = (0, type_1.CloneType)(OmitResolve(T, I), options);
56
56
  return { ...D, ...R };
@@ -37,14 +37,14 @@ function FromProperties(T) {
37
37
  }
38
38
  // prettier-ignore
39
39
  function PartialResolve(T) {
40
- return ((0, type_2.TIntersect)(T) ? (0, index_3.Intersect)(FromIntersect(T.allOf)) :
41
- (0, type_2.TUnion)(T) ? (0, index_4.Union)(FromUnion(T.anyOf)) :
42
- (0, type_2.TObject)(T) ? (0, index_2.Object)(FromProperties(T.properties)) :
40
+ return ((0, type_2.IsIntersect)(T) ? (0, index_3.Intersect)(FromIntersect(T.allOf)) :
41
+ (0, type_2.IsUnion)(T) ? (0, index_4.Union)(FromUnion(T.anyOf)) :
42
+ (0, type_2.IsObject)(T) ? (0, index_2.Object)(FromProperties(T.properties)) :
43
43
  (0, index_2.Object)({}));
44
44
  }
45
45
  /** `[Json]` Constructs a type where all properties are optional */
46
46
  function Partial(T, options = {}) {
47
- if ((0, type_2.TMappedResult)(T)) {
47
+ if ((0, type_2.IsMappedResult)(T)) {
48
48
  return (0, partial_from_mapped_result_1.PartialFromMappedResult)(T, options);
49
49
  }
50
50
  else {
@@ -30,18 +30,18 @@ function FromProperties(T, K) {
30
30
  }
31
31
  // prettier-ignore
32
32
  function PickResolve(T, K) {
33
- return ((0, type_2.TIntersect)(T) ? (0, index_1.Intersect)(FromIntersect(T.allOf, K)) :
34
- (0, type_2.TUnion)(T) ? (0, index_2.Union)(FromUnion(T.anyOf, K)) :
35
- (0, type_2.TObject)(T) ? (0, index_3.Object)(FromProperties(T.properties, K)) :
33
+ return ((0, type_2.IsIntersect)(T) ? (0, index_1.Intersect)(FromIntersect(T.allOf, K)) :
34
+ (0, type_2.IsUnion)(T) ? (0, index_2.Union)(FromUnion(T.anyOf, K)) :
35
+ (0, type_2.IsObject)(T) ? (0, index_3.Object)(FromProperties(T.properties, K)) :
36
36
  (0, index_3.Object)({}));
37
37
  }
38
38
  exports.PickResolve = PickResolve;
39
39
  function Pick(T, K, options = {}) {
40
- if ((0, type_2.TMappedKey)(K)) {
40
+ if ((0, type_2.IsMappedKey)(K)) {
41
41
  return (0, pick_from_mapped_key_1.PickFromMappedKey)(T, K, options);
42
42
  }
43
43
  else {
44
- const I = (0, type_2.TSchema)(K) ? (0, index_4.IndexPropertyKeys)(K) : K;
44
+ const I = (0, type_2.IsSchema)(K) ? (0, index_4.IndexPropertyKeys)(K) : K;
45
45
  const D = (0, index_5.Discard)(T, [index_6.TransformKind, '$id', 'required']);
46
46
  const R = (0, type_1.CloneType)(PickResolve(T, I), options);
47
47
  return { ...D, ...R };
@@ -70,12 +70,12 @@ function FromNumberKey(_, T, options) {
70
70
  /** `[Json]` Creates a Record type */
71
71
  function Record(K, T, options = {}) {
72
72
  // prettier-ignore
73
- return ((0, type_2.TUnion)(K) ? FromUnionKey(K.anyOf, T, options) :
74
- (0, type_2.TTemplateLiteral)(K) ? FromTemplateLiteralKey(K, T, options) :
75
- (0, type_2.TLiteral)(K) ? FromLiteralKey(K.const, T, options) :
76
- (0, type_2.TString)(K) ? FromStringKey(K, T, options) :
77
- (0, type_2.TInteger)(K) ? FromIntegerKey(K, T, options) :
78
- (0, type_2.TNumber)(K) ? FromNumberKey(K, T, options) :
73
+ return ((0, type_2.IsUnion)(K) ? FromUnionKey(K.anyOf, T, options) :
74
+ (0, type_2.IsTemplateLiteral)(K) ? FromTemplateLiteralKey(K, T, options) :
75
+ (0, type_2.IsLiteral)(K) ? FromLiteralKey(K.const, T, options) :
76
+ (0, type_2.IsString)(K) ? FromStringKey(K, T, options) :
77
+ (0, type_2.IsInteger)(K) ? FromIntegerKey(K, T, options) :
78
+ (0, type_2.IsNumber)(K) ? FromNumberKey(K, T, options) :
79
79
  (0, index_2.Never)(options));
80
80
  }
81
81
  exports.Record = Record;
@@ -36,14 +36,14 @@ function FromProperties(T) {
36
36
  }
37
37
  // prettier-ignore
38
38
  function RequiredResolve(T) {
39
- return ((0, type_2.TIntersect)(T) ? (0, index_1.Intersect)(FromIntersect(T.allOf)) :
40
- (0, type_2.TUnion)(T) ? (0, index_2.Union)(FromUnion(T.anyOf)) :
41
- (0, type_2.TObject)(T) ? (0, index_3.Object)(FromProperties(T.properties)) :
39
+ return ((0, type_2.IsIntersect)(T) ? (0, index_1.Intersect)(FromIntersect(T.allOf)) :
40
+ (0, type_2.IsUnion)(T) ? (0, index_2.Union)(FromUnion(T.anyOf)) :
41
+ (0, type_2.IsObject)(T) ? (0, index_3.Object)(FromProperties(T.properties)) :
42
42
  (0, index_3.Object)({}));
43
43
  }
44
44
  /** `[Json]` Constructs a type where all properties are required */
45
45
  function Required(T, options = {}) {
46
- if ((0, type_2.TMappedResult)(T)) {
46
+ if ((0, type_2.IsMappedResult)(T)) {
47
47
  return (0, required_from_mapped_result_1.RequiredFromMappedResult)(T, options);
48
48
  }
49
49
  else {
@@ -8,8 +8,12 @@ const type_1 = require("../clone/type");
8
8
  // ------------------------------------------------------------------
9
9
  // prettier-ignore
10
10
  const type_2 = require("../guard/type");
11
+ // prettier-ignore
11
12
  function RestResolve(T) {
12
- return ((0, type_2.TIntersect)(T) ? [...T.allOf] : (0, type_2.TUnion)(T) ? [...T.anyOf] : (0, type_2.TTuple)(T) ? [...(T.items ?? [])] : []);
13
+ return ((0, type_2.IsIntersect)(T) ? [...T.allOf] :
14
+ (0, type_2.IsUnion)(T) ? [...T.anyOf] :
15
+ (0, type_2.IsTuple)(T) ? [...(T.items ?? [])] :
16
+ []);
13
17
  }
14
18
  exports.RestResolve = RestResolve;
15
19
  /** `[Json]` Extracts interior Rest elements from Tuple, Intersect and Union types */
@@ -23,14 +23,14 @@ function Escape(value) {
23
23
  }
24
24
  // prettier-ignore
25
25
  function Visit(schema, acc) {
26
- return ((0, type_1.TTemplateLiteral)(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) :
27
- (0, type_1.TUnion)(schema) ? `(${schema.anyOf.map((schema) => Visit(schema, acc)).join('|')})` :
28
- (0, type_1.TNumber)(schema) ? `${acc}${index_1.PatternNumber}` :
29
- (0, type_1.TInteger)(schema) ? `${acc}${index_1.PatternNumber}` :
30
- (0, type_1.TBigInt)(schema) ? `${acc}${index_1.PatternNumber}` :
31
- (0, type_1.TString)(schema) ? `${acc}${index_1.PatternString}` :
32
- (0, type_1.TLiteral)(schema) ? `${acc}${Escape(schema.const.toString())}` :
33
- (0, type_1.TBoolean)(schema) ? `${acc}${index_1.PatternBoolean}` :
26
+ return ((0, type_1.IsTemplateLiteral)(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) :
27
+ (0, type_1.IsUnion)(schema) ? `(${schema.anyOf.map((schema) => Visit(schema, acc)).join('|')})` :
28
+ (0, type_1.IsNumber)(schema) ? `${acc}${index_1.PatternNumber}` :
29
+ (0, type_1.IsInteger)(schema) ? `${acc}${index_1.PatternNumber}` :
30
+ (0, type_1.IsBigInt)(schema) ? `${acc}${index_1.PatternNumber}` :
31
+ (0, type_1.IsString)(schema) ? `${acc}${index_1.PatternString}` :
32
+ (0, type_1.IsLiteral)(schema) ? `${acc}${Escape(schema.const.toString())}` :
33
+ (0, type_1.IsBoolean)(schema) ? `${acc}${index_1.PatternBoolean}` :
34
34
  (() => { throw new TemplateLiteralPatternError(`Unexpected Kind '${schema[index_2.Kind]}'`); })());
35
35
  }
36
36
  function TemplateLiteralPattern(kinds) {
@@ -39,7 +39,7 @@ class TransformEncodeBuilder {
39
39
  }
40
40
  Encode(encode) {
41
41
  const schema = (0, type_1.CloneType)(this.schema);
42
- return ((0, type_2.TTransform)(schema) ? this.EncodeTransform(encode, schema) : this.EncodeSchema(encode, schema));
42
+ return ((0, type_2.IsTransform)(schema) ? this.EncodeTransform(encode, schema) : this.EncodeSchema(encode, schema));
43
43
  }
44
44
  }
45
45
  exports.TransformEncodeBuilder = TransformEncodeBuilder;
@@ -17,7 +17,7 @@ const type_2 = require("../guard/type");
17
17
  function IsUnionOptional(T) {
18
18
  const [L, ...R] = T;
19
19
  return (T.length > 0
20
- ? (0, type_2.TOptional)(L)
20
+ ? (0, type_2.IsOptional)(L)
21
21
  ? true
22
22
  : IsUnionOptional(R)
23
23
  : false);