@sinclair/typebox 0.32.0-dev-12 → 0.32.0-dev-13

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 (124) hide show
  1. package/build/import/index.d.mts +5 -5
  2. package/build/import/index.mjs +3 -3
  3. package/build/import/type/composite/composite.d.mts +2 -2
  4. package/build/import/type/extends/extends-mapped-result-from-result.d.mts +13 -0
  5. package/build/import/type/extends/extends-mapped-result-from-result.mjs +14 -0
  6. package/build/import/type/extends/extends-mapped-result.d.mts +13 -9
  7. package/build/import/type/extends/extends-mapped-result.mjs +15 -8
  8. package/build/import/type/extends/extends.d.mts +4 -4
  9. package/build/import/type/extends/extends.mjs +4 -4
  10. package/build/import/type/extends/index.d.mts +1 -1
  11. package/build/import/type/extends/index.mjs +1 -1
  12. package/build/import/type/indexed/index.d.mts +2 -2
  13. package/build/import/type/indexed/index.mjs +2 -2
  14. package/build/import/type/indexed/{indexed-mapped.d.mts → indexed-mapped-result.d.mts} +4 -4
  15. package/build/import/type/indexed/{indexed-mapped.mjs → indexed-mapped-result.mjs} +3 -3
  16. package/build/import/type/indexed/indexed-property-keys.d.mts +3 -3
  17. package/build/import/type/indexed/indexed-property-keys.mjs +2 -2
  18. package/build/import/type/indexed/{indexed-type.d.mts → indexed-result.d.mts} +2 -2
  19. package/build/import/type/indexed/{indexed-type.mjs → indexed-result.mjs} +1 -1
  20. package/build/import/type/indexed/indexed.d.mts +6 -6
  21. package/build/import/type/indexed/indexed.mjs +6 -6
  22. package/build/import/type/intrinsic/capitalize.d.mts +4 -0
  23. package/build/import/type/intrinsic/capitalize.mjs +5 -0
  24. package/build/import/type/intrinsic/index.d.mts +5 -0
  25. package/build/import/type/intrinsic/index.mjs +5 -0
  26. package/build/import/type/intrinsic/intrinsic-mapped-result.d.mts +15 -0
  27. package/build/import/type/intrinsic/intrinsic-mapped-result.mjs +21 -0
  28. package/build/import/type/intrinsic/intrinsic.d.mts +9 -14
  29. package/build/import/type/intrinsic/intrinsic.mjs +10 -21
  30. package/build/import/type/intrinsic/lowercase.d.mts +4 -0
  31. package/build/import/type/intrinsic/lowercase.mjs +5 -0
  32. package/build/import/type/intrinsic/uncapitalize.d.mts +4 -0
  33. package/build/import/type/intrinsic/uncapitalize.mjs +5 -0
  34. package/build/import/type/intrinsic/uppercase.d.mts +4 -0
  35. package/build/import/type/intrinsic/uppercase.mjs +5 -0
  36. package/build/import/type/mapped/index.d.mts +2 -0
  37. package/build/import/type/mapped/index.mjs +2 -0
  38. package/build/import/type/mapped/mapped-key.d.mts +8 -0
  39. package/build/import/type/mapped/mapped-key.mjs +7 -0
  40. package/build/import/type/mapped/mapped-result.d.mts +9 -0
  41. package/build/import/type/mapped/mapped-result.mjs +7 -0
  42. package/build/import/type/mapped/mapped.d.mts +17 -27
  43. package/build/import/type/mapped/mapped.mjs +22 -32
  44. package/build/import/type/omit/index.d.mts +1 -0
  45. package/build/import/type/omit/index.mjs +1 -0
  46. package/build/import/type/omit/omit-mapped-result.d.mts +15 -0
  47. package/build/import/type/omit/omit-mapped-result.mjs +20 -0
  48. package/build/import/type/omit/omit.d.mts +5 -2
  49. package/build/import/type/omit/omit.mjs +12 -6
  50. package/build/import/type/pick/index.d.mts +1 -0
  51. package/build/import/type/pick/index.mjs +1 -0
  52. package/build/import/type/pick/pick-mapped-result.d.mts +15 -0
  53. package/build/import/type/pick/pick-mapped-result.mjs +20 -0
  54. package/build/import/type/pick/pick.d.mts +5 -2
  55. package/build/import/type/pick/pick.mjs +12 -6
  56. package/build/import/type/record/record.mjs +4 -4
  57. package/build/import/type/type/json.d.mts +15 -13
  58. package/build/import/value/transform/decode.mjs +2 -2
  59. package/build/import/value/transform/encode.mjs +2 -2
  60. package/build/require/index.d.ts +5 -5
  61. package/build/require/index.js +7 -6
  62. package/build/require/type/composite/composite.d.ts +2 -2
  63. package/build/require/type/extends/extends-mapped-result-from-result.d.ts +13 -0
  64. package/build/require/type/extends/extends-mapped-result-from-result.js +18 -0
  65. package/build/require/type/extends/extends-mapped-result.d.ts +13 -9
  66. package/build/require/type/extends/extends-mapped-result.js +17 -10
  67. package/build/require/type/extends/extends.d.ts +4 -4
  68. package/build/require/type/extends/extends.js +3 -3
  69. package/build/require/type/extends/index.d.ts +1 -1
  70. package/build/require/type/extends/index.js +1 -1
  71. package/build/require/type/indexed/index.d.ts +2 -2
  72. package/build/require/type/indexed/index.js +2 -2
  73. package/build/require/type/indexed/{indexed-mapped.d.ts → indexed-mapped-result.d.ts} +4 -4
  74. package/build/require/type/indexed/{indexed-mapped.js → indexed-mapped-result.js} +5 -5
  75. package/build/require/type/indexed/indexed-property-keys.d.ts +3 -3
  76. package/build/require/type/indexed/indexed-property-keys.js +4 -4
  77. package/build/require/type/indexed/{indexed-type.d.ts → indexed-result.d.ts} +2 -2
  78. package/build/require/type/indexed/{indexed-type.js → indexed-result.js} +3 -3
  79. package/build/require/type/indexed/indexed.d.ts +6 -6
  80. package/build/require/type/indexed/indexed.js +5 -5
  81. package/build/require/type/intrinsic/capitalize.d.ts +4 -0
  82. package/build/require/type/intrinsic/capitalize.js +9 -0
  83. package/build/require/type/intrinsic/index.d.ts +5 -0
  84. package/build/require/type/intrinsic/index.js +5 -0
  85. package/build/require/type/intrinsic/intrinsic-mapped-result.d.ts +15 -0
  86. package/build/require/type/intrinsic/intrinsic-mapped-result.js +25 -0
  87. package/build/require/type/intrinsic/intrinsic.d.ts +9 -14
  88. package/build/require/type/intrinsic/intrinsic.js +10 -25
  89. package/build/require/type/intrinsic/lowercase.d.ts +4 -0
  90. package/build/require/type/intrinsic/lowercase.js +9 -0
  91. package/build/require/type/intrinsic/uncapitalize.d.ts +4 -0
  92. package/build/require/type/intrinsic/uncapitalize.js +9 -0
  93. package/build/require/type/intrinsic/uppercase.d.ts +4 -0
  94. package/build/require/type/intrinsic/uppercase.js +9 -0
  95. package/build/require/type/mapped/index.d.ts +2 -0
  96. package/build/require/type/mapped/index.js +2 -0
  97. package/build/require/type/mapped/mapped-key.d.ts +8 -0
  98. package/build/require/type/mapped/mapped-key.js +11 -0
  99. package/build/require/type/mapped/mapped-result.d.ts +9 -0
  100. package/build/require/type/mapped/mapped-result.js +11 -0
  101. package/build/require/type/mapped/mapped.d.ts +17 -27
  102. package/build/require/type/mapped/mapped.js +31 -45
  103. package/build/require/type/omit/index.d.ts +1 -0
  104. package/build/require/type/omit/index.js +1 -0
  105. package/build/require/type/omit/omit-mapped-result.d.ts +15 -0
  106. package/build/require/type/omit/omit-mapped-result.js +24 -0
  107. package/build/require/type/omit/omit.d.ts +5 -2
  108. package/build/require/type/omit/omit.js +10 -4
  109. package/build/require/type/pick/index.d.ts +1 -0
  110. package/build/require/type/pick/index.js +1 -0
  111. package/build/require/type/pick/pick-mapped-result.d.ts +15 -0
  112. package/build/require/type/pick/pick-mapped-result.js +24 -0
  113. package/build/require/type/pick/pick.d.ts +5 -2
  114. package/build/require/type/pick/pick.js +10 -4
  115. package/build/require/type/record/record.js +2 -2
  116. package/build/require/type/type/json.d.ts +15 -13
  117. package/build/require/value/transform/decode.js +1 -1
  118. package/build/require/value/transform/encode.js +1 -1
  119. package/package.json +1 -1
  120. package/readme.md +115 -47
  121. package/build/import/type/extends/extends-mapped.d.mts +0 -17
  122. package/build/import/type/extends/extends-mapped.mjs +0 -21
  123. package/build/require/type/extends/extends-mapped.d.ts +0 -17
  124. package/build/require/type/extends/extends-mapped.js +0 -25
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Uncapitalize = void 0;
4
+ const intrinsic_1 = require("./intrinsic");
5
+ const type_1 = require("../clone/type");
6
+ function Uncapitalize(T, options = {}) {
7
+ return (0, type_1.CloneType)((0, intrinsic_1.Intrinsic)(T, 'Uncapitalize'), options);
8
+ }
9
+ exports.Uncapitalize = Uncapitalize;
@@ -0,0 +1,4 @@
1
+ import { TSchema, SchemaOptions } from '../schema/index';
2
+ import { TIntrinsic } from './intrinsic';
3
+ export type TUppercase<T extends TSchema> = TIntrinsic<T, 'Uppercase'>;
4
+ export declare function Uppercase<T extends TSchema>(T: T, options?: SchemaOptions): TUppercase<T>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Uppercase = void 0;
4
+ const intrinsic_1 = require("./intrinsic");
5
+ const type_1 = require("../clone/type");
6
+ function Uppercase(T, options = {}) {
7
+ return (0, type_1.CloneType)((0, intrinsic_1.Intrinsic)(T, 'Uppercase'), options);
8
+ }
9
+ exports.Uppercase = Uppercase;
@@ -1 +1,3 @@
1
+ export * from './mapped-key';
2
+ export * from './mapped-result';
1
3
  export * from './mapped';
