@sinclair/typebox 0.32.0-dev-12 → 0.32.0-dev-14
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 +5 -5
- package/build/import/index.mjs +3 -3
- package/build/import/type/composite/composite.d.mts +2 -2
- package/build/import/type/extends/extends-mapped-result-from-result.d.mts +13 -0
- package/build/import/type/extends/extends-mapped-result-from-result.mjs +14 -0
- package/build/import/type/extends/extends-mapped-result.d.mts +13 -9
- package/build/import/type/extends/extends-mapped-result.mjs +15 -8
- package/build/import/type/extends/extends.d.mts +4 -4
- package/build/import/type/extends/extends.mjs +4 -4
- package/build/import/type/extends/index.d.mts +1 -1
- package/build/import/type/extends/index.mjs +1 -1
- package/build/import/type/guard/type.d.mts +47 -46
- package/build/import/type/guard/type.mjs +294 -293
- package/build/import/type/indexed/index.d.mts +2 -2
- package/build/import/type/indexed/index.mjs +2 -2
- package/build/import/type/indexed/{indexed-mapped.d.mts → indexed-mapped-result.d.mts} +4 -4
- package/build/import/type/indexed/{indexed-mapped.mjs → indexed-mapped-result.mjs} +3 -3
- package/build/import/type/indexed/indexed-property-keys.d.mts +3 -3
- package/build/import/type/indexed/indexed-property-keys.mjs +2 -2
- package/build/import/type/indexed/{indexed-type.d.mts → indexed-result.d.mts} +2 -2
- package/build/import/type/indexed/{indexed-type.mjs → indexed-result.mjs} +1 -1
- package/build/import/type/indexed/indexed.d.mts +6 -6
- package/build/import/type/indexed/indexed.mjs +6 -6
- package/build/import/type/intrinsic/capitalize.d.mts +4 -0
- package/build/import/type/intrinsic/capitalize.mjs +5 -0
- package/build/import/type/intrinsic/index.d.mts +5 -0
- package/build/import/type/intrinsic/index.mjs +5 -0
- package/build/import/type/intrinsic/intrinsic-mapped-result.d.mts +15 -0
- package/build/import/type/intrinsic/intrinsic-mapped-result.mjs +21 -0
- package/build/import/type/intrinsic/intrinsic.d.mts +9 -14
- package/build/import/type/intrinsic/intrinsic.mjs +10 -21
- package/build/import/type/intrinsic/lowercase.d.mts +4 -0
- package/build/import/type/intrinsic/lowercase.mjs +5 -0
- package/build/import/type/intrinsic/uncapitalize.d.mts +4 -0
- package/build/import/type/intrinsic/uncapitalize.mjs +5 -0
- package/build/import/type/intrinsic/uppercase.d.mts +4 -0
- package/build/import/type/intrinsic/uppercase.mjs +5 -0
- package/build/import/type/mapped/index.d.mts +2 -0
- package/build/import/type/mapped/index.mjs +2 -0
- package/build/import/type/mapped/mapped-key.d.mts +8 -0
- package/build/import/type/mapped/mapped-key.mjs +7 -0
- package/build/import/type/mapped/mapped-result.d.mts +9 -0
- package/build/import/type/mapped/mapped-result.mjs +7 -0
- package/build/import/type/mapped/mapped.d.mts +24 -31
- package/build/import/type/mapped/mapped.mjs +33 -36
- package/build/import/type/omit/index.d.mts +1 -0
- package/build/import/type/omit/index.mjs +1 -0
- package/build/import/type/omit/omit-mapped-result.d.mts +15 -0
- package/build/import/type/omit/omit-mapped-result.mjs +20 -0
- package/build/import/type/omit/omit.d.mts +5 -2
- package/build/import/type/omit/omit.mjs +12 -6
- package/build/import/type/pick/index.d.mts +1 -0
- package/build/import/type/pick/index.mjs +1 -0
- package/build/import/type/pick/pick-mapped-result.d.mts +15 -0
- package/build/import/type/pick/pick-mapped-result.mjs +20 -0
- package/build/import/type/pick/pick.d.mts +5 -2
- package/build/import/type/pick/pick.mjs +12 -6
- package/build/import/type/record/record.mjs +4 -4
- package/build/import/type/type/json.d.mts +15 -13
- package/build/import/value/transform/decode.mjs +2 -2
- package/build/import/value/transform/encode.mjs +2 -2
- package/build/require/index.d.ts +5 -5
- package/build/require/index.js +7 -6
- package/build/require/type/composite/composite.d.ts +2 -2
- package/build/require/type/extends/extends-mapped-result-from-result.d.ts +13 -0
- package/build/require/type/extends/extends-mapped-result-from-result.js +18 -0
- package/build/require/type/extends/extends-mapped-result.d.ts +13 -9
- package/build/require/type/extends/extends-mapped-result.js +17 -10
- package/build/require/type/extends/extends.d.ts +4 -4
- package/build/require/type/extends/extends.js +3 -3
- package/build/require/type/extends/index.d.ts +1 -1
- package/build/require/type/extends/index.js +1 -1
- package/build/require/type/guard/type.d.ts +47 -46
- package/build/require/type/guard/type.js +252 -250
- package/build/require/type/indexed/index.d.ts +2 -2
- package/build/require/type/indexed/index.js +2 -2
- package/build/require/type/indexed/{indexed-mapped.d.ts → indexed-mapped-result.d.ts} +4 -4
- package/build/require/type/indexed/{indexed-mapped.js → indexed-mapped-result.js} +5 -5
- package/build/require/type/indexed/indexed-property-keys.d.ts +3 -3
- package/build/require/type/indexed/indexed-property-keys.js +4 -4
- package/build/require/type/indexed/{indexed-type.d.ts → indexed-result.d.ts} +2 -2
- package/build/require/type/indexed/{indexed-type.js → indexed-result.js} +3 -3
- package/build/require/type/indexed/indexed.d.ts +6 -6
- package/build/require/type/indexed/indexed.js +5 -5
- package/build/require/type/intrinsic/capitalize.d.ts +4 -0
- package/build/require/type/intrinsic/capitalize.js +9 -0
- package/build/require/type/intrinsic/index.d.ts +5 -0
- package/build/require/type/intrinsic/index.js +5 -0
- package/build/require/type/intrinsic/intrinsic-mapped-result.d.ts +15 -0
- package/build/require/type/intrinsic/intrinsic-mapped-result.js +25 -0
- package/build/require/type/intrinsic/intrinsic.d.ts +9 -14
- package/build/require/type/intrinsic/intrinsic.js +10 -25
- package/build/require/type/intrinsic/lowercase.d.ts +4 -0
- package/build/require/type/intrinsic/lowercase.js +9 -0
- package/build/require/type/intrinsic/uncapitalize.d.ts +4 -0
- package/build/require/type/intrinsic/uncapitalize.js +9 -0
- package/build/require/type/intrinsic/uppercase.d.ts +4 -0
- package/build/require/type/intrinsic/uppercase.js +9 -0
- package/build/require/type/mapped/index.d.ts +2 -0
- package/build/require/type/mapped/index.js +2 -0
- package/build/require/type/mapped/mapped-key.d.ts +8 -0
- package/build/require/type/mapped/mapped-key.js +11 -0
- package/build/require/type/mapped/mapped-result.d.ts +9 -0
- package/build/require/type/mapped/mapped-result.js +11 -0
- package/build/require/type/mapped/mapped.d.ts +24 -31
- package/build/require/type/mapped/mapped.js +45 -52
- package/build/require/type/omit/index.d.ts +1 -0
- package/build/require/type/omit/index.js +1 -0
- package/build/require/type/omit/omit-mapped-result.d.ts +15 -0
- package/build/require/type/omit/omit-mapped-result.js +24 -0
- package/build/require/type/omit/omit.d.ts +5 -2
- package/build/require/type/omit/omit.js +10 -4
- package/build/require/type/pick/index.d.ts +1 -0
- package/build/require/type/pick/index.js +1 -0
- package/build/require/type/pick/pick-mapped-result.d.ts +15 -0
- package/build/require/type/pick/pick-mapped-result.js +24 -0
- package/build/require/type/pick/pick.d.ts +5 -2
- package/build/require/type/pick/pick.js +10 -4
- package/build/require/type/record/record.js +2 -2
- package/build/require/type/type/json.d.ts +15 -13
- package/build/require/value/transform/decode.js +1 -1
- package/build/require/value/transform/encode.js +1 -1
- package/package.json +1 -1
- package/readme.md +115 -47
- package/build/import/type/extends/extends-mapped.d.mts +0 -17
- package/build/import/type/extends/extends-mapped.mjs +0 -21
- package/build/require/type/extends/extends-mapped.d.ts +0 -17
- package/build/require/type/extends/extends-mapped.js +0 -25
package/build/import/index.d.mts
CHANGED
|
@@ -21,25 +21,25 @@ export { Extends, type TExtends, ExtendsCheck, ExtendsResult, ExtendsUndefinedCh
|
|
|
21
21
|
export { Extract, type TExtract } 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, type TIndex, type
|
|
24
|
+
export { Index, IndexPropertyKeys, IndexMappedResult, type TIndex, type TIndexPropertyKeys, type TIndexMappedResult } 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
27
|
export { Intersect, type TIntersect, type IntersectOptions } from './type/intersect/index.mjs';
|
|
28
28
|
export { Iterator, type TIterator } from './type/iterator/index.mjs';
|
|
29
|
-
export { Capitalize, type TCapitalize, Lowercase, type TLowercase, Uncapitalize, type TUncapitalize, Uppercase, type TUppercase
|
|
29
|
+
export { Intrinsic, type TIntrinsic, Capitalize, type TCapitalize, Lowercase, type TLowercase, Uncapitalize, type TUncapitalize, Uppercase, type TUppercase } from './type/intrinsic/index.mjs';
|
|
30
30
|
export { KeyOf, type TKeyOf, KeyOfPropertyKeys, KeyOfPattern } from './type/keyof/index.mjs';
|
|
31
31
|
export { Literal, type TLiteral } from './type/literal/index.mjs';
|
|
32
|
-
export { Mapped, type
|
|
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';
|
|
34
34
|
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 } from './type/omit/index.mjs';
|
|
38
|
+
export { Omit, type TOmit, type TOmitMappedResult } 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
41
|
export { Partial, type TPartial } from './type/partial/index.mjs';
|
|
42
|
-
export { Pick, type TPick } from './type/pick/index.mjs';
|
|
42
|
+
export { Pick, type TPick, type TPickMappedResult } 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';
|
package/build/import/index.mjs
CHANGED
|
@@ -21,15 +21,15 @@ 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,
|
|
24
|
+
export { Index, IndexPropertyKeys, IndexMappedResult } 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
27
|
export { Intersect } from './type/intersect/index.mjs';
|
|
28
28
|
export { Iterator } from './type/iterator/index.mjs';
|
|
29
|
-
export { Capitalize, Lowercase, Uncapitalize, Uppercase
|
|
29
|
+
export { Intrinsic, 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
|
-
export { Mapped } from './type/mapped/index.mjs';
|
|
32
|
+
export { Mapped, MappedKey, MappedResult } from './type/mapped/index.mjs';
|
|
33
33
|
export { Never } from './type/never/index.mjs';
|
|
34
34
|
export { Not } from './type/not/index.mjs';
|
|
35
35
|
export { Null } from './type/null/index.mjs';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { UnionToTuple, Assert, Evaluate } from '../helpers/index.mjs';
|
|
2
2
|
import { type TObject, type ObjectOptions } from '../object/index.mjs';
|
|
3
3
|
import { type TIntersect } from '../intersect/index.mjs';
|
|
4
|
-
import {
|
|
4
|
+
import { type TIndex } from '../indexed/index.mjs';
|
|
5
5
|
type CompositeKeys<T extends TObject[]> = T extends [infer L extends TObject, ...infer R extends TObject[]] ? keyof L['properties'] | CompositeKeys<R> : never;
|
|
6
6
|
type CompositeIndex<T extends TIntersect<TObject[]>, K extends string[]> = K extends [infer L extends string, ...infer R extends string[]] ? {
|
|
7
|
-
[_ in L]:
|
|
7
|
+
[_ in L]: TIndex<T, [L]>;
|
|
8
8
|
} & CompositeIndex<T, R> : {};
|
|
9
9
|
type CompositeReduce<T extends TObject[]> = UnionToTuple<CompositeKeys<T>> extends infer K ? Evaluate<CompositeIndex<TIntersect<T>, Assert<K, string[]>>> : {};
|
|
10
10
|
export type CompositeResolve<T extends TObject[]> = TIntersect<T> extends TIntersect ? TObject<CompositeReduce<T>> : TObject<{}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TSchema } 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 MappedResultExtendsPropertyKeys<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 MappedResultExtendsPropertyKeys<K extends TProperties, U extends TSchema, L extends TSchema, R extends TSchema>(K: K, U: U, L: L, R: R): MappedResultExtendsPropertyKeys<K, U, L, R>;
|
|
9
|
+
type MappedResultExtendsProperties<K extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema> = (MappedResultExtendsPropertyKeys<K['properties'], U, L, R>);
|
|
10
|
+
declare function MappedResultExtendsProperties<K extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema>(K: K, U: U, L: L, R: R): MappedResultExtendsProperties<K, U, L, R>;
|
|
11
|
+
export type TExtendsMappedResultFromResult<T extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = MappedResultExtendsProperties<T, U, L, R>> = (TMappedResult<P>);
|
|
12
|
+
export declare function ExtendsMappedResultFromResult<T extends TMappedResult, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = MappedResultExtendsProperties<T, U, L, R>>(T: T, U: U, L: L, R: R): TMappedResult<P>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MappedResult } from '../mapped/index.mjs';
|
|
2
|
+
import { Extends } from './extends.mjs';
|
|
3
|
+
function MappedResultExtendsPropertyKeys(K, U, L, R) {
|
|
4
|
+
return globalThis.Object.getOwnPropertyNames(K).reduce((Acc, K2) => {
|
|
5
|
+
return { ...Acc, [K2]: Extends(K[K2], U, L, R) };
|
|
6
|
+
}, {});
|
|
7
|
+
}
|
|
8
|
+
function MappedResultExtendsProperties(K, U, L, R) {
|
|
9
|
+
return MappedResultExtendsPropertyKeys(K.properties, U, L, R);
|
|
10
|
+
}
|
|
11
|
+
export function ExtendsMappedResultFromResult(T, U, L, R) {
|
|
12
|
+
const P = MappedResultExtendsProperties(T, U, L, R);
|
|
13
|
+
return MappedResult(P);
|
|
14
|
+
}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import type { TSchema } from '../schema/index.mjs';
|
|
2
2
|
import type { TProperties } from '../object/index.mjs';
|
|
3
|
-
import {
|
|
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';
|
|
4
6
|
import { type TExtends } from './extends.mjs';
|
|
5
|
-
type
|
|
6
|
-
[
|
|
7
|
-
}
|
|
8
|
-
declare function
|
|
9
|
-
type
|
|
10
|
-
declare function
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
type MappedExtendsPropertyKey<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 MappedExtendsPropertyKey<K extends PropertyKey, U extends TSchema, L extends TSchema, R extends TSchema>(K: K, U: U, L: L, R: R): MappedExtendsPropertyKey<K, U, L, R>;
|
|
11
|
+
type MappedExtendsPropertyKeys<K extends PropertyKey[], U extends TSchema, L extends TSchema, R extends TSchema> = (K extends [infer LK extends PropertyKey, ...infer RK extends PropertyKey[]] ? MappedExtendsPropertyKey<LK, U, L, R> & MappedExtendsPropertyKeys<RK, U, L, R> : {});
|
|
12
|
+
declare function MappedExtendsPropertyKeys<K extends PropertyKey[], U extends TSchema, L extends TSchema, R extends TSchema>(K: [...K], U: U, L: L, R: R): MappedExtendsPropertyKeys<K, U, L, R>;
|
|
13
|
+
type MappedExtendsProperties<K extends TMappedKey, U extends TSchema, L extends TSchema, R extends TSchema> = (MappedExtendsPropertyKeys<K['keys'], U, L, R>);
|
|
14
|
+
declare function MappedExtendsProperties<K extends TMappedKey, U extends TSchema, L extends TSchema, R extends TSchema>(K: K, U: U, L: L, R: R): MappedExtendsProperties<K, U, L, R>;
|
|
15
|
+
export type TExtendsMappedResult<T extends TMappedKey, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = MappedExtendsProperties<T, U, L, R>> = (TMappedResult<P>);
|
|
16
|
+
export declare function ExtendsMappedResult<T extends TMappedKey, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = MappedExtendsProperties<T, U, L, R>>(T: T, U: U, L: L, R: R): TMappedResult<P>;
|
|
13
17
|
export {};
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { MappedResult } from '../mapped/index.mjs';
|
|
2
|
+
import { Literal } from '../literal/index.mjs';
|
|
2
3
|
import { Extends } from './extends.mjs';
|
|
3
|
-
function
|
|
4
|
-
return
|
|
5
|
-
|
|
6
|
-
}
|
|
4
|
+
function MappedExtendsPropertyKey(K, U, L, R) {
|
|
5
|
+
return {
|
|
6
|
+
[K]: Extends(Literal(K), U, L, R)
|
|
7
|
+
};
|
|
7
8
|
}
|
|
8
|
-
function
|
|
9
|
-
|
|
9
|
+
function MappedExtendsPropertyKeys(K, U, L, R) {
|
|
10
|
+
const [LK, ...RK] = K;
|
|
11
|
+
return (K.length > 0
|
|
12
|
+
? { ...MappedExtendsPropertyKey(LK, U, L, R), ...MappedExtendsPropertyKeys(RK, U, L, R) }
|
|
13
|
+
: {});
|
|
10
14
|
}
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
function MappedExtendsProperties(K, U, L, R) {
|
|
16
|
+
return MappedExtendsPropertyKeys(K.keys, U, L, R);
|
|
17
|
+
}
|
|
18
|
+
export function ExtendsMappedResult(T, U, L, R) {
|
|
19
|
+
const P = MappedExtendsProperties(T, U, L, R);
|
|
13
20
|
return MappedResult(P);
|
|
14
21
|
}
|
|
@@ -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 {
|
|
7
|
-
import {
|
|
6
|
+
import { type TExtendsMappedResult } from './extends-mapped-result.mjs';
|
|
7
|
+
import { type TExtendsMappedResultFromResult } from './extends-mapped-result-from-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): TExtendsMappedResultFromResult<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): TExtendsMappedResult<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 {};
|
|
@@ -2,8 +2,8 @@ import { TMappedKey as IsMappedKeyType, TMappedResult as IsMappedResultType } fr
|
|
|
2
2
|
import { Union } from '../union/index.mjs';
|
|
3
3
|
import { ExtendsCheck, ExtendsResult } from './extends-check.mjs';
|
|
4
4
|
import { CloneType } from '../clone/type.mjs';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { ExtendsMappedResult } from './extends-mapped-result.mjs';
|
|
6
|
+
import { ExtendsMappedResultFromResult } from './extends-mapped-result-from-result.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) ? CloneType(
|
|
15
|
-
IsMappedKeyType(L) ? CloneType(
|
|
14
|
+
return (IsMappedResultType(L) ? CloneType(ExtendsMappedResultFromResult(L, R, T, F), options) :
|
|
15
|
+
IsMappedKeyType(L) ? CloneType(ExtendsMappedResult(L, R, T, F), options) :
|
|
16
16
|
CloneType(ExtendsResolve(L, R, T, F), options));
|
|
17
17
|
}
|
|
@@ -14,7 +14,7 @@ import type { TFunction } from '../function/index.mjs';
|
|
|
14
14
|
import type { TInteger } from '../integer/index.mjs';
|
|
15
15
|
import type { TIntersect } from '../intersect/index.mjs';
|
|
16
16
|
import type { TIterator } from '../iterator/index.mjs';
|
|
17
|
-
import type { TLiteral } from '../literal/index.mjs';
|
|
17
|
+
import type { TLiteral, TLiteralValue } from '../literal/index.mjs';
|
|
18
18
|
import type { TMappedKey, TMappedResult } from '../mapped/index.mjs';
|
|
19
19
|
import type { TNever } from '../never/index.mjs';
|
|
20
20
|
import type { TNot } from '../not/index.mjs';
|
|
@@ -37,56 +37,57 @@ import type { TDate } from '../date/index.mjs';
|
|
|
37
37
|
import type { TThis } from '../recursive/index.mjs';
|
|
38
38
|
export declare class TypeGuardUnknownTypeError extends Error {
|
|
39
39
|
}
|
|
40
|
-
export declare function TReadonly<T extends TSchema>(
|
|
41
|
-
export declare function TOptional<T extends TSchema>(
|
|
42
|
-
export declare function TAny(
|
|
43
|
-
export declare function TArray(
|
|
44
|
-
export declare function TAsyncIterator(
|
|
45
|
-
export declare function TBigInt(
|
|
46
|
-
export declare function TBoolean(
|
|
47
|
-
export declare function TConstructor(
|
|
48
|
-
export declare function TDate(
|
|
49
|
-
export declare function TFunction(
|
|
50
|
-
export declare function TInteger(
|
|
51
|
-
export declare function TProperties(
|
|
52
|
-
export declare function TIntersect(
|
|
53
|
-
export declare function TIterator(
|
|
54
|
-
export declare function TKindOf<T extends string>(
|
|
40
|
+
export declare function TReadonly<T extends TSchema>(value: T): value is TReadonly<T>;
|
|
41
|
+
export declare function TOptional<T extends TSchema>(value: T): value is TOptional<T>;
|
|
42
|
+
export declare function TAny(value: unknown): value is TAny;
|
|
43
|
+
export declare function TArray(value: unknown): value is TArray;
|
|
44
|
+
export declare function TAsyncIterator(value: unknown): value is TAsyncIterator;
|
|
45
|
+
export declare function TBigInt(value: unknown): value is TBigInt;
|
|
46
|
+
export declare function TBoolean(value: unknown): value is TBoolean;
|
|
47
|
+
export declare function TConstructor(value: unknown): value is TConstructor;
|
|
48
|
+
export declare function TDate(value: unknown): value is TDate;
|
|
49
|
+
export declare function TFunction(value: unknown): value is TFunction;
|
|
50
|
+
export declare function TInteger(value: unknown): value is TInteger;
|
|
51
|
+
export declare function TProperties(value: unknown): value is TProperties;
|
|
52
|
+
export declare function TIntersect(value: unknown): value is TIntersect;
|
|
53
|
+
export declare function TIterator(value: unknown): value is TIterator;
|
|
54
|
+
export declare function TKindOf<T extends string>(value: unknown, kind: T): value is Record<PropertyKey, unknown> & {
|
|
55
55
|
[Kind]: T;
|
|
56
56
|
};
|
|
57
|
-
export declare function TLiteralString(
|
|
58
|
-
export declare function TLiteralNumber(
|
|
59
|
-
export declare function TLiteralBoolean(
|
|
60
|
-
export declare function TLiteral(
|
|
61
|
-
export declare function
|
|
62
|
-
export declare function
|
|
63
|
-
export declare function
|
|
64
|
-
export declare function
|
|
65
|
-
export declare function
|
|
66
|
-
export declare function
|
|
67
|
-
export declare function
|
|
68
|
-
export declare function
|
|
69
|
-
export declare function
|
|
70
|
-
export declare function
|
|
57
|
+
export declare function TLiteralString(value: unknown): value is TLiteral<string>;
|
|
58
|
+
export declare function TLiteralNumber(value: unknown): value is TLiteral<number>;
|
|
59
|
+
export declare function TLiteralBoolean(value: unknown): value is TLiteral<boolean>;
|
|
60
|
+
export declare function TLiteral(value: unknown): value is TLiteral;
|
|
61
|
+
export declare function TLiteralValue(value: unknown): value is TLiteralValue;
|
|
62
|
+
export declare function TMappedKey(value: unknown): value is TMappedKey;
|
|
63
|
+
export declare function TMappedResult(value: unknown): value is TMappedResult;
|
|
64
|
+
export declare function TNever(value: unknown): value is TNever;
|
|
65
|
+
export declare function TNot(value: unknown): value is TNot;
|
|
66
|
+
export declare function TNull(value: unknown): value is TNull;
|
|
67
|
+
export declare function TNumber(value: unknown): value is TNumber;
|
|
68
|
+
export declare function TObject(value: unknown): value is TObject;
|
|
69
|
+
export declare function TPromise(value: unknown): value is TPromise;
|
|
70
|
+
export declare function TRecord(value: unknown): value is TRecord;
|
|
71
|
+
export declare function TRecursive(value: unknown): value is {
|
|
71
72
|
[Hint]: 'Recursive';
|
|
72
73
|
};
|
|
73
|
-
export declare function TRef(
|
|
74
|
-
export declare function TString(
|
|
75
|
-
export declare function TSymbol(
|
|
76
|
-
export declare function TTemplateLiteral(
|
|
77
|
-
export declare function TThis(
|
|
78
|
-
export declare function TTransform(
|
|
74
|
+
export declare function TRef(value: unknown): value is TRef;
|
|
75
|
+
export declare function TString(value: unknown): value is TString;
|
|
76
|
+
export declare function TSymbol(value: unknown): value is TSymbol;
|
|
77
|
+
export declare function TTemplateLiteral(value: unknown): value is TTemplateLiteral<TTemplateLiteralKind[]>;
|
|
78
|
+
export declare function TThis(value: unknown): value is TThis;
|
|
79
|
+
export declare function TTransform(value: unknown): value is {
|
|
79
80
|
[TransformKind]: TransformOptions;
|
|
80
81
|
};
|
|
81
|
-
export declare function TTuple(
|
|
82
|
-
export declare function TUndefined(
|
|
83
|
-
export declare function TUnionLiteral(
|
|
84
|
-
export declare function TUnion(
|
|
85
|
-
export declare function TUint8Array(
|
|
86
|
-
export declare function TUnknown(
|
|
87
|
-
export declare function TUnsafe(
|
|
88
|
-
export declare function TVoid(
|
|
89
|
-
export declare function TKind(
|
|
82
|
+
export declare function TTuple(value: unknown): value is TTuple;
|
|
83
|
+
export declare function TUndefined(value: unknown): value is TUndefined;
|
|
84
|
+
export declare function TUnionLiteral(value: unknown): value is TUnion<TLiteral[]>;
|
|
85
|
+
export declare function TUnion(value: unknown): value is TUnion;
|
|
86
|
+
export declare function TUint8Array(value: unknown): value is TUint8Array;
|
|
87
|
+
export declare function TUnknown(value: unknown): value is TUnknown;
|
|
88
|
+
export declare function TUnsafe(value: unknown): value is TUnsafe<unknown>;
|
|
89
|
+
export declare function TVoid(value: unknown): value is TVoid;
|
|
90
|
+
export declare function TKind(value: unknown): value is Record<PropertyKey, unknown> & {
|
|
90
91
|
[Kind]: string;
|
|
91
92
|
};
|
|
92
|
-
export declare function TSchema(
|
|
93
|
+
export declare function TSchema(value: unknown): value is TSchema;
|