@sinclair/typebox 0.32.0-dev-14 → 0.32.0-dev-16
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.
- package/build/import/index.d.mts +12 -12
- package/build/import/index.mjs +5 -5
- package/build/import/type/array/array.d.mts +1 -1
- package/build/import/type/constructor/constructor.d.mts +4 -4
- package/build/import/type/exclude/exclude-from-mapped-result.d.mts +13 -0
- package/build/import/type/exclude/exclude-from-mapped-result.mjs +14 -0
- package/build/import/type/exclude/exclude.d.mts +7 -4
- package/build/import/type/exclude/exclude.mjs +10 -4
- package/build/import/type/exclude/index.d.mts +1 -0
- package/build/import/type/exclude/index.mjs +1 -0
- package/build/import/type/extends/extends-from-mapped-key.d.mts +17 -0
- package/build/import/type/extends/extends-from-mapped-key.mjs +21 -0
- package/build/import/type/extends/extends-from-mapped-result.d.mts +13 -0
- package/build/import/type/extends/extends-from-mapped-result.mjs +14 -0
- package/build/import/type/extends/extends.d.mts +4 -4
- package/build/import/type/extends/extends.mjs +5 -5
- package/build/import/type/extends/index.d.mts +2 -2
- package/build/import/type/extends/index.mjs +2 -2
- package/build/import/type/extract/extract-from-mapped-result.d.mts +13 -0
- package/build/import/type/extract/extract-from-mapped-result.mjs +14 -0
- package/build/import/type/extract/extract.d.mts +6 -3
- package/build/import/type/extract/extract.mjs +9 -3
- package/build/import/type/extract/index.d.mts +1 -0
- package/build/import/type/extract/index.mjs +1 -0
- package/build/import/type/function/function.d.mts +4 -4
- package/build/import/type/indexed/index.d.mts +1 -1
- package/build/import/type/indexed/index.mjs +1 -1
- package/build/import/type/indexed/{indexed-mapped-result.d.mts → indexed-from-mapped-key.d.mts} +6 -6
- package/build/import/type/indexed/indexed-from-mapped-key.mjs +18 -0
- package/build/import/type/indexed/indexed-result.d.mts +8 -8
- package/build/import/type/indexed/indexed-result.mjs +9 -8
- package/build/import/type/indexed/indexed.d.mts +2 -2
- package/build/import/type/indexed/indexed.mjs +5 -5
- package/build/import/type/intersect/index.d.mts +2 -0
- package/build/import/type/intersect/index.mjs +2 -0
- package/build/import/type/intersect/intersect-create.d.mts +3 -0
- package/build/import/type/intersect/intersect-create.mjs +12 -0
- package/build/import/type/intersect/intersect-evaluated.d.mts +16 -0
- package/build/import/type/intersect/intersect-evaluated.mjs +35 -0
- package/build/import/type/intersect/intersect-type.d.mts +15 -0
- package/build/import/type/intersect/intersect-type.mjs +1 -0
- package/build/import/type/intersect/intersect.d.mts +4 -20
- package/build/import/type/intersect/intersect.mjs +5 -17
- package/build/import/type/intrinsic/capitalize.mjs +1 -2
- package/build/import/type/intrinsic/index.d.mts +1 -1
- package/build/import/type/intrinsic/index.mjs +1 -1
- package/build/import/type/intrinsic/{intrinsic-mapped-result.d.mts → intrinsic-from-mapped-key.d.mts} +6 -5
- package/build/import/type/intrinsic/intrinsic-from-mapped-key.mjs +21 -0
- package/build/import/type/intrinsic/intrinsic.d.mts +6 -6
- package/build/import/type/intrinsic/intrinsic.mjs +8 -8
- package/build/import/type/intrinsic/lowercase.mjs +1 -2
- package/build/import/type/intrinsic/uncapitalize.mjs +1 -2
- package/build/import/type/intrinsic/uppercase.mjs +1 -2
- package/build/import/type/keyof/index.d.mts +1 -0
- package/build/import/type/keyof/index.mjs +1 -0
- package/build/import/type/keyof/keyof-from-mapped-result.d.mts +13 -0
- package/build/import/type/keyof/keyof-from-mapped-result.mjs +14 -0
- package/build/import/type/keyof/keyof.d.mts +5 -2
- package/build/import/type/keyof/keyof.mjs +10 -3
- package/build/import/type/mapped/mapped.mjs +1 -2
- package/build/import/type/object/object.d.mts +5 -5
- package/build/import/type/omit/index.d.mts +1 -1
- package/build/import/type/omit/index.mjs +1 -1
- package/build/import/type/omit/omit-from-mapped-key.d.mts +15 -0
- package/build/import/type/omit/omit-from-mapped-key.mjs +20 -0
- package/build/import/type/omit/omit.d.mts +2 -2
- package/build/import/type/omit/omit.mjs +2 -2
- package/build/import/type/partial/index.d.mts +1 -0
- package/build/import/type/partial/index.mjs +1 -0
- package/build/import/type/partial/partial-from-mapped-result.d.mts +13 -0
- package/build/import/type/partial/partial-from-mapped-result.mjs +14 -0
- package/build/import/type/partial/partial.d.mts +5 -2
- package/build/import/type/partial/partial.mjs +11 -5
- package/build/import/type/pick/index.d.mts +1 -1
- package/build/import/type/pick/index.mjs +1 -1
- package/build/import/type/pick/pick-from-mapped-key.d.mts +15 -0
- package/build/import/type/pick/pick-from-mapped-key.mjs +20 -0
- package/build/import/type/pick/pick.d.mts +2 -2
- package/build/import/type/pick/pick.mjs +2 -2
- package/build/import/type/record/record.d.mts +0 -1
- package/build/import/type/record/record.mjs +1 -1
- package/build/import/type/recursive/recursive.d.mts +3 -2
- package/build/import/type/recursive/recursive.mjs +1 -5
- package/build/import/type/required/index.d.mts +1 -0
- package/build/import/type/required/index.mjs +1 -0
- package/build/import/type/required/required-from-mapped-result.d.mts +13 -0
- package/build/import/type/required/required-from-mapped-result.mjs +14 -0
- package/build/import/type/required/required.d.mts +5 -2
- package/build/import/type/required/required.mjs +11 -5
- package/build/import/type/template-literal/syntax.d.mts +4 -4
- package/build/import/type/template-literal/template-literal.d.mts +4 -4
- package/build/import/type/transform/transform.d.mts +3 -2
- package/build/import/type/transform/transform.mjs +1 -1
- package/build/import/type/tuple/tuple.d.mts +3 -3
- package/build/import/type/type/json.d.mts +25 -20
- package/build/import/type/type/json.mjs +3 -3
- package/build/import/type/union/index.d.mts +2 -0
- package/build/import/type/union/index.mjs +2 -0
- package/build/import/type/union/union-create.d.mts +3 -0
- package/build/import/type/union/union-create.mjs +5 -0
- package/build/import/type/union/union-evaluated.d.mts +16 -0
- package/build/import/type/union/union-evaluated.mjs +31 -0
- package/build/import/type/union/union-type.d.mts +12 -0
- package/build/import/type/union/union-type.mjs +1 -0
- package/build/import/type/union/union.d.mts +3 -13
- package/build/import/type/union/union.mjs +3 -10
- package/build/import/value/delta/delta.d.mts +1 -1
- package/build/require/index.d.ts +12 -12
- package/build/require/index.js +8 -3
- package/build/require/type/array/array.d.ts +1 -1
- package/build/require/type/constructor/constructor.d.ts +4 -4
- package/build/require/type/exclude/exclude-from-mapped-result.d.ts +13 -0
- package/build/require/type/exclude/exclude-from-mapped-result.js +18 -0
- package/build/require/type/exclude/exclude.d.ts +7 -4
- package/build/require/type/exclude/exclude.js +9 -4
- package/build/require/type/exclude/index.d.ts +1 -0
- package/build/require/type/exclude/index.js +1 -0
- package/build/require/type/extends/extends-from-mapped-key.d.ts +17 -0
- package/build/require/type/extends/extends-from-mapped-key.js +25 -0
- package/build/require/type/extends/extends-from-mapped-result.d.ts +13 -0
- package/build/require/type/extends/extends-from-mapped-result.js +18 -0
- package/build/require/type/extends/extends.d.ts +4 -4
- package/build/require/type/extends/extends.js +7 -7
- package/build/require/type/extends/index.d.ts +2 -2
- package/build/require/type/extends/index.js +2 -2
- package/build/require/type/extract/extract-from-mapped-result.d.ts +13 -0
- package/build/require/type/extract/extract-from-mapped-result.js +18 -0
- package/build/require/type/extract/extract.d.ts +6 -3
- package/build/require/type/extract/extract.js +8 -2
- package/build/require/type/extract/index.d.ts +1 -0
- package/build/require/type/extract/index.js +1 -0
- package/build/require/type/function/function.d.ts +4 -4
- package/build/require/type/indexed/index.d.ts +1 -1
- package/build/require/type/indexed/index.js +1 -1
- package/build/require/type/indexed/{indexed-mapped-result.d.ts → indexed-from-mapped-key.d.ts} +6 -6
- package/build/require/type/indexed/indexed-from-mapped-key.js +22 -0
- package/build/require/type/indexed/indexed-result.d.ts +8 -8
- package/build/require/type/indexed/indexed-result.js +14 -13
- package/build/require/type/indexed/indexed.d.ts +2 -2
- package/build/require/type/indexed/indexed.js +6 -6
- package/build/require/type/intersect/index.d.ts +2 -0
- package/build/require/type/intersect/index.js +2 -0
- package/build/require/type/intersect/intersect-create.d.ts +3 -0
- package/build/require/type/intersect/intersect-create.js +16 -0
- package/build/require/type/intersect/intersect-evaluated.d.ts +16 -0
- package/build/require/type/intersect/intersect-evaluated.js +39 -0
- package/build/require/type/intersect/intersect-type.d.ts +15 -0
- package/build/require/type/intersect/intersect-type.js +3 -0
- package/build/require/type/intersect/intersect.d.ts +4 -20
- package/build/require/type/intersect/intersect.js +5 -18
- package/build/require/type/intrinsic/capitalize.js +1 -2
- package/build/require/type/intrinsic/index.d.ts +1 -1
- package/build/require/type/intrinsic/index.js +1 -1
- package/build/require/type/intrinsic/{intrinsic-mapped-result.d.ts → intrinsic-from-mapped-key.d.ts} +6 -5
- package/build/require/type/intrinsic/intrinsic-from-mapped-key.js +25 -0
- package/build/require/type/intrinsic/intrinsic.d.ts +6 -6
- package/build/require/type/intrinsic/intrinsic.js +8 -8
- package/build/require/type/intrinsic/lowercase.js +1 -2
- package/build/require/type/intrinsic/uncapitalize.js +1 -2
- package/build/require/type/intrinsic/uppercase.js +1 -2
- package/build/require/type/keyof/index.d.ts +1 -0
- package/build/require/type/keyof/index.js +1 -0
- package/build/require/type/keyof/keyof-from-mapped-result.d.ts +13 -0
- package/build/require/type/keyof/keyof-from-mapped-result.js +18 -0
- package/build/require/type/keyof/keyof.d.ts +5 -2
- package/build/require/type/keyof/keyof.js +9 -2
- package/build/require/type/mapped/mapped.js +18 -19
- package/build/require/type/object/object.d.ts +5 -5
- package/build/require/type/omit/index.d.ts +1 -1
- package/build/require/type/omit/index.js +1 -1
- package/build/require/type/omit/omit-from-mapped-key.d.ts +15 -0
- package/build/require/type/omit/omit-from-mapped-key.js +24 -0
- package/build/require/type/omit/omit.d.ts +2 -2
- package/build/require/type/omit/omit.js +2 -2
- package/build/require/type/partial/index.d.ts +1 -0
- package/build/require/type/partial/index.js +1 -0
- package/build/require/type/partial/partial-from-mapped-result.d.ts +13 -0
- package/build/require/type/partial/partial-from-mapped-result.js +18 -0
- package/build/require/type/partial/partial.d.ts +5 -2
- package/build/require/type/partial/partial.js +10 -5
- package/build/require/type/pick/index.d.ts +1 -1
- package/build/require/type/pick/index.js +1 -1
- package/build/require/type/pick/pick-from-mapped-key.d.ts +15 -0
- package/build/require/type/pick/pick-from-mapped-key.js +24 -0
- package/build/require/type/pick/pick.d.ts +2 -2
- package/build/require/type/pick/pick.js +2 -2
- package/build/require/type/record/record.d.ts +0 -1
- package/build/require/type/record/record.js +1 -2
- package/build/require/type/recursive/recursive.d.ts +3 -2
- package/build/require/type/recursive/recursive.js +1 -5
- package/build/require/type/required/index.d.ts +1 -0
- package/build/require/type/required/index.js +1 -0
- package/build/require/type/required/required-from-mapped-result.d.ts +13 -0
- package/build/require/type/required/required-from-mapped-result.js +18 -0
- package/build/require/type/required/required.d.ts +5 -2
- package/build/require/type/required/required.js +10 -5
- package/build/require/type/template-literal/syntax.d.ts +4 -4
- package/build/require/type/template-literal/template-literal.d.ts +4 -4
- package/build/require/type/transform/transform.d.ts +3 -2
- package/build/require/type/transform/transform.js +4 -4
- package/build/require/type/tuple/tuple.d.ts +3 -3
- package/build/require/type/type/json.d.ts +25 -20
- package/build/require/type/type/json.js +3 -3
- package/build/require/type/union/index.d.ts +2 -0
- package/build/require/type/union/index.js +2 -0
- package/build/require/type/union/union-create.d.ts +3 -0
- package/build/require/type/union/union-create.js +9 -0
- package/build/require/type/union/union-evaluated.d.ts +16 -0
- package/build/require/type/union/union-evaluated.js +35 -0
- package/build/require/type/union/union-type.d.ts +12 -0
- package/build/require/type/union/union-type.js +3 -0
- package/build/require/type/union/union.d.ts +3 -13
- package/build/require/type/union/union.js +3 -11
- package/build/require/value/delta/delta.d.ts +1 -1
- package/package.json +1 -1
- package/readme.md +97 -101
- package/build/import/type/extends/extends-mapped-result-from-result.d.mts +0 -13
- package/build/import/type/extends/extends-mapped-result-from-result.mjs +0 -14
- package/build/import/type/extends/extends-mapped-result.d.mts +0 -17
- package/build/import/type/extends/extends-mapped-result.mjs +0 -21
- package/build/import/type/indexed/indexed-mapped-result.mjs +0 -18
- package/build/import/type/intrinsic/intrinsic-mapped-result.mjs +0 -21
- package/build/import/type/omit/omit-mapped-result.d.mts +0 -15
- package/build/import/type/omit/omit-mapped-result.mjs +0 -20
- package/build/import/type/pick/pick-mapped-result.d.mts +0 -15
- package/build/import/type/pick/pick-mapped-result.mjs +0 -20
- package/build/require/type/extends/extends-mapped-result-from-result.d.ts +0 -13
- package/build/require/type/extends/extends-mapped-result-from-result.js +0 -18
- package/build/require/type/extends/extends-mapped-result.d.ts +0 -17
- package/build/require/type/extends/extends-mapped-result.js +0 -25
- package/build/require/type/indexed/indexed-mapped-result.js +0 -22
- package/build/require/type/intrinsic/intrinsic-mapped-result.js +0 -25
- package/build/require/type/omit/omit-mapped-result.d.ts +0 -15
- package/build/require/type/omit/omit-mapped-result.js +0 -24
- package/build/require/type/pick/pick-mapped-result.d.ts +0 -15
- package/build/require/type/pick/pick-mapped-result.js +0 -24
package/build/import/index.d.mts
CHANGED
|
@@ -16,18 +16,18 @@ export { ConstructorParameters, type TConstructorParameters } from './type/const
|
|
|
16
16
|
export { Date, type TDate, type DateOptions } from './type/date/index.mjs';
|
|
17
17
|
export { Deref, type TDeref } from './type/deref/index.mjs';
|
|
18
18
|
export { Enum, type TEnum } from './type/enum/index.mjs';
|
|
19
|
-
export { Exclude, type TExclude } from './type/exclude/index.mjs';
|
|
20
|
-
export { Extends, type TExtends, ExtendsCheck, ExtendsResult, ExtendsUndefinedCheck } from './type/extends/index.mjs';
|
|
21
|
-
export { Extract, type TExtract } from './type/extract/index.mjs';
|
|
19
|
+
export { Exclude, type TExclude, type TExcludeFromMappedResult } from './type/exclude/index.mjs';
|
|
20
|
+
export { Extends, type TExtends, type ExtendsFromMappedResult, type ExtendsFromMappedKey, ExtendsCheck, ExtendsResult, ExtendsUndefinedCheck } from './type/extends/index.mjs';
|
|
21
|
+
export { Extract, type TExtract, type TExtractFromMappedResult } from './type/extract/index.mjs';
|
|
22
22
|
export { Function, type TFunction } from './type/function/index.mjs';
|
|
23
23
|
export { Increment, type Assert, type AssertType, type AssertRest, type AssertProperties, type Ensure, type Evaluate, type TupleToIntersect, type TupleToUnion, type UnionToTuple } from './type/helpers/index.mjs';
|
|
24
|
-
export { Index, IndexPropertyKeys,
|
|
24
|
+
export { Index, IndexPropertyKeys, IndexFromMappedKey, type TIndex, type TIndexPropertyKeys, type TIndexFromMappedKey } from './type/indexed/index.mjs';
|
|
25
25
|
export { InstanceType, type TInstanceType } from './type/instance-type/index.mjs';
|
|
26
26
|
export { Integer, type TInteger, type IntegerOptions } from './type/integer/index.mjs';
|
|
27
|
-
export { Intersect, type TIntersect, type IntersectOptions } from './type/intersect/index.mjs';
|
|
27
|
+
export { Intersect, IntersectEvaluated, type TIntersect, type IntersectOptions } from './type/intersect/index.mjs';
|
|
28
28
|
export { Iterator, type TIterator } from './type/iterator/index.mjs';
|
|
29
|
-
export { Intrinsic, type TIntrinsic, Capitalize, type TCapitalize, Lowercase, type TLowercase, Uncapitalize, type TUncapitalize, Uppercase, type TUppercase } from './type/intrinsic/index.mjs';
|
|
30
|
-
export { KeyOf, type TKeyOf, KeyOfPropertyKeys, KeyOfPattern } from './type/keyof/index.mjs';
|
|
29
|
+
export { Intrinsic, IntrinsicFromMappedKey, type TIntrinsic, Capitalize, type TCapitalize, Lowercase, type TLowercase, Uncapitalize, type TUncapitalize, Uppercase, type TUppercase } from './type/intrinsic/index.mjs';
|
|
30
|
+
export { KeyOf, type TKeyOf, type KeyOfFromMappedResult, KeyOfPropertyKeys, KeyOfPattern } from './type/keyof/index.mjs';
|
|
31
31
|
export { Literal, type TLiteral } from './type/literal/index.mjs';
|
|
32
32
|
export { Mapped, MappedKey, MappedResult, type TMapped, type TMappedKey, type TMappedResult, type TMappedFunction } from './type/mapped/index.mjs';
|
|
33
33
|
export { Never, type TNever } from './type/never/index.mjs';
|
|
@@ -35,11 +35,11 @@ export { Not, type TNot } from './type/not/index.mjs';
|
|
|
35
35
|
export { Null, type TNull } from './type/null/index.mjs';
|
|
36
36
|
export { Number, type TNumber, type NumberOptions } from './type/number/index.mjs';
|
|
37
37
|
export { Object, type TObject, type TProperties, type ObjectOptions } from './type/object/index.mjs';
|
|
38
|
-
export { Omit, type TOmit, type
|
|
38
|
+
export { Omit, type TOmit, type TOmitFromMappedKey } from './type/omit/index.mjs';
|
|
39
39
|
export { Optional, type TOptional } from './type/optional/index.mjs';
|
|
40
40
|
export { Parameters, type TParameters } from './type/parameters/index.mjs';
|
|
41
|
-
export { Partial, type TPartial } from './type/partial/index.mjs';
|
|
42
|
-
export { Pick, type TPick, type
|
|
41
|
+
export { Partial, PartialFromMappedResult, type TPartial, type TPartialFromMappedResult } from './type/partial/index.mjs';
|
|
42
|
+
export { Pick, type TPick, type TPickFromMappedKey } from './type/pick/index.mjs';
|
|
43
43
|
export { Promise, type TPromise } from './type/promise/index.mjs';
|
|
44
44
|
export { Readonly, type TReadonly } from './type/readonly/index.mjs';
|
|
45
45
|
export { ReadonlyOptional, type TReadonlyOptional } from './type/readonly-optional/index.mjs';
|
|
@@ -47,7 +47,7 @@ export { Record, type TRecord } from './type/record/index.mjs';
|
|
|
47
47
|
export { Recursive, type TRecursive, type TThis } from './type/recursive/index.mjs';
|
|
48
48
|
export { Ref, type TRef } from './type/ref/index.mjs';
|
|
49
49
|
export { RegExp, type TRegExp } from './type/regexp/index.mjs';
|
|
50
|
-
export { Required, type TRequired } from './type/required/index.mjs';
|
|
50
|
+
export { Required, type TRequired, type TRequiredFromMappedResult } from './type/required/index.mjs';
|
|
51
51
|
export { Rest, type TRest } from './type/rest/index.mjs';
|
|
52
52
|
export { ReturnType, type TReturnType } from './type/return-type/index.mjs';
|
|
53
53
|
export { type TSchema, type TKind, type SchemaOptions, type TAnySchema } from './type/schema/index.mjs';
|
|
@@ -60,7 +60,7 @@ export { Transform, type TTransform, type TransformOptions, type TransformFuncti
|
|
|
60
60
|
export { Tuple, type TTuple } from './type/tuple/index.mjs';
|
|
61
61
|
export { Uint8Array, type TUint8Array, type Uint8ArrayOptions } from './type/uint8array/index.mjs';
|
|
62
62
|
export { Undefined, type TUndefined } from './type/undefined/index.mjs';
|
|
63
|
-
export { Union, type TUnion } from './type/union/index.mjs';
|
|
63
|
+
export { Union, UnionEvaluated, type TUnion } from './type/union/index.mjs';
|
|
64
64
|
export { Unknown, type TUnknown } from './type/unknown/index.mjs';
|
|
65
65
|
export { Unsafe, type TUnsafe } from './type/unsafe/index.mjs';
|
|
66
66
|
export { Void, type TVoid } from './type/void/index.mjs';
|
package/build/import/index.mjs
CHANGED
|
@@ -21,12 +21,12 @@ export { Extends, ExtendsCheck, ExtendsResult, ExtendsUndefinedCheck } from './t
|
|
|
21
21
|
export { Extract } from './type/extract/index.mjs';
|
|
22
22
|
export { Function } from './type/function/index.mjs';
|
|
23
23
|
export { Increment } from './type/helpers/index.mjs';
|
|
24
|
-
export { Index, IndexPropertyKeys,
|
|
24
|
+
export { Index, IndexPropertyKeys, IndexFromMappedKey } from './type/indexed/index.mjs';
|
|
25
25
|
export { InstanceType } from './type/instance-type/index.mjs';
|
|
26
26
|
export { Integer } from './type/integer/index.mjs';
|
|
27
|
-
export { Intersect } from './type/intersect/index.mjs';
|
|
27
|
+
export { Intersect, IntersectEvaluated } from './type/intersect/index.mjs';
|
|
28
28
|
export { Iterator } from './type/iterator/index.mjs';
|
|
29
|
-
export { Intrinsic, Capitalize, Lowercase, Uncapitalize, Uppercase } from './type/intrinsic/index.mjs';
|
|
29
|
+
export { Intrinsic, IntrinsicFromMappedKey, Capitalize, Lowercase, Uncapitalize, Uppercase } from './type/intrinsic/index.mjs';
|
|
30
30
|
export { KeyOf, KeyOfPropertyKeys, KeyOfPattern } from './type/keyof/index.mjs';
|
|
31
31
|
export { Literal } from './type/literal/index.mjs';
|
|
32
32
|
export { Mapped, MappedKey, MappedResult } from './type/mapped/index.mjs';
|
|
@@ -38,7 +38,7 @@ export { Object } from './type/object/index.mjs';
|
|
|
38
38
|
export { Omit } from './type/omit/index.mjs';
|
|
39
39
|
export { Optional } from './type/optional/index.mjs';
|
|
40
40
|
export { Parameters } from './type/parameters/index.mjs';
|
|
41
|
-
export { Partial } from './type/partial/index.mjs';
|
|
41
|
+
export { Partial, PartialFromMappedResult } from './type/partial/index.mjs';
|
|
42
42
|
export { Pick } from './type/pick/index.mjs';
|
|
43
43
|
export { Promise } from './type/promise/index.mjs';
|
|
44
44
|
export { Readonly } from './type/readonly/index.mjs';
|
|
@@ -58,7 +58,7 @@ export { Transform, TransformDecodeBuilder, TransformEncodeBuilder } from './typ
|
|
|
58
58
|
export { Tuple } from './type/tuple/index.mjs';
|
|
59
59
|
export { Uint8Array } from './type/uint8array/index.mjs';
|
|
60
60
|
export { Undefined } from './type/undefined/index.mjs';
|
|
61
|
-
export { Union } from './type/union/index.mjs';
|
|
61
|
+
export { Union, UnionEvaluated } from './type/union/index.mjs';
|
|
62
62
|
export { Unknown } from './type/unknown/index.mjs';
|
|
63
63
|
export { Unsafe } from './type/unsafe/index.mjs';
|
|
64
64
|
export { Void } from './type/void/index.mjs';
|
|
@@ -11,7 +11,7 @@ export interface ArrayOptions extends SchemaOptions {
|
|
|
11
11
|
}
|
|
12
12
|
export interface TArray<T extends TSchema = TSchema> extends TSchema, ArrayOptions {
|
|
13
13
|
[Kind]: 'Array';
|
|
14
|
-
static: Static<T, this['params']
|
|
14
|
+
static: Array<Static<T, this['params']>>;
|
|
15
15
|
type: 'array';
|
|
16
16
|
items: T;
|
|
17
17
|
}
|
|
@@ -2,12 +2,12 @@ import type { TSchema, SchemaOptions } from '../schema/index.mjs';
|
|
|
2
2
|
import type { Static } from '../static/index.mjs';
|
|
3
3
|
import type { Ensure } from '../helpers/index.mjs';
|
|
4
4
|
import { Kind } from '../symbols/index.mjs';
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
export type
|
|
5
|
+
type TConstructorStaticReturnType<T extends TSchema, P extends unknown[]> = Static<T, P>;
|
|
6
|
+
type TConstructorStaticParameters<T extends TSchema[], P extends unknown[]> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [Static<L, P>, ...TConstructorStaticParameters<R, P>] : [];
|
|
7
|
+
export type TConstructorStatic<T extends TSchema[], U extends TSchema, P extends unknown[]> = (Ensure<new (...param: TConstructorStaticParameters<T, P>) => TConstructorStaticReturnType<U, P>>);
|
|
8
8
|
export interface TConstructor<T extends TSchema[] = TSchema[], U extends TSchema = TSchema> extends TSchema {
|
|
9
9
|
[Kind]: 'Constructor';
|
|
10
|
-
static:
|
|
10
|
+
static: TConstructorStatic<T, U, this['params']>;
|
|
11
11
|
type: 'Constructor';
|
|
12
12
|
parameters: T;
|
|
13
13
|
returns: U;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TSchema, SchemaOptions } from '../schema/index.mjs';
|
|
2
|
+
import type { TProperties } from '../object/index.mjs';
|
|
3
|
+
import { type TMappedResult } from '../mapped/index.mjs';
|
|
4
|
+
import { type TExclude } from './exclude.mjs';
|
|
5
|
+
type FromProperties<K extends TProperties, U extends TSchema> = ({
|
|
6
|
+
[K2 in keyof K]: TExclude<K[K2], U>;
|
|
7
|
+
});
|
|
8
|
+
declare function FromProperties<K extends TProperties, U extends TSchema>(K: K, U: U, options: SchemaOptions): FromProperties<K, U>;
|
|
9
|
+
type FromMappedResult<K extends TMappedResult, U extends TSchema> = (FromProperties<K['properties'], U>);
|
|
10
|
+
declare function FromMappedResult<K extends TMappedResult, U extends TSchema>(K: K, U: U, options: SchemaOptions): FromMappedResult<K, U>;
|
|
11
|
+
export type TExcludeFromMappedResult<T extends TMappedResult, U extends TSchema, P extends TProperties = FromMappedResult<T, U>> = (TMappedResult<P>);
|
|
12
|
+
export declare function ExcludeFromMappedResult<T extends TMappedResult, U extends TSchema, P extends TProperties = FromMappedResult<T, U>>(T: T, U: U, options: SchemaOptions): TMappedResult<P>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MappedResult } from '../mapped/index.mjs';
|
|
2
|
+
import { Exclude } from './exclude.mjs';
|
|
3
|
+
function FromProperties(K, U, options) {
|
|
4
|
+
return globalThis.Object.getOwnPropertyNames(K).reduce((Acc, K2) => {
|
|
5
|
+
return { ...Acc, [K2]: Exclude(K[K2], U, options) };
|
|
6
|
+
}, {});
|
|
7
|
+
}
|
|
8
|
+
function FromMappedResult(K, U, options) {
|
|
9
|
+
return FromProperties(K.properties, U, options);
|
|
10
|
+
}
|
|
11
|
+
export function ExcludeFromMappedResult(T, U, options) {
|
|
12
|
+
const P = FromMappedResult(T, U, options);
|
|
13
|
+
return MappedResult(P);
|
|
14
|
+
}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import type { TSchema, SchemaOptions } from '../schema/index.mjs';
|
|
2
2
|
import type { UnionToTuple, AssertRest, AssertType, Assert } from '../helpers/index.mjs';
|
|
3
|
+
import type { TMappedResult } from '../mapped/index.mjs';
|
|
3
4
|
import { type TTemplateLiteral } from '../template-literal/index.mjs';
|
|
4
5
|
import { type TUnion } from '../union/index.mjs';
|
|
5
6
|
import { type TNever } from '../never/index.mjs';
|
|
6
7
|
import { type TLiteral } from '../literal/index.mjs';
|
|
7
8
|
import { type Static } from '../static/index.mjs';
|
|
8
|
-
import {
|
|
9
|
-
type
|
|
9
|
+
import { UnionEvaluated } from '../union/index.mjs';
|
|
10
|
+
import { type TExcludeFromMappedResult } from './exclude-from-mapped-result.mjs';
|
|
11
|
+
type ExcludeTemplateLiteralResult<T extends string> = UnionEvaluated<AssertRest<UnionToTuple<{
|
|
10
12
|
[K in T]: TLiteral<K>;
|
|
11
13
|
}[T]>>>;
|
|
12
14
|
type ExcludeTemplateLiteral<T extends TTemplateLiteral, U extends TSchema> = (Exclude<Static<T>, Static<U>> extends infer S ? ExcludeTemplateLiteralResult<Assert<S, string>> : never);
|
|
13
15
|
type ExcludeArray<T extends TSchema[], U extends TSchema> = AssertRest<UnionToTuple<{
|
|
14
16
|
[K in keyof T]: Static<AssertType<T[K]>> extends Static<U> ? never : T[K];
|
|
15
|
-
}[number]>> extends infer R extends TSchema[] ?
|
|
17
|
+
}[number]>> extends infer R extends TSchema[] ? UnionEvaluated<R> : never;
|
|
16
18
|
type ExcludeResolve<T extends TSchema, U extends TSchema> = T extends TTemplateLiteral ? ExcludeTemplateLiteral<T, U> : T extends TUnion<infer S> ? ExcludeArray<S, U> : T extends U ? TNever : T;
|
|
17
|
-
|
|
19
|
+
declare function ExcludeResolve<L extends TSchema, R extends TSchema>(L: L, R: R): ExcludeResolve<L, R>;
|
|
18
20
|
export type TExclude<T extends TSchema, U extends TSchema> = ExcludeResolve<T, U>;
|
|
21
|
+
export declare function Exclude<L extends TMappedResult, R extends TSchema>(unionType: L, excludedMembers: R, options?: SchemaOptions): TExcludeFromMappedResult<L, R>;
|
|
19
22
|
export declare function Exclude<L extends TSchema, R extends TSchema>(unionType: L, excludedMembers: R, options?: SchemaOptions): TExclude<L, R>;
|
|
20
23
|
export {};
|
|
@@ -3,8 +3,9 @@ import { Union } from '../union/index.mjs';
|
|
|
3
3
|
import { Never } from '../never/index.mjs';
|
|
4
4
|
import { ExtendsCheck, ExtendsResult } from '../extends/index.mjs';
|
|
5
5
|
import { CloneType } from '../clone/type.mjs';
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import { ExcludeFromMappedResult } from './exclude-from-mapped-result.mjs';
|
|
7
|
+
import { TMappedResult as IsMappedResultType, TTemplateLiteral as IsTemplateLiteralType, TUnion as IsUnionType } from '../guard/type.mjs';
|
|
8
|
+
function ExcludeResolve(L, R) {
|
|
8
9
|
return (IsTemplateLiteralType(L) ? ExcludeResolve(TemplateLiteralToUnion(L), R) :
|
|
9
10
|
IsTemplateLiteralType(R) ? ExcludeResolve(L, TemplateLiteralToUnion(R)) :
|
|
10
11
|
IsUnionType(L) ? (() => {
|
|
@@ -15,6 +16,11 @@ export function ExcludeResolve(L, R) {
|
|
|
15
16
|
L);
|
|
16
17
|
}
|
|
17
18
|
export function Exclude(unionType, excludedMembers, options = {}) {
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
if (IsMappedResultType(unionType)) {
|
|
20
|
+
return ExcludeFromMappedResult(unionType, excludedMembers, options);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
const E = ExcludeResolve(unionType, excludedMembers);
|
|
24
|
+
return CloneType(E, options);
|
|
25
|
+
}
|
|
20
26
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TSchema, SchemaOptions } from '../schema/index.mjs';
|
|
2
|
+
import type { TProperties } from '../object/index.mjs';
|
|
3
|
+
import type { Assert } from '../helpers/index.mjs';
|
|
4
|
+
import { type TMappedResult, type TMappedKey } from '../mapped/index.mjs';
|
|
5
|
+
import { TLiteral, TLiteralValue } from '../literal/index.mjs';
|
|
6
|
+
import { type TExtends } from './extends.mjs';
|
|
7
|
+
type FromPropertyKey<K extends PropertyKey, U extends TSchema, L extends TSchema, R extends TSchema> = {
|
|
8
|
+
[_ in K]: TExtends<TLiteral<Assert<K, TLiteralValue>>, U, L, R>;
|
|
9
|
+
};
|
|
10
|
+
declare function FromPropertyKey<K extends PropertyKey, U extends TSchema, L extends TSchema, R extends TSchema>(K: K, U: U, L: L, R: R, options: SchemaOptions): FromPropertyKey<K, U, L, R>;
|
|
11
|
+
type FromPropertyKeys<K extends PropertyKey[], U extends TSchema, L extends TSchema, R extends TSchema> = (K extends [infer LK extends PropertyKey, ...infer RK extends PropertyKey[]] ? FromPropertyKey<LK, U, L, R> & FromPropertyKeys<RK, U, L, R> : {});
|
|
12
|
+
declare function FromPropertyKeys<K extends PropertyKey[], U extends TSchema, L extends TSchema, R extends TSchema>(K: [...K], U: U, L: L, R: R, options: SchemaOptions): FromPropertyKeys<K, U, L, R>;
|
|
13
|
+
type FromMappedKey<K extends TMappedKey, U extends TSchema, L extends TSchema, R extends TSchema> = (FromPropertyKeys<K['keys'], U, L, R>);
|
|
14
|
+
declare function FromMappedKey<K extends TMappedKey, U extends TSchema, L extends TSchema, R extends TSchema>(K: K, U: U, L: L, R: R, options: SchemaOptions): FromMappedKey<K, U, L, R>;
|
|
15
|
+
export type TExtendsFromMappedKey<T extends TMappedKey, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = FromMappedKey<T, U, L, R>> = (TMappedResult<P>);
|
|
16
|
+
export declare function ExtendsFromMappedKey<T extends TMappedKey, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = FromMappedKey<T, U, L, R>>(T: T, U: U, L: L, R: R, options: SchemaOptions): TMappedResult<P>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MappedResult } from '../mapped/index.mjs';
|
|
2
|
+
import { Literal } from '../literal/index.mjs';
|
|
3
|
+
import { Extends } from './extends.mjs';
|
|
4
|
+
function FromPropertyKey(K, U, L, R, options) {
|
|
5
|
+
return {
|
|
6
|
+
[K]: Extends(Literal(K), U, L, R, options)
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function FromPropertyKeys(K, U, L, R, options) {
|
|
10
|
+
const [LK, ...RK] = K;
|
|
11
|
+
return (K.length > 0
|
|
12
|
+
? { ...FromPropertyKey(LK, U, L, R, options), ...FromPropertyKeys(RK, U, L, R, options) }
|
|
13
|
+
: {});
|
|
14
|
+
}
|
|
15
|
+
function FromMappedKey(K, U, L, R, options) {
|
|
16
|
+
return FromPropertyKeys(K.keys, U, L, R, options);
|
|
17
|
+
}
|
|
18
|
+
export function ExtendsFromMappedKey(T, U, L, R, options) {
|
|
19
|
+
const P = FromMappedKey(T, U, L, R, options);
|
|
20
|
+
return MappedResult(P);
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TSchema, SchemaOptions } from '../schema/index.mjs';
|
|
2
|
+
import type { TProperties } from '../object/index.mjs';
|
|
3
|
+
import { type TMappedResult } from '../mapped/index.mjs';
|
|
4
|
+
import { type TExtends } from './extends.mjs';
|
|
5
|
+
type FromProperties<K extends TProperties, U extends TSchema, L extends TSchema, R extends TSchema> = ({
|
|
6
|
+
[K2 in keyof K]: TExtends<K[K2], U, L, R>;
|
|
7
|
+
});
|
|
8
|
+
declare function FromProperties<K extends TProperties, U extends TSchema, L extends TSchema, R extends TSchema>(K: K, U: U, L: L, R: R, options: SchemaOptions): FromProperties<K, U, L, R>;
|
|
9
|
+
type FromMappedResult<K extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema> = (FromProperties<K['properties'], U, L, R>);
|
|
10
|
+
declare function FromMappedResult<K extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema>(K: K, U: U, L: L, R: R, options: SchemaOptions): FromMappedResult<K, U, L, R>;
|
|
11
|
+
export type TExtendsFromMappedResult<T extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = FromMappedResult<T, U, L, R>> = (TMappedResult<P>);
|
|
12
|
+
export declare function ExtendsFromMappedResult<T extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = FromMappedResult<T, U, L, R>>(T: T, U: U, L: L, R: R, options: SchemaOptions): TMappedResult<P>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MappedResult } from '../mapped/index.mjs';
|
|
2
|
+
import { Extends } from './extends.mjs';
|
|
3
|
+
function FromProperties(K, U, L, R, options) {
|
|
4
|
+
return globalThis.Object.getOwnPropertyNames(K).reduce((Acc, K2) => {
|
|
5
|
+
return { ...Acc, [K2]: Extends(K[K2], U, L, R, options) };
|
|
6
|
+
}, {});
|
|
7
|
+
}
|
|
8
|
+
function FromMappedResult(K, U, L, R, options) {
|
|
9
|
+
return FromProperties(K.properties, U, L, R, options);
|
|
10
|
+
}
|
|
11
|
+
export function ExtendsFromMappedResult(T, U, L, R, options) {
|
|
12
|
+
const P = FromMappedResult(T, U, L, R, options);
|
|
13
|
+
return MappedResult(P);
|
|
14
|
+
}
|
|
@@ -3,12 +3,12 @@ import type { Static } from '../static/index.mjs';
|
|
|
3
3
|
import { type TUnion } from '../union/index.mjs';
|
|
4
4
|
import { TMappedKey, TMappedResult } from '../mapped/index.mjs';
|
|
5
5
|
import { UnionToTuple } from '../helpers/index.mjs';
|
|
6
|
-
import { type
|
|
7
|
-
import { type
|
|
6
|
+
import { type TExtendsFromMappedKey } from './extends-from-mapped-key.mjs';
|
|
7
|
+
import { type TExtendsFromMappedResult } from './extends-from-mapped-result.mjs';
|
|
8
8
|
type ExtendsResolve<L extends TSchema, R extends TSchema, T extends TSchema, U extends TSchema> = ((Static<L> extends Static<R> ? T : U) extends infer O extends TSchema ? UnionToTuple<O> extends [infer X extends TSchema, infer Y extends TSchema] ? TUnion<[X, Y]> : O : never);
|
|
9
9
|
declare function ExtendsResolve<L extends TSchema, R extends TSchema, T extends TSchema, U extends TSchema>(left: L, right: R, trueType: T, falseType: U): ExtendsResolve<L, R, T, U>;
|
|
10
10
|
export type TExtends<L extends TSchema, R extends TSchema, T extends TSchema, F extends TSchema> = ExtendsResolve<L, R, T, F>;
|
|
11
|
-
export declare function Extends<L extends TMappedResult, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions):
|
|
12
|
-
export declare function Extends<L extends TMappedKey, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions):
|
|
11
|
+
export declare function Extends<L extends TMappedResult, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsFromMappedResult<L, R, T, F>;
|
|
12
|
+
export declare function Extends<L extends TMappedKey, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsFromMappedKey<L, R, T, F>;
|
|
13
13
|
export declare function 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>;
|
|
14
14
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { TMappedKey as IsMappedKeyType, TMappedResult as IsMappedResultType } from '../guard/type.mjs';
|
|
2
1
|
import { Union } from '../union/index.mjs';
|
|
3
2
|
import { ExtendsCheck, ExtendsResult } from './extends-check.mjs';
|
|
4
3
|
import { CloneType } from '../clone/type.mjs';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { ExtendsFromMappedKey } from './extends-from-mapped-key.mjs';
|
|
5
|
+
import { ExtendsFromMappedResult } from './extends-from-mapped-result.mjs';
|
|
6
|
+
import { TMappedKey as IsMappedKeyType, TMappedResult as IsMappedResultType } from '../guard/type.mjs';
|
|
7
7
|
function ExtendsResolve(left, right, trueType, falseType) {
|
|
8
8
|
const R = ExtendsCheck(left, right);
|
|
9
9
|
return (R === ExtendsResult.Union ? Union([trueType, falseType]) :
|
|
@@ -11,7 +11,7 @@ function ExtendsResolve(left, right, trueType, falseType) {
|
|
|
11
11
|
falseType);
|
|
12
12
|
}
|
|
13
13
|
export function Extends(L, R, T, F, options = {}) {
|
|
14
|
-
return (IsMappedResultType(L) ?
|
|
15
|
-
IsMappedKeyType(L) ? CloneType(
|
|
14
|
+
return (IsMappedResultType(L) ? ExtendsFromMappedResult(L, R, T, F, options) :
|
|
15
|
+
IsMappedKeyType(L) ? CloneType(ExtendsFromMappedKey(L, R, T, F, options)) :
|
|
16
16
|
CloneType(ExtendsResolve(L, R, T, F), options));
|
|
17
17
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './extends-check.mjs';
|
|
2
|
-
export * from './extends-mapped-
|
|
3
|
-
export * from './extends-mapped-result.mjs';
|
|
2
|
+
export * from './extends-from-mapped-key.mjs';
|
|
3
|
+
export * from './extends-from-mapped-result.mjs';
|
|
4
4
|
export * from './extends-undefined.mjs';
|
|
5
5
|
export * from './extends.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './extends-check.mjs';
|
|
2
|
-
export * from './extends-mapped-
|
|
3
|
-
export * from './extends-mapped-result.mjs';
|
|
2
|
+
export * from './extends-from-mapped-key.mjs';
|
|
3
|
+
export * from './extends-from-mapped-result.mjs';
|
|
4
4
|
export * from './extends-undefined.mjs';
|
|
5
5
|
export * from './extends.mjs';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TSchema, SchemaOptions } from '../schema/index.mjs';
|
|
2
|
+
import type { TProperties } from '../object/index.mjs';
|
|
3
|
+
import { type TMappedResult } from '../mapped/index.mjs';
|
|
4
|
+
import { type TExtract } from './extract.mjs';
|
|
5
|
+
type FromProperties<K extends TProperties, U extends TSchema> = ({
|
|
6
|
+
[K2 in keyof K]: TExtract<K[K2], U>;
|
|
7
|
+
});
|
|
8
|
+
declare function FromProperties<K extends TProperties, U extends TSchema>(K: K, U: U, options: SchemaOptions): FromProperties<K, U>;
|
|
9
|
+
type FromMappedResult<K extends TMappedResult, U extends TSchema> = (FromProperties<K['properties'], U>);
|
|
10
|
+
declare function FromMappedResult<K extends TMappedResult, U extends TSchema>(K: K, U: U, options: SchemaOptions): FromMappedResult<K, U>;
|
|
11
|
+
export type TExtractFromMappedResult<T extends TMappedResult, U extends TSchema, P extends TProperties = FromMappedResult<T, U>> = (TMappedResult<P>);
|
|
12
|
+
export declare function ExtractFromMappedResult<T extends TMappedResult, U extends TSchema, P extends TProperties = FromMappedResult<T, U>>(T: T, U: U, options: SchemaOptions): TMappedResult<P>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MappedResult } from '../mapped/index.mjs';
|
|
2
|
+
import { Extract } from './extract.mjs';
|
|
3
|
+
function FromProperties(K, U, options) {
|
|
4
|
+
return globalThis.Object.getOwnPropertyNames(K).reduce((Acc, K2) => {
|
|
5
|
+
return { ...Acc, [K2]: Extract(K[K2], U, options) };
|
|
6
|
+
}, {});
|
|
7
|
+
}
|
|
8
|
+
function FromMappedResult(K, U, options) {
|
|
9
|
+
return FromProperties(K.properties, U, options);
|
|
10
|
+
}
|
|
11
|
+
export function ExtractFromMappedResult(T, U, options) {
|
|
12
|
+
const P = FromMappedResult(T, U, options);
|
|
13
|
+
return MappedResult(P);
|
|
14
|
+
}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import type { TSchema, SchemaOptions } from '../schema/index.mjs';
|
|
2
2
|
import type { Assert, AssertRest, AssertType, UnionToTuple } from '../helpers/index.mjs';
|
|
3
|
+
import type { TMappedResult } from '../mapped/index.mjs';
|
|
3
4
|
import { type TTemplateLiteral } from '../template-literal/index.mjs';
|
|
4
5
|
import { type TLiteral } from '../literal/index.mjs';
|
|
5
6
|
import { type TUnion } from '../union/index.mjs';
|
|
6
7
|
import { type Static } from '../static/index.mjs';
|
|
7
|
-
import {
|
|
8
|
-
type
|
|
8
|
+
import { UnionEvaluated } from '../union/index.mjs';
|
|
9
|
+
import { type TExtractFromMappedResult } from './extract-from-mapped-result.mjs';
|
|
10
|
+
type FromTemplateLiteralResult<T extends string> = UnionEvaluated<AssertRest<UnionToTuple<{
|
|
9
11
|
[K in T]: TLiteral<K>;
|
|
10
12
|
}[T]>>>;
|
|
11
13
|
type FromTemplateLiteral<T extends TTemplateLiteral, U extends TSchema> = Extract<Static<T>, Static<U>> extends infer S ? FromTemplateLiteralResult<Assert<S, string>> : never;
|
|
12
14
|
type FromArray<T extends TSchema[], U extends TSchema> = AssertRest<UnionToTuple<{
|
|
13
15
|
[K in keyof T]: Static<AssertType<T[K]>> extends Static<U> ? T[K] : never;
|
|
14
|
-
}[number]>> extends infer R extends TSchema[] ?
|
|
16
|
+
}[number]>> extends infer R extends TSchema[] ? UnionEvaluated<R> : never;
|
|
15
17
|
export type ExtractResolve<T extends TSchema, U extends TSchema> = (T extends TTemplateLiteral ? FromTemplateLiteral<T, U> : T extends TUnion<infer S> ? FromArray<S, U> : T extends U ? T : T);
|
|
16
18
|
export declare function ExtractResolve<L extends TSchema, R extends TSchema>(L: L, R: R): ExtractResolve<L, R>;
|
|
17
19
|
export type TExtract<T extends TSchema, U extends TSchema> = ExtractResolve<T, U>;
|
|
20
|
+
export declare function Extract<L extends TMappedResult, R extends TSchema>(type: L, union: R, options?: SchemaOptions): TExtractFromMappedResult<L, R>;
|
|
18
21
|
export declare function Extract<L extends TSchema, R extends TSchema>(type: L, union: R, options?: SchemaOptions): TExtract<L, R>;
|
|
19
22
|
export {};
|
|
@@ -3,7 +3,8 @@ import { Union } from '../union/index.mjs';
|
|
|
3
3
|
import { Never } from '../never/index.mjs';
|
|
4
4
|
import { ExtendsCheck, ExtendsResult } from '../extends/index.mjs';
|
|
5
5
|
import { CloneType } from '../clone/type.mjs';
|
|
6
|
-
import {
|
|
6
|
+
import { ExtractFromMappedResult } from './extract-from-mapped-result.mjs';
|
|
7
|
+
import { TMappedResult as IsMappedResultType, TTemplateLiteral as IsTemplateLiteralType, TUnion as IsUnionType } from '../guard/type.mjs';
|
|
7
8
|
export function ExtractResolve(L, R) {
|
|
8
9
|
return (IsTemplateLiteralType(L) ? ExtractResolve(TemplateLiteralToUnion(L), R) :
|
|
9
10
|
IsTemplateLiteralType(R) ? ExtractResolve(L, TemplateLiteralToUnion(R)) :
|
|
@@ -15,6 +16,11 @@ export function ExtractResolve(L, R) {
|
|
|
15
16
|
Never());
|
|
16
17
|
}
|
|
17
18
|
export function Extract(type, union, options = {}) {
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
if (IsMappedResultType(type)) {
|
|
20
|
+
return ExtractFromMappedResult(type, union, options);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
const E = ExtractResolve(type, union);
|
|
24
|
+
return CloneType(E, options);
|
|
25
|
+
}
|
|
20
26
|
}
|
|
@@ -2,12 +2,12 @@ import type { TSchema, SchemaOptions } from '../schema/index.mjs';
|
|
|
2
2
|
import type { Static } from '../static/index.mjs';
|
|
3
3
|
import type { Ensure } from '../helpers/index.mjs';
|
|
4
4
|
import { Kind } from '../symbols/index.mjs';
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
type
|
|
5
|
+
type FunctionStaticReturnType<T extends TSchema, P extends unknown[]> = Static<T, P>;
|
|
6
|
+
type FunctionStaticParameters<T extends TSchema[], P extends unknown[]> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [Static<L, P>, ...FunctionStaticParameters<R, P>] : [];
|
|
7
|
+
type FunctionStatic<T extends TSchema[], U extends TSchema, P extends unknown[]> = (Ensure<(...param: FunctionStaticParameters<T, P>) => FunctionStaticReturnType<U, P>>);
|
|
8
8
|
export interface TFunction<T extends TSchema[] = TSchema[], U extends TSchema = TSchema> extends TSchema {
|
|
9
9
|
[Kind]: 'Function';
|
|
10
|
-
static:
|
|
10
|
+
static: FunctionStatic<T, U, this['params']>;
|
|
11
11
|
type: 'Function';
|
|
12
12
|
parameters: T;
|
|
13
13
|
returns: U;
|
package/build/import/type/indexed/{indexed-mapped-result.d.mts → indexed-from-mapped-key.d.mts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TSchema, SchemaOptions } from '../schema/index.mjs';
|
|
2
2
|
import { type TProperties } from '../object/index.mjs';
|
|
3
3
|
import { type TIndexResult } from './indexed-result.mjs';
|
|
4
4
|
import { type TMappedResult, type TMappedKey } from '../mapped/index.mjs';
|
|
@@ -6,11 +6,11 @@ import { Evaluate } from '../helpers/index.mjs';
|
|
|
6
6
|
type MappedIndexPropertyKey<T extends TSchema, K extends PropertyKey> = {
|
|
7
7
|
[_ in K]: TIndexResult<T, [K]>;
|
|
8
8
|
};
|
|
9
|
-
declare function MappedIndexPropertyKey<T extends TSchema, K extends PropertyKey>(T: T, K: K): MappedIndexPropertyKey<T, K>;
|
|
9
|
+
declare function MappedIndexPropertyKey<T extends TSchema, K extends PropertyKey>(T: T, K: K, options: SchemaOptions): MappedIndexPropertyKey<T, K>;
|
|
10
10
|
type MappedIndexPropertyKeys<T extends TSchema, K extends PropertyKey[]> = (K extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? MappedIndexPropertyKey<T, L> & MappedIndexPropertyKeys<T, R> : {});
|
|
11
|
-
declare function MappedIndexPropertyKeys<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K]): MappedIndexPropertyKeys<T, K>;
|
|
11
|
+
declare function MappedIndexPropertyKeys<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K], options: SchemaOptions): MappedIndexPropertyKeys<T, K>;
|
|
12
12
|
type MappedIndexProperties<T extends TSchema, K extends TMappedKey> = Evaluate<MappedIndexPropertyKeys<T, K['keys']>>;
|
|
13
|
-
declare function MappedIndexProperties<T extends TSchema, K extends TMappedKey>(T: T, K: K): MappedIndexProperties<T, K>;
|
|
14
|
-
export type
|
|
15
|
-
export declare function
|
|
13
|
+
declare function MappedIndexProperties<T extends TSchema, K extends TMappedKey>(T: T, K: K, options: SchemaOptions): MappedIndexProperties<T, K>;
|
|
14
|
+
export type TIndexFromMappedKey<T extends TSchema, K extends TMappedKey, P extends TProperties = MappedIndexProperties<T, K>> = (TMappedResult<P>);
|
|
15
|
+
export declare function IndexFromMappedKey<T extends TSchema, K extends TMappedKey, P extends TProperties = MappedIndexProperties<T, K>>(T: T, K: K, options: SchemaOptions): TMappedResult<P>;
|
|
16
16
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IndexResult } from './indexed-result.mjs';
|
|
2
|
+
import { MappedResult } from '../mapped/index.mjs';
|
|
3
|
+
function MappedIndexPropertyKey(T, K, options) {
|
|
4
|
+
return { [K]: IndexResult(T, [K], options) };
|
|
5
|
+
}
|
|
6
|
+
function MappedIndexPropertyKeys(T, K, options) {
|
|
7
|
+
const [L, ...R] = K;
|
|
8
|
+
return (K.length > 0
|
|
9
|
+
? { ...MappedIndexPropertyKey(T, L, options), ...MappedIndexPropertyKeys(T, R, options) }
|
|
10
|
+
: {});
|
|
11
|
+
}
|
|
12
|
+
function MappedIndexProperties(T, K, options) {
|
|
13
|
+
return MappedIndexPropertyKeys(T, K.keys, options);
|
|
14
|
+
}
|
|
15
|
+
export function IndexFromMappedKey(T, K, options) {
|
|
16
|
+
const P = MappedIndexProperties(T, K, options);
|
|
17
|
+
return MappedResult(P);
|
|
18
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TSchema } from '../schema/index.mjs';
|
|
1
|
+
import { type TSchema, SchemaOptions } from '../schema/index.mjs';
|
|
2
2
|
import { type TObject, type TProperties } from '../object/index.mjs';
|
|
3
3
|
import { type TNever } from '../never/index.mjs';
|
|
4
4
|
import { type TRecursive } from '../recursive/index.mjs';
|
|
@@ -6,19 +6,19 @@ import { type TIntersect } from '../intersect/index.mjs';
|
|
|
6
6
|
import { type TUnion } from '../union/index.mjs';
|
|
7
7
|
import { type TTuple } from '../tuple/index.mjs';
|
|
8
8
|
import { type TArray } from '../array/index.mjs';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { IntersectEvaluated } from '../intersect/index.mjs';
|
|
10
|
+
import { UnionEvaluated } from '../union/index.mjs';
|
|
11
11
|
type FromRest<T extends TSchema[], K extends PropertyKey> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [FromKey<L, K>, ...FromRest<R, K>] : []);
|
|
12
12
|
declare function FromRest<T extends TSchema[], K extends PropertyKey>(T: [...T], K: K): FromRest<T, K>;
|
|
13
13
|
type FromIntersectRest<T extends TSchema[]> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? L extends TNever ? [...FromIntersectRest<R>] : [L, ...FromIntersectRest<R>] : []);
|
|
14
14
|
declare function FromIntersectRest<T extends TSchema[]>(T: [...T]): FromIntersectRest<T>;
|
|
15
|
-
type FromIntersect<T extends TSchema[], K extends PropertyKey> = (
|
|
15
|
+
type FromIntersect<T extends TSchema[], K extends PropertyKey> = (IntersectEvaluated<FromIntersectRest<FromRest<T, K>>>);
|
|
16
16
|
declare function FromIntersect<T extends TSchema[], K extends PropertyKey>(T: [...T], K: K): FromIntersect<T, K>;
|
|
17
17
|
type FromUnionRest<T extends TSchema[], S = T> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? L extends TNever ? [] : FromUnionRest<R, S> : S);
|
|
18
18
|
declare function FromUnionRest<T extends TSchema[]>(T: [...T], S?: [...T]): FromUnionRest<T>;
|
|
19
|
-
type FromUnion<T extends TSchema[], K extends PropertyKey> = (
|
|
19
|
+
type FromUnion<T extends TSchema[], K extends PropertyKey> = (UnionEvaluated<FromUnionRest<FromRest<T, K>>>);
|
|
20
20
|
declare function FromUnion<T extends TSchema[], K extends PropertyKey>(T: [...T], K: K): FromUnion<T, K>;
|
|
21
|
-
type FromTuple<T extends TSchema[], K extends PropertyKey> = (K extends keyof T ? T[K] : K extends '[number]' ?
|
|
21
|
+
type FromTuple<T extends TSchema[], K extends PropertyKey> = (K extends keyof T ? T[K] : K extends '[number]' ? UnionEvaluated<T> : TNever);
|
|
22
22
|
declare function FromTuple<T extends TSchema[], K extends PropertyKey>(T: [...T], K: K): FromTuple<T, K>;
|
|
23
23
|
type FromArray<T extends TSchema, K extends PropertyKey> = (K extends '[number]' ? T : TNever);
|
|
24
24
|
declare function FromArray<T extends TSchema, K extends PropertyKey>(T: T, K: K): FromArray<T, K>;
|
|
@@ -28,6 +28,6 @@ type FromKey<T extends TSchema, K extends PropertyKey> = (T extends TRecursive<i
|
|
|
28
28
|
declare function FromKey<T extends TSchema, K extends PropertyKey>(T: T, K: K): FromKey<T, K>;
|
|
29
29
|
type FromKeys<T extends TSchema, K extends PropertyKey[]> = (K extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? [FromKey<T, L>, ...FromKeys<T, R>] : []);
|
|
30
30
|
declare function FromKeys<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K]): FromKeys<T, K>;
|
|
31
|
-
export type TIndexResult<T extends TSchema, K extends PropertyKey[]> = (
|
|
32
|
-
export declare function IndexResult<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K]): TIndexResult<T, K>;
|
|
31
|
+
export type TIndexResult<T extends TSchema, K extends PropertyKey[]> = (UnionEvaluated<FromKeys<T, K>>);
|
|
32
|
+
export declare function IndexResult<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K], options: SchemaOptions): TIndexResult<T, K>;
|
|
33
33
|
export {};
|