@@ -14,4 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./mapped-key"), exports);
18
+ __exportStar(require("./mapped-result"), exports);
17
19
  __exportStar(require("./mapped"), exports);
@@ -0,0 +1,8 @@
1
+ import type { TSchema } from '../schema/index';
2
+ import { Kind } from '../symbols/index';
3
+ export interface TMappedKey<T extends PropertyKey[] = PropertyKey[]> extends TSchema {
4
+ [Kind]: 'MappedKey';
5
+ static: T[number];
6
+ keys: T;
7
+ }
8
+ export declare function MappedKey<T extends PropertyKey[]>(T: [...T]): TMappedKey<T>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MappedKey = void 0;
4
+ const index_1 = require("../symbols/index");
5
+ function MappedKey(T) {
6
+ return {
7
+ [index_1.Kind]: 'MappedKey',
8
+ keys: T
9
+ };
10
+ }
11
+ exports.MappedKey = MappedKey;
@@ -0,0 +1,9 @@
1
+ import type { TSchema } from '../schema/index';
2
+ import type { TProperties } from '../object/index';
3
+ import { Kind } from '../symbols/index';
4
+ export interface TMappedResult<T extends TProperties = TProperties> extends TSchema {
5
+ [Kind]: 'MappedResult';
6
+ properties: T;
7
+ static: unknown;
8
+ }
9
+ export declare function MappedResult<T extends TProperties>(properties: T): TMappedResult<T>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MappedResult = void 0;
4
+ const index_1 = require("../symbols/index");
5
+ function MappedResult(properties) {
6
+ return {
7
+ [index_1.Kind]: 'MappedResult',
8
+ properties
9
+ };
10
+ }
11
+ exports.MappedResult = MappedResult;
@@ -1,11 +1,10 @@
1
1
  import type { TSchema } from '../schema/index';
2
2
  import type { Ensure, Evaluate } from '../helpers/index';
3
- import { IndexedPropertyKeys } from '../indexed/index';
4
- import { Kind } from '../symbols/index';
5
3
  import { type TArray } from '../array/index';
6
4
  import { type TAsyncIterator } from '../async-iterator/index';
7
5
  import { type TConstructor } from '../constructor/index';
8
6
  import { type TFunction } from '../function/index';
7
+ import { type TIndexPropertyKeys } from '../indexed/index';
9
8
  import { type TIntersect } from '../intersect/index';
10
9
  import { type TIterator } from '../iterator/index';
11
10
  import { type TLiteral, type TLiteralValue } from '../literal/index';
@@ -14,37 +13,28 @@ import { type TObject, type TProperties, type ObjectOptions } from '../object/in
14
13
  import { type TOptional } from '../optional/index';
15
14
  import { type TPromise } from '../promise/index';
16
15
  import { type TReadonly } from '../readonly/index';
16
+ import { type TTuple } from '../tuple/index';
17
17
  import { type TUnion } from '../union/index';
18
- export interface TMappedKey<T extends PropertyKey[] = PropertyKey[]> extends TSchema {
19
- [Kind]: 'MappedKey';
20
- static: T[number];
21
- keys: T;
22
- }
23
- export declare function MappedKey<T extends PropertyKey[]>(T: [...T]): TMappedKey<T>;
24
- export type MappedFunction<K extends PropertyKey[], I = TMappedKey<K>> = (T: I) => TSchema;
25
- type FromMappedResult<K extends PropertyKey, P extends TProperties> = (K extends keyof P ? FromMappedPropertyKey<K, P[K]> : TNever);
18
+ import type { TMappedResult } from './mapped-result';
19
+ import type { TMappedKey } from './mapped-key';
20
+ type FromMappedResult<K extends PropertyKey, P extends TProperties> = (K extends keyof P ? FromSchemaType<K, P[K]> : TNever);
26
21
  declare function FromMappedResult<K extends PropertyKey, P extends TProperties>(K: K, P: P): FromMappedResult<K, P>;
27
22
  type FromMappedKey<K extends PropertyKey, _ extends PropertyKey[]> = (K extends TLiteralValue ? TLiteral<K> : TLiteral<'never'>);
28
23
  declare function FromMappedKey<K extends PropertyKey, P extends PropertyKey[]>(K: K, _: [...P]): TLiteral<TLiteralValue>;
29
- type FromRest<K extends PropertyKey, T extends TSchema[]> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [FromMappedPropertyKey<K, L>, ...FromRest<K, R>] : [];
24
+ type FromRest<K extends PropertyKey, T extends TSchema[]> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [FromSchemaType<K, L>, ...FromRest<K, R>] : [];
30
25
  declare function FromRest<K extends PropertyKey, T extends TSchema[]>(K: K, T: [...T]): FromRest<K, T>;
31
26
  type FromProperties<K extends PropertyKey, T extends TProperties, R extends TProperties = Evaluate<{
32
- [K2 in keyof T]: FromMappedPropertyKey<K, T[K2]>;
27
+ [K2 in keyof T]: FromSchemaType<K, T[K2]>;
33
28
  }>> = R;
34
29
  declare function FromProperties<K extends PropertyKey, T extends TProperties>(K: K, T: T): FromProperties<K, T>;
35
- export type FromMappedPropertyKey<K extends PropertyKey, T extends TSchema> = (T extends TReadonly<infer S> ? TReadonly<FromMappedPropertyKey<K, S>> : T extends TOptional<infer S> ? TOptional<FromMappedPropertyKey<K, S>> : T extends TMappedResult<infer P> ? FromMappedResult<K, P> : T extends TMappedKey<infer S> ? FromMappedKey<K, S> : T extends TConstructor<infer S extends TSchema[], infer R extends TSchema> ? TConstructor<FromRest<K, S>, FromMappedPropertyKey<K, R>> : T extends TFunction<infer S extends TSchema[], infer R extends TSchema> ? TFunction<FromRest<K, S>, FromMappedPropertyKey<K, R>> : T extends TAsyncIterator<infer S> ? TAsyncIterator<FromMappedPropertyKey<K, S>> : T extends TIterator<infer S> ? TIterator<FromMappedPropertyKey<K, S>> : T extends TIntersect<infer S> ? TIntersect<FromRest<K, S>> : T extends TUnion<infer S> ? TUnion<FromRest<K, S>> : T extends TObject<infer S> ? TObject<FromProperties<K, S>> : T extends TArray<infer S> ? TArray<FromMappedPropertyKey<K, S>> : T extends TPromise<infer S> ? TPromise<FromMappedPropertyKey<K, S>> : T);
36
- export declare function FromMappedPropertyKey<K extends PropertyKey, T extends TSchema>(K: K, T: T): FromMappedPropertyKey<K, T>;
37
- export type FromMappedPropertyKeys<K extends PropertyKey[], T extends TSchema> = (K extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? {
38
- [_ in L]: FromMappedPropertyKey<L, T>;
39
- } & FromMappedPropertyKeys<R, T> : {});
40
- export declare function FromMappedPropertyKeys<K extends PropertyKey[], T extends TSchema>(K: [...K], T: T): FromMappedPropertyKeys<K, T>;
41
- export interface TMappedResult<T extends TProperties = TProperties> extends TSchema {
42
- [Kind]: 'MappedResult';
43
- properties: T;
44
- static: unknown;
45
- }
46
- export declare function MappedResult<T extends TProperties>(properties: T): TMappedResult<T>;
47
- export type TMapped<K extends PropertyKey[], F extends MappedFunction<K>, R extends TProperties = Evaluate<FromMappedPropertyKeys<K, ReturnType<F>>>> = Ensure<TObject<R>>;
48
- export declare function Mapped<K extends TSchema, I extends PropertyKey[] = IndexedPropertyKeys<K>, F extends MappedFunction<I> = MappedFunction<I>, R extends TMapped<I, F> = TMapped<I, F>>(key: K, map: F, options?: ObjectOptions): R;
49
- export declare function Mapped<K extends PropertyKey[], F extends MappedFunction<K> = MappedFunction<K>, R extends TMapped<K, F> = TMapped<K, F>>(key: [...K], map: F, options?: ObjectOptions): R;
30
+ type FromSchemaType<K extends PropertyKey, T extends TSchema> = (T extends TReadonly<infer S> ? TReadonly<FromSchemaType<K, S>> : T extends TOptional<infer S> ? TOptional<FromSchemaType<K, S>> : T extends TMappedResult<infer P> ? FromMappedResult<K, P> : T extends TMappedKey<infer P> ? FromMappedKey<K, P> : T extends TConstructor<infer S extends TSchema[], infer R extends TSchema> ? TConstructor<FromRest<K, S>, FromSchemaType<K, R>> : T extends TFunction<infer S extends TSchema[], infer R extends TSchema> ? TFunction<FromRest<K, S>, FromSchemaType<K, R>> : T extends TAsyncIterator<infer S> ? TAsyncIterator<FromSchemaType<K, S>> : T extends TIterator<infer S> ? TIterator<FromSchemaType<K, S>> : T extends TIntersect<infer S> ? TIntersect<FromRest<K, S>> : T extends TUnion<infer S> ? TUnion<FromRest<K, S>> : T extends TTuple<infer S> ? TTuple<FromRest<K, S>> : T extends TObject<infer S> ? TObject<FromProperties<K, S>> : T extends TArray<infer S> ? TArray<FromSchemaType<K, S>> : T extends TPromise<infer S> ? TPromise<FromSchemaType<K, S>> : T);
31
+ declare function FromSchemaType<K extends PropertyKey, T extends TSchema>(K: K, T: T): FromSchemaType<K, T>;
32
+ type FromMappedFunctionReturnType<K extends PropertyKey[], T extends TSchema> = (K extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? {
33
+ [_ in L]: FromSchemaType<L, T>;
34
+ } & FromMappedFunctionReturnType<R, T> : {});
35
+ declare function FromMappedFunctionReturnType<K extends PropertyKey[], T extends TSchema>(K: [...K], T: T): FromMappedFunctionReturnType<K, T>;
36
+ export type TMappedFunction<K extends PropertyKey[], I = TMappedKey<K>> = (T: I) => TSchema;
37
+ export type TMapped<K extends PropertyKey[], F extends TMappedFunction<K>, R extends TProperties = Evaluate<FromMappedFunctionReturnType<K, ReturnType<F>>>> = Ensure<TObject<R>>;
38
+ export declare function Mapped<K extends TSchema, I extends PropertyKey[] = TIndexPropertyKeys<K>, F extends TMappedFunction<I> = TMappedFunction<I>, R extends TMapped<I, F> = TMapped<I, F>>(key: K, map: F, options?: ObjectOptions): R;
39
+ export declare function Mapped<K extends PropertyKey[], F extends TMappedFunction<K> = TMappedFunction<K>, R extends TMapped<K, F> = TMapped<K, F>>(key: [...K], map: F, options?: ObjectOptions): R;
50
40
  export {};
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Mapped = exports.MappedResult = exports.FromMappedPropertyKeys = exports.FromMappedPropertyKey = exports.MappedKey = void 0;
4
- const index_1 = require("../indexed/index");
3
+ exports.Mapped = void 0;
5
4
  const type_1 = require("../guard/type");
6
- const index_2 = require("../symbols/index");
5
+ const index_1 = require("../symbols/index");
7
6
  const type_2 = require("../clone/type");
8
- const index_3 = require("../discard/index");
9
- const index_4 = require("../array/index");
10
- const index_5 = require("../async-iterator/index");
11
- const index_6 = require("../constructor/index");
12
- const index_7 = require("../function/index");
7
+ const index_2 = require("../discard/index");
8
+ const index_3 = require("../array/index");
9
+ const index_4 = require("../async-iterator/index");
10
+ const index_5 = require("../constructor/index");
11
+ const index_6 = require("../function/index");
12
+ const index_7 = require("../indexed/index");
13
13
  const index_8 = require("../intersect/index");
14
14
  const index_9 = require("../iterator/index");
15
15
  const index_10 = require("../literal/index");
@@ -18,18 +18,12 @@ const index_12 = require("../object/index");
18
18
  const index_13 = require("../optional/index");
19
19
  const index_14 = require("../promise/index");
20
20
  const index_15 = require("../readonly/index");
21
- const index_16 = require("../union/index");
21
+ const index_16 = require("../tuple/index");
22
+ const index_17 = require("../union/index");
22
23
  const type_3 = require("../guard/type");
23
- function MappedKey(T) {
24
- return {
25
- [index_2.Kind]: 'MappedKey',
26
- keys: T
27
- };
28
- }
29
- exports.MappedKey = MappedKey;
30
24
  function FromMappedResult(K, P) {
31
25
  return (K in P
32
- ? FromMappedPropertyKey(K, P[K])
26
+ ? FromSchemaType(K, P[K])
33
27
  : (0, index_11.Never)());
34
28
  }
35
29
  function FromMappedKey(K, _) {
@@ -38,49 +32,41 @@ function FromMappedKey(K, _) {
38
32
  function FromRest(K, T) {
39
33
  const [L, ...R] = T;
40
34
  return (T.length > 0
41
- ? [FromMappedPropertyKey(K, L), ...FromRest(K, R)]
35
+ ? [FromSchemaType(K, L), ...FromRest(K, R)]
42
36
  : []);
43
37
  }
44
38
  function FromProperties(K, T) {
45
39
  return globalThis.Object.getOwnPropertyNames(T).reduce((Acc, K2) => {
46
- return { ...Acc, [K2]: FromMappedPropertyKey(K, T[K2]) };
40
+ return { ...Acc, [K2]: FromSchemaType(K, T[K2]) };
47
41
  }, {});
48
42
  }
49
- function FromMappedPropertyKey(K, T) {
50
- return ((0, type_3.TOptional)(T) ? (0, index_13.Optional)(FromMappedPropertyKey(K, (0, index_3.Discard)(T, [index_2.OptionalKind]))) :
51
- (0, type_3.TReadonly)(T) ? (0, index_15.Readonly)(FromMappedPropertyKey(K, (0, index_3.Discard)(T, [index_2.ReadonlyKind]))) :
43
+ function FromSchemaType(K, T) {
44
+ return ((0, type_3.TOptional)(T) ? (0, index_13.Optional)(FromSchemaType(K, (0, index_2.Discard)(T, [index_1.OptionalKind]))) :
45
+ (0, type_3.TReadonly)(T) ? (0, index_15.Readonly)(FromSchemaType(K, (0, index_2.Discard)(T, [index_1.ReadonlyKind]))) :
52
46
  (0, type_3.TMappedResult)(T) ? FromMappedResult(K, T.properties) :
53
47
  (0, type_3.TMappedKey)(T) ? FromMappedKey(K, T.keys) :
54
- (0, type_3.TConstructor)(T) ? (0, index_6.Constructor)(FromRest(K, T.parameters), FromMappedPropertyKey(K, T.returns)) :
55
- (0, type_3.TFunction)(T) ? (0, index_7.Function)(FromRest(K, T.parameters), FromMappedPropertyKey(K, T.returns)) :
56
- (0, type_3.TAsyncIterator)(T) ? (0, index_5.AsyncIterator)(FromMappedPropertyKey(K, T.items)) :
57
- (0, type_3.TIterator)(T) ? (0, index_9.Iterator)(FromMappedPropertyKey(K, T.items)) :
48
+ (0, type_3.TConstructor)(T) ? (0, index_5.Constructor)(FromRest(K, T.parameters), FromSchemaType(K, T.returns)) :
49
+ (0, type_3.TFunction)(T) ? (0, index_6.Function)(FromRest(K, T.parameters), FromSchemaType(K, T.returns)) :
50
+ (0, type_3.TAsyncIterator)(T) ? (0, index_4.AsyncIterator)(FromSchemaType(K, T.items)) :
51
+ (0, type_3.TIterator)(T) ? (0, index_9.Iterator)(FromSchemaType(K, T.items)) :
58
52
  (0, type_3.TIntersect)(T) ? (0, index_8.Intersect)(FromRest(K, T.allOf)) :
59
- (0, type_3.TUnion)(T) ? (0, index_16.Union)(FromRest(K, T.anyOf)) :
60
- (0, type_3.TObject)(T) ? (0, index_12.Object)(FromProperties(K, T.properties)) :
61
- (0, type_3.TArray)(T) ? (0, index_4.Array)(FromMappedPropertyKey(K, T.items)) :
62
- (0, type_3.TPromise)(T) ? (0, index_14.Promise)(FromMappedPropertyKey(K, T.item)) :
63
- T);
53
+ (0, type_3.TUnion)(T) ? (0, index_17.Union)(FromRest(K, T.anyOf)) :
54
+ (0, type_3.TTuple)(T) ? (0, index_16.Tuple)(FromRest(K, T.items ?? [])) :
55
+ (0, type_3.TObject)(T) ? (0, index_12.Object)(FromProperties(K, T.properties)) :
56
+ (0, type_3.TArray)(T) ? (0, index_3.Array)(FromSchemaType(K, T.items)) :
57
+ (0, type_3.TPromise)(T) ? (0, index_14.Promise)(FromSchemaType(K, T.item)) :
58
+ T);
64
59
  }
65
- exports.FromMappedPropertyKey = FromMappedPropertyKey;
66
- function FromMappedPropertyKeys(K, T) {
60
+ function FromMappedFunctionReturnType(K, T) {
67
61
  const [L, ...R] = K;
68
62
  return (K.length > 0
69
- ? { [L]: FromMappedPropertyKey(L, T), ...FromMappedPropertyKeys(R, T) }
63
+ ? { [L]: FromSchemaType(L, T), ...FromMappedFunctionReturnType(R, T) }
70
64
  : {});
71
65
  }
72
- exports.FromMappedPropertyKeys = FromMappedPropertyKeys;
73
- function MappedResult(properties) {
74
- return {
75
- [index_2.Kind]: 'MappedResult',
76
- properties
77
- };
78
- }
79
- exports.MappedResult = MappedResult;
80
66
  function Mapped(key, map, options = {}) {
81
- const K = (0, type_1.TSchema)(key) ? (0, index_1.IndexedPropertyKeys)(key) : key;
82
- const RT = map({ [index_2.Kind]: 'MappedKey', keys: K });
83
- const R = FromMappedPropertyKeys(K, RT);
67
+ const K = (0, type_1.TSchema)(key) ? (0, index_7.IndexPropertyKeys)(key) : key;
68
+ const RT = map({ [index_1.Kind]: 'MappedKey', keys: K });
69
+ const R = FromMappedFunctionReturnType(K, RT);
84
70
  return (0, type_2.CloneType)((0, index_12.Object)(R), options);
85
71
  }
86
72
  exports.Mapped = Mapped;
@@ -1 +1,2 @@
1
+ export * from './omit-mapped-result';
1
2
  export * from './omit';
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./omit-mapped-result"), exports);
17
18
  __exportStar(require("./omit"), exports);
@@ -0,0 +1,15 @@
1
+ import type { TSchema } from '../schema/index';
2
+ import type { TProperties } from '../object/index';
3
+ import { type TMappedResult, type TMappedKey } from '../mapped/index';
4
+ import { type TOmit } from './omit';
5
+ type MappedOmitPropertyKey<T extends TSchema, K extends PropertyKey> = {
6
+ [_ in K]: TOmit<T, [K]>;
7
+ };
8
+ declare function MappedOmitPropertyKey<T extends TSchema, K extends PropertyKey>(T: T, K: K): MappedOmitPropertyKey<T, K>;
9
+ type MappedOmitPropertyKeys<T extends TSchema, K extends PropertyKey[]> = (K extends [infer LK extends PropertyKey, ...infer RK extends PropertyKey[]] ? MappedOmitPropertyKey<T, LK> & MappedOmitPropertyKeys<T, RK> : {});
10
+ declare function MappedOmitPropertyKeys<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K]): MappedOmitPropertyKeys<T, K>;
11
+ type MappedOmitProperties<T extends TSchema, K extends TMappedKey> = (MappedOmitPropertyKeys<T, K['keys']>);
12
+ declare function MappedOmitProperties<T extends TSchema, K extends TMappedKey>(T: T, K: K): MappedOmitProperties<T, K>;
13
+ export type TOmitMappedResult<T extends TSchema, K extends TMappedKey, P extends TProperties = MappedOmitProperties<T, K>> = (TMappedResult<P>);
14
+ export declare function OmitMappedResult<T extends TSchema, K extends TMappedKey, P extends TProperties = MappedOmitProperties<T, K>>(T: T, K: K): TMappedResult<P>;
15
+ export {};
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OmitMappedResult = void 0;
4
+ const index_1 = require("../mapped/index");
5
+ const omit_1 = require("./omit");
6
+ function MappedOmitPropertyKey(T, K) {
7
+ return {
8
+ [K]: (0, omit_1.Omit)(T, [K])
9
+ };
10
+ }
11
+ function MappedOmitPropertyKeys(T, K) {
12
+ const [LK, ...RK] = K;
13
+ return (K.length > 0
14
+ ? { ...MappedOmitPropertyKey(T, LK), ...MappedOmitPropertyKeys(T, RK) }
15
+ : {});
16
+ }
17
+ function MappedOmitProperties(T, K) {
18
+ return MappedOmitPropertyKeys(T, K.keys);
19
+ }
20
+ function OmitMappedResult(T, K) {
21
+ const P = MappedOmitProperties(T, K);
22
+ return (0, index_1.MappedResult)(P);
23
+ }
24
+ exports.OmitMappedResult = OmitMappedResult;
@@ -4,7 +4,9 @@ import { type TRecursive } from '../recursive/index';
4
4
  import { type TIntersect } from '../intersect/index';
5
5
  import { type TUnion } from '../union/index';
6
6
  import { type TObject, type TProperties } from '../object/index';
7
- import { IndexedPropertyKeys } from '../indexed/index';
7
+ import { type TIndexPropertyKeys } from '../indexed/index';
8
+ import { TMappedKey } from '../mapped/index';
9
+ import { type TOmitMappedResult } from './omit-mapped-result';
8
10
  type FromIntersect<T extends TSchema[], K extends PropertyKey[]> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [OmitResolve<L, K>, ...FromIntersect<R, K>] : [];
9
11
  declare function FromIntersect<T extends TSchema[], K extends PropertyKey[]>(T: T, K: K): FromIntersect<T, K>;
10
12
  type FromUnion<T extends TSchema[], K extends PropertyKey[]> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [OmitResolve<L, K>, ...FromUnion<R, K>] : [];
@@ -14,6 +16,7 @@ declare function FromProperties<T extends TProperties, K extends PropertyKey[]>(
14
16
  export type OmitResolve<T extends TProperties, K extends PropertyKey[]> = T extends TRecursive<infer S> ? TRecursive<OmitResolve<S, K>> : T extends TIntersect<infer S> ? TIntersect<FromIntersect<S, K>> : T extends TUnion<infer S> ? TUnion<FromUnion<S, K>> : T extends TObject<infer S> ? TObject<FromProperties<S, K>> : TObject<{}>;
15
17
  export declare function OmitResolve<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K]): OmitResolve<T, K>;
16
18
  export type TOmit<T extends TSchema, K extends PropertyKey[]> = OmitResolve<T, K>;
17
- export declare function Omit<T extends TSchema, K extends TSchema, I extends PropertyKey[] = IndexedPropertyKeys<K>>(T: T, K: K, options?: SchemaOptions): TOmit<T, I>;
19
+ export declare function Omit<T extends TSchema, K extends TMappedKey>(T: T, K: K): TOmitMappedResult<T, K>;
20
+ export declare function Omit<T extends TSchema, K extends TSchema, I extends PropertyKey[] = TIndexPropertyKeys<K>>(T: T, K: K, options?: SchemaOptions): TOmit<T, I>;
18
21
  export declare function Omit<T extends TSchema, K extends PropertyKey[]>(T: T, K: readonly [...K], options?: SchemaOptions): TOmit<T, K>;
19
22
  export {};
@@ -8,6 +8,7 @@ const index_4 = require("../indexed/index");
8
8
  const index_5 = require("../discard/index");
9
9
  const index_6 = require("../symbols/index");
10
10
  const type_1 = require("../clone/type");
11
+ const omit_mapped_result_1 = require("./omit-mapped-result");
11
12
  const type_2 = require("../guard/type");
12
13
  function FromIntersect(T, K) {
13
14
  return T.map((T) => OmitResolve(T, K));
@@ -32,9 +33,14 @@ function OmitResolve(T, K) {
32
33
  }
33
34
  exports.OmitResolve = OmitResolve;
34
35
  function Omit(T, K, options = {}) {
35
- const I = (0, type_2.TSchema)(K) ? (0, index_4.IndexedPropertyKeys)(K) : K;
36
- const D = (0, index_5.Discard)(T, [index_6.TransformKind, '$id', 'required']);
37
- const R = (0, type_1.CloneType)(OmitResolve(T, I), options);
38
- return { ...D, ...R };
36
+ if ((0, type_2.TMappedKey)(K)) {
37
+ return (0, omit_mapped_result_1.OmitMappedResult)(T, K);
38
+ }
39
+ else {
40
+ const I = (0, type_2.TSchema)(K) ? (0, index_4.IndexPropertyKeys)(K) : K;
41
+ const D = (0, index_5.Discard)(T, [index_6.TransformKind, '$id', 'required']);
42
+ const R = (0, type_1.CloneType)(OmitResolve(T, I), options);
43
+ return { ...D, ...R };
44
+ }
39
45
  }
40
46
  exports.Omit = Omit;
@@ -1 +1,2 @@
1
+ export * from './pick-mapped-result';
1
2
  export * from './pick';
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./pick-mapped-result"), exports);
17
18
  __exportStar(require("./pick"), exports);
@@ -0,0 +1,15 @@
1
+ import type { TSchema } from '../schema/index';
2
+ import type { TProperties } from '../object/index';
3
+ import { type TMappedResult, type TMappedKey } from '../mapped/index';
4
+ import { type TPick } from './pick';
5
+ type MappedPickPropertyKey<T extends TSchema, K extends PropertyKey> = {
6
+ [_ in K]: TPick<T, [K]>;
7
+ };
8
+ declare function MappedPickPropertyKey<T extends TSchema, K extends PropertyKey>(T: T, K: K): MappedPickPropertyKey<T, K>;
9
+ type MappedPickPropertyKeys<T extends TSchema, K extends PropertyKey[]> = (K extends [infer LK extends PropertyKey, ...infer RK extends PropertyKey[]] ? MappedPickPropertyKey<T, LK> & MappedPickPropertyKeys<T, RK> : {});
10
+ declare function MappedPickPropertyKeys<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K]): MappedPickPropertyKeys<T, K>;
11
+ type MappedPickProperties<T extends TSchema, K extends TMappedKey> = (MappedPickPropertyKeys<T, K['keys']>);
12
+ declare function MappedPickProperties<T extends TSchema, K extends TMappedKey>(T: T, K: K): MappedPickProperties<T, K>;
13
+ export type TPickMappedResult<T extends TSchema, K extends TMappedKey, P extends TProperties = MappedPickProperties<T, K>> = (TMappedResult<P>);
14
+ export declare function PickMappedResult<T extends TSchema, K extends TMappedKey, P extends TProperties = MappedPickProperties<T, K>>(T: T, K: K): TMappedResult<P>;
15
+ export {};
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PickMappedResult = void 0;
4
+ const index_1 = require("../mapped/index");
5
+ const pick_1 = require("./pick");
6
+ function MappedPickPropertyKey(T, K) {
7
+ return {
8
+ [K]: (0, pick_1.Pick)(T, [K])
9
+ };
10
+ }
11
+ function MappedPickPropertyKeys(T, K) {
12
+ const [LK, ...RK] = K;
13
+ return (K.length > 0
14
+ ? { ...MappedPickPropertyKey(T, LK), ...MappedPickPropertyKeys(T, RK) }
15
+ : {});
16
+ }
17
+ function MappedPickProperties(T, K) {
18
+ return MappedPickPropertyKeys(T, K.keys);
19
+ }
20
+ function PickMappedResult(T, K) {
21
+ const P = MappedPickProperties(T, K);
22
+ return (0, index_1.MappedResult)(P);
23
+ }
24
+ exports.PickMappedResult = PickMappedResult;
@@ -4,7 +4,9 @@ import { type TRecursive } from '../recursive/index';
4
4
  import { type TIntersect } from '../intersect/index';
5
5
  import { type TUnion } from '../union/index';
6
6
  import { type TObject, type TProperties } from '../object/index';
7
- import { IndexedPropertyKeys } from '../indexed/index';
7
+ import { type TIndexPropertyKeys } from '../indexed/index';
8
+ import { TMappedKey } from '../mapped/index';
9
+ import { type TPickMappedResult } from './pick-mapped-result';
8
10
  type FromIntersect<T extends TSchema[], K extends PropertyKey[]> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [PickResolve<L, K>, ...FromIntersect<R, K>] : [];
9
11
  declare function FromIntersect<T extends TSchema[], K extends PropertyKey[]>(T: T, K: K): FromIntersect<T, K>;
10
12
  type FromUnion<T extends TSchema[], K extends PropertyKey[]> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [PickResolve<L, K>, ...FromUnion<R, K>] : [];
@@ -14,6 +16,7 @@ declare function FromProperties<T extends TProperties, K extends PropertyKey[]>(
14
16
  export type PickResolve<T extends TProperties, K extends PropertyKey[]> = T extends TRecursive<infer S> ? TRecursive<PickResolve<S, K>> : T extends TIntersect<infer S> ? TIntersect<FromIntersect<S, K>> : T extends TUnion<infer S> ? TUnion<FromUnion<S, K>> : T extends TObject<infer S> ? TObject<FromProperties<S, K>> : TObject<{}>;
15
17
  export declare function PickResolve<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K]): PickResolve<T, K>;
16
18
  export type TPick<T extends TSchema, K extends PropertyKey[]> = PickResolve<T, K>;
17
- export declare function Pick<T extends TSchema, K extends TSchema, I extends PropertyKey[] = IndexedPropertyKeys<K>>(T: T, K: K, options?: SchemaOptions): TPick<T, I>;
19
+ export declare function Pick<T extends TSchema, K extends TMappedKey>(T: T, K: K): TPickMappedResult<T, K>;
20
+ export declare function Pick<T extends TSchema, K extends TSchema, I extends PropertyKey[] = TIndexPropertyKeys<K>>(T: T, K: K, options?: SchemaOptions): TPick<T, I>;
18
21
  export declare function Pick<T extends TSchema, K extends PropertyKey[]>(T: T, K: readonly [...K], options?: SchemaOptions): TPick<T, K>;
19
22
  export {};
@@ -8,6 +8,7 @@ const index_4 = require("../indexed/index");
8
8
  const index_5 = require("../discard/index");
9
9
  const index_6 = require("../symbols/index");
10
10
  const type_1 = require("../clone/type");
11
+ const pick_mapped_result_1 = require("./pick-mapped-result");
11
12
  const type_2 = require("../guard/type");
12
13
  function FromIntersect(T, K) {
13
14
  return T.map((T) => PickResolve(T, K));
@@ -28,9 +29,14 @@ function PickResolve(T, K) {
28
29
  }
29
30
  exports.PickResolve = PickResolve;
30
31
  function Pick(T, K, options = {}) {
31
- const I = (0, type_2.TSchema)(K) ? (0, index_4.IndexedPropertyKeys)(K) : K;
32
- const D = (0, index_5.Discard)(T, [index_6.TransformKind, '$id', 'required']);
33
- const R = (0, type_1.CloneType)(PickResolve(T, I), options);
34
- return { ...D, ...R };
32
+ if ((0, type_2.TMappedKey)(K)) {
33
+ return (0, pick_mapped_result_1.PickMappedResult)(T, K);
34
+ }
35
+ else {
36
+ const I = (0, type_2.TSchema)(K) ? (0, index_4.IndexPropertyKeys)(K) : K;
37
+ const D = (0, index_5.Discard)(T, [index_6.TransformKind, '$id', 'required']);
38
+ const R = (0, type_1.CloneType)(PickResolve(T, I), options);
39
+ return { ...D, ...R };
40
+ }
35
41
  }
36
42
  exports.Pick = Pick;
@@ -21,11 +21,11 @@ function FromKeys(keys, T) {
21
21
  function FromTemplateLiteralKey(K, T) {
22
22
  const expression = (0, index_4.TemplateLiteralParseExact)(K.pattern);
23
23
  return ((0, index_4.IsTemplateLiteralFinite)(expression)
24
- ? FromKeys((0, index_6.IndexedPropertyKeys)(K), T)
24
+ ? FromKeys((0, index_6.IndexPropertyKeys)(K), T)
25
25
  : FromPattern(K.pattern, T));
26
26
  }
27
27
  function FromUnionKey(K, T) {
28
- return FromKeys((0, index_6.IndexedPropertyKeys)((0, index_3.Union)(K)), T);
28
+ return FromKeys((0, index_6.IndexPropertyKeys)((0, index_3.Union)(K)), T);
29
29
  }
30
30
  function FromLiteralKey(K, T) {
31
31
  return FromKeys([K.toString()], T);
@@ -6,25 +6,25 @@ import { type TConst } from '../const/index';
6
6
  import { type TDeref } from '../deref/index';
7
7
  import { type TEnum, type TEnumKey, type TEnumValue } from '../enum/index';
8
8
  import { type TExclude } from '../exclude/index';
9
- import { type TExtends, type MappedExtends, type MappedResultExtends } from '../extends/index';
9
+ import { type TExtends, type TExtendsMappedResult, type TExtendsMappedResultFromResult } from '../extends/index';
10
10
  import { type TExtract } from '../extract/index';
11
- import { TIndex, type IndexedPropertyKeys, type TMappedIndex } from '../indexed/index';
11
+ import { TIndex, type TIndexPropertyKeys, type TIndexMappedResult } from '../indexed/index';
12
12
  import { type IntegerOptions, type TInteger } from '../integer/index';
13
13
  import { type IntersectOptions, type IntersectResolve } from '../intersect/index';
14
14
  import { type TCapitalize, type TUncapitalize, type TLowercase, type TUppercase } from '../intrinsic/index';
15
15
  import { type TKeyOf } from '../keyof/index';
16
16
  import { type TLiteral, type TLiteralValue } from '../literal/index';
17
- import { type MappedFunction, type TMapped, type TMappedResult } from '../mapped/index';
17
+ import { type TMappedFunction, type TMapped, type TMappedResult } from '../mapped/index';
18
18
  import { type TNever } from '../never/index';
19
19
  import { type TNot } from '../not/index';
20
20
  import { type TNull } from '../null/index';
21
21
  import { type TMappedKey } from '../mapped/index';
22
22
  import { type TNumber, type NumberOptions } from '../number/index';
23
23
  import { type TObject, type TProperties, type ObjectOptions } from '../object/index';
24
- import { type TOmit } from '../omit/index';
24
+ import { type TOmit, type TOmitMappedResult } from '../omit/index';
25
25
  import { type TOptional } from '../optional/index';
26
26
  import { type TPartial } from '../partial/index';
27
- import { type TPick } from '../pick/index';
27
+ import { type TPick, type TPickMappedResult } from '../pick/index';
28
28
  import { type TReadonly } from '../readonly/index';
29
29
  import { type TReadonlyOptional } from '../readonly-optional/index';
30
30
  import { type RecordResolve } from '../record/index';
@@ -53,30 +53,32 @@ export declare class JsonTypeBuilder {
53
53
  Const<T>(value: T, options?: SchemaOptions): TConst<T>;
54
54
  Deref<T extends TSchema>(schema: T, references: TSchema[]): TDeref<T>;
55
55
  Enum<V extends TEnumValue, T extends Record<TEnumKey, V>>(item: T, options?: SchemaOptions): TEnum<T>;
56
- Extends<L extends TMappedResult, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): MappedResultExtends<L, R, T, F>;
57
- Extends<L extends TMappedKey, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): MappedExtends<L, R, T, F>;
56
+ Extends<L extends TMappedResult, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsMappedResultFromResult<L, R, T, F>;
57
+ Extends<L extends TMappedKey, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsMappedResult<L, R, T, F>;
58
58
  Extends<L extends TSchema, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtends<L, R, T, F>;
59
59
  Exclude<L extends TSchema, R extends TSchema>(unionType: L, excludedMembers: R, options?: SchemaOptions): TExclude<L, R>;
60
60
  Extract<L extends TSchema, R extends TSchema>(type: L, union: R, options?: SchemaOptions): TExtract<L, R>;
61
- Index<T extends TSchema, K extends TMappedKey>(T: T, K: K): TMappedIndex<T, K>;
62
- Index<T extends TSchema, K extends TSchema, I extends PropertyKey[] = IndexedPropertyKeys<K>>(T: T, K: K, options?: SchemaOptions): TIndex<T, I>;
61
+ Index<T extends TSchema, K extends TMappedKey>(T: T, K: K): TIndexMappedResult<T, K>;
62
+ Index<T extends TSchema, K extends TSchema, I extends PropertyKey[] = TIndexPropertyKeys<K>>(T: T, K: K, options?: SchemaOptions): TIndex<T, I>;
63
63
  Index<T extends TSchema, K extends PropertyKey[]>(T: T, K: readonly [...K], options?: SchemaOptions): TIndex<T, K>;
64
64
  Integer(options?: IntegerOptions): TInteger;
65
65
  Intersect<T extends TSchema[]>(T: [...T], options?: IntersectOptions): IntersectResolve<T>;
66
66
  KeyOf<T extends TSchema>(schema: T, options?: SchemaOptions): TKeyOf<T>;
67
67
  Literal<T extends TLiteralValue>(value: T, options?: SchemaOptions): TLiteral<T>;
68
68
  Lowercase<T extends TSchema>(schema: T, options?: SchemaOptions): TLowercase<T>;
69
- Mapped<K extends TSchema, I extends PropertyKey[] = IndexedPropertyKeys<K>, F extends MappedFunction<I> = MappedFunction<I>, R extends TMapped<I, F> = TMapped<I, F>>(key: K, map: F, options?: ObjectOptions): R;
70
- Mapped<K extends PropertyKey[], F extends MappedFunction<K> = MappedFunction<K>, R extends TMapped<K, F> = TMapped<K, F>>(key: [...K], map: F, options?: ObjectOptions): R;
69
+ Mapped<K extends TSchema, I extends PropertyKey[] = TIndexPropertyKeys<K>, F extends TMappedFunction<I> = TMappedFunction<I>, R extends TMapped<I, F> = TMapped<I, F>>(key: K, map: F, options?: ObjectOptions): R;
70
+ Mapped<K extends PropertyKey[], F extends TMappedFunction<K> = TMappedFunction<K>, R extends TMapped<K, F> = TMapped<K, F>>(key: [...K], map: F, options?: ObjectOptions): R;
71
71
  Never(options?: SchemaOptions): TNever;
72
72
  Not<T extends TSchema>(schema: T, options?: SchemaOptions): TNot<T>;
73
73
  Null(options?: SchemaOptions): TNull;
74
74
  Number(options?: NumberOptions): TNumber;
75
75
  Object<T extends TProperties>(properties: T, options?: ObjectOptions): TObject<T>;
76
- Omit<T extends TSchema, K extends TSchema, I extends PropertyKey[] = IndexedPropertyKeys<K>>(T: T, K: K, options?: SchemaOptions): TOmit<T, I>;
76
+ Omit<T extends TSchema, K extends TMappedKey>(T: T, K: K): TOmitMappedResult<T, K>;
77
+ Omit<T extends TSchema, K extends TSchema, I extends PropertyKey[] = TIndexPropertyKeys<K>>(T: T, K: K, options?: SchemaOptions): TOmit<T, I>;
77
78
  Omit<T extends TSchema, K extends PropertyKey[]>(T: T, K: readonly [...K], options?: SchemaOptions): TOmit<T, K>;
78
79
  Partial<T extends TSchema>(schema: T, options?: ObjectOptions): TPartial<T>;
79
- Pick<T extends TSchema, K extends TSchema, I extends PropertyKey[] = IndexedPropertyKeys<K>>(T: T, K: K, options?: SchemaOptions): TPick<T, I>;
80
+ Pick<T extends TSchema, K extends TMappedKey>(T: T, K: K): TPickMappedResult<T, K>;
81
+ Pick<T extends TSchema, K extends TSchema, I extends PropertyKey[] = TIndexPropertyKeys<K>>(T: T, K: K, options?: SchemaOptions): TPick<T, I>;
80
82
  Pick<T extends TSchema, K extends PropertyKey[]>(T: T, K: readonly [...K], options?: SchemaOptions): TPick<T, K>;
81
83
  Record<K extends TSchema, T extends TSchema>(key: K, schema: T, options?: ObjectOptions): RecordResolve<K, T>;
82
84
  Recursive<T extends TSchema>(callback: (thisType: TThis) => T, options?: SchemaOptions): TRecursive<T>;
@@ -44,7 +44,7 @@ function TIntersect(schema, references, value) {
44
44
  const knownKeys = (0, index_3.KeyOfPropertyKeys)(schema);
45
45
  const knownProperties = knownKeys.reduce((value, key) => {
46
46
  return (key in value)
47
- ? { ...value, [key]: Visit((0, index_4.IndexedType)(schema, [key]), references, value[key]) }
47
+ ? { ...value, [key]: Visit((0, index_4.Index)(schema, [key]), references, value[key]) }
48
48
  : value;
49
49
  }, value);
50
50
  if (!(0, type_1.TTransform)(schema.unevaluatedProperties)) {
@@ -46,7 +46,7 @@ function TIntersect(schema, references, value) {
46
46
  const knownKeys = (0, index_3.KeyOfPropertyKeys)(schema);
47
47
  const knownProperties = knownKeys.reduce((value, key) => {
48
48
  return key in defaulted
49
- ? { ...value, [key]: Visit((0, index_4.IndexedType)(schema, [key]), references, value[key]) }
49
+ ? { ...value, [key]: Visit((0, index_4.Index)(schema, [key]), references, value[key]) }
50
50
  : value;
51
51
  }, defaulted);
52
52
  if (!(0, type_1.TTransform)(schema.unevaluatedProperties)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinclair/typebox",
3
- "version": "0.32.0-dev-12",
3
+ "version": "0.32.0-dev-13",
4
4
  "description": "Json Schema Type Builder with Static Type Resolution for TypeScript",
5
5
  "keywords": [
6
6
  "typescript",