@sinclair/typebox 0.32.0-dev-26 → 0.32.0-dev-27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/import/index.d.mts +2 -2
- package/build/import/type/awaited/awaited.mjs +2 -6
- package/build/import/type/composite/composite.d.mts +1 -2
- package/build/import/type/composite/composite.mjs +2 -2
- package/build/import/type/const/const.mjs +6 -6
- package/build/import/type/constructor/constructor.d.mts +1 -1
- package/build/import/type/constructor/constructor.mjs +1 -1
- package/build/import/type/deref/deref.mjs +1 -2
- package/build/import/type/discard/discard.mjs +2 -2
- package/build/import/type/enum/enum.mjs +3 -0
- package/build/import/type/exclude/exclude-from-mapped-result.d.mts +5 -5
- package/build/import/type/exclude/exclude-from-mapped-result.mjs +7 -7
- package/build/import/type/exclude/exclude.mjs +0 -1
- package/build/import/type/extends/extends-from-mapped-key.d.mts +1 -1
- package/build/import/type/extends/extends-from-mapped-key.mjs +4 -5
- package/build/import/type/extends/extends-from-mapped-result.d.mts +5 -5
- package/build/import/type/extends/extends-from-mapped-result.mjs +7 -7
- package/build/import/type/extends/extends.mjs +0 -1
- package/build/import/type/extract/extract-from-mapped-result.d.mts +5 -5
- package/build/import/type/extract/extract-from-mapped-result.mjs +7 -7
- package/build/import/type/extract/extract.d.mts +1 -2
- package/build/import/type/extract/extract.mjs +4 -2
- package/build/import/type/index.d.mts +1 -1
- package/build/import/type/index.mjs +1 -1
- package/build/import/type/indexed/indexed-from-mapped-key.d.mts +2 -2
- package/build/import/type/indexed/indexed-from-mapped-key.mjs +4 -5
- package/build/import/type/indexed/indexed-from-mapped-result.d.mts +1 -1
- package/build/import/type/indexed/indexed-property-keys.d.mts +6 -6
- package/build/import/type/indexed/indexed-property-keys.mjs +3 -5
- package/build/import/type/indexed/indexed.d.mts +1 -1
- package/build/import/type/indexed/indexed.mjs +9 -27
- package/build/import/type/intersect/intersect-evaluated.mjs +3 -13
- package/build/import/type/intrinsic/capitalize.d.mts +2 -2
- package/build/import/type/intrinsic/intrinsic-from-mapped-key.d.mts +1 -1
- package/build/import/type/intrinsic/intrinsic-from-mapped-key.mjs +4 -5
- package/build/import/type/intrinsic/intrinsic.d.mts +2 -3
- package/build/import/type/intrinsic/intrinsic.mjs +2 -5
- package/build/import/type/intrinsic/lowercase.d.mts +2 -2
- package/build/import/type/intrinsic/uncapitalize.d.mts +2 -2
- package/build/import/type/intrinsic/uppercase.d.mts +2 -2
- package/build/import/type/iterator/iterator.mjs +1 -1
- package/build/import/type/keyof/keyof-from-mapped-result.d.mts +3 -3
- package/build/import/type/keyof/keyof-from-mapped-result.mjs +4 -4
- package/build/import/type/keyof/keyof-property-keys.d.mts +3 -3
- package/build/import/type/keyof/keyof-property-keys.mjs +9 -15
- package/build/import/type/keyof/keyof.mjs +2 -8
- package/build/import/type/mapped/mapped.d.mts +6 -1
- package/build/import/type/mapped/mapped.mjs +21 -14
- package/build/import/type/not/not.mjs +1 -1
- package/build/import/type/object/object.d.mts +1 -1
- package/build/import/type/object/object.mjs +0 -1
- 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-from-mapped-key.mjs +4 -5
- package/build/import/type/omit/omit-from-mapped-result.d.mts +11 -0
- package/build/import/type/omit/omit-from-mapped-result.mjs +17 -0
- package/build/import/type/omit/omit.d.mts +6 -3
- package/build/import/type/omit/omit.mjs +11 -9
- package/build/import/type/optional/optional-from-mapped-result.d.mts +5 -5
- package/build/import/type/optional/optional-from-mapped-result.mjs +7 -7
- package/build/import/type/partial/partial-from-mapped-result.d.mts +5 -5
- package/build/import/type/partial/partial-from-mapped-result.mjs +4 -4
- package/build/import/type/partial/partial.d.mts +2 -3
- package/build/import/type/partial/partial.mjs +8 -21
- 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-from-mapped-key.mjs +4 -5
- package/build/import/type/pick/pick-from-mapped-result.d.mts +11 -0
- package/build/import/type/pick/pick-from-mapped-result.mjs +17 -0
- package/build/import/type/pick/pick.d.mts +5 -2
- package/build/import/type/pick/pick.mjs +11 -10
- package/build/import/type/promise/promise.mjs +1 -1
- package/build/import/type/readonly/readonly-from-mapped-result.d.mts +5 -5
- package/build/import/type/readonly/readonly-from-mapped-result.mjs +4 -4
- package/build/import/type/record/record.d.mts +2 -2
- package/build/import/type/record/record.mjs +3 -0
- package/build/import/type/ref/ref.mjs +1 -1
- package/build/import/type/required/required-from-mapped-result.d.mts +5 -5
- package/build/import/type/required/required-from-mapped-result.mjs +7 -7
- package/build/import/type/required/required.d.mts +2 -3
- package/build/import/type/required/required.mjs +4 -14
- package/build/import/type/rest/rest.d.mts +2 -2
- package/build/import/type/rest/rest.mjs +1 -2
- package/build/import/type/sets/index.d.mts +1 -0
- package/build/import/type/sets/index.mjs +1 -0
- package/build/import/type/sets/set.d.mts +24 -0
- package/build/import/type/sets/set.mjs +35 -0
- package/build/import/type/strict/strict.d.mts +1 -1
- package/build/import/type/strict/strict.mjs +1 -1
- package/build/import/type/template-literal/syntax.d.mts +1 -1
- package/build/import/type/template-literal/template-literal.d.mts +1 -1
- package/build/import/type/transform/transform.mjs +1 -1
- package/build/import/type/type/json.d.mts +6 -2
- package/build/import/type/union/union-evaluated.mjs +3 -14
- package/build/require/index.d.ts +2 -2
- package/build/require/type/awaited/awaited.js +2 -6
- package/build/require/type/composite/composite.d.ts +1 -2
- package/build/require/type/composite/composite.js +5 -6
- package/build/require/type/const/const.js +6 -6
- package/build/require/type/constructor/constructor.d.ts +1 -1
- package/build/require/type/constructor/constructor.js +1 -1
- package/build/require/type/deref/deref.js +0 -1
- package/build/require/type/discard/discard.js +2 -2
- package/build/require/type/enum/enum.js +3 -0
- package/build/require/type/exclude/exclude-from-mapped-result.d.ts +5 -5
- package/build/require/type/exclude/exclude-from-mapped-result.js +7 -7
- package/build/require/type/exclude/exclude.js +0 -1
- package/build/require/type/extends/extends-from-mapped-key.d.ts +1 -1
- package/build/require/type/extends/extends-from-mapped-key.js +4 -5
- package/build/require/type/extends/extends-from-mapped-result.d.ts +5 -5
- package/build/require/type/extends/extends-from-mapped-result.js +7 -7
- package/build/require/type/extends/extends.js +0 -1
- package/build/require/type/extract/extract-from-mapped-result.d.ts +5 -5
- package/build/require/type/extract/extract-from-mapped-result.js +7 -7
- package/build/require/type/extract/extract.d.ts +1 -2
- package/build/require/type/extract/extract.js +4 -3
- package/build/require/type/index.d.ts +1 -1
- package/build/require/type/index.js +1 -1
- package/build/require/type/indexed/indexed-from-mapped-key.d.ts +2 -2
- package/build/require/type/indexed/indexed-from-mapped-key.js +4 -5
- package/build/require/type/indexed/indexed-from-mapped-result.d.ts +1 -1
- package/build/require/type/indexed/indexed-property-keys.d.ts +6 -6
- package/build/require/type/indexed/indexed-property-keys.js +3 -5
- package/build/require/type/indexed/indexed.d.ts +1 -1
- package/build/require/type/indexed/indexed.js +9 -27
- package/build/require/type/intersect/intersect-evaluated.js +3 -13
- package/build/require/type/intrinsic/capitalize.d.ts +2 -2
- package/build/require/type/intrinsic/intrinsic-from-mapped-key.d.ts +1 -1
- package/build/require/type/intrinsic/intrinsic-from-mapped-key.js +4 -5
- package/build/require/type/intrinsic/intrinsic.d.ts +2 -3
- package/build/require/type/intrinsic/intrinsic.js +2 -5
- package/build/require/type/intrinsic/lowercase.d.ts +2 -2
- package/build/require/type/intrinsic/uncapitalize.d.ts +2 -2
- package/build/require/type/intrinsic/uppercase.d.ts +2 -2
- package/build/require/type/iterator/iterator.js +1 -1
- package/build/require/type/keyof/keyof-from-mapped-result.d.ts +3 -3
- package/build/require/type/keyof/keyof-from-mapped-result.js +4 -4
- package/build/require/type/keyof/keyof-property-keys.d.ts +3 -3
- package/build/require/type/keyof/keyof-property-keys.js +9 -15
- package/build/require/type/keyof/keyof.js +2 -8
- package/build/require/type/mapped/mapped.d.ts +6 -1
- package/build/require/type/mapped/mapped.js +21 -14
- package/build/require/type/not/not.js +1 -1
- package/build/require/type/object/object.d.ts +1 -1
- package/build/require/type/object/object.js +0 -1
- 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-from-mapped-key.js +4 -5
- package/build/require/type/omit/omit-from-mapped-result.d.ts +11 -0
- package/build/require/type/omit/omit-from-mapped-result.js +22 -0
- package/build/require/type/omit/omit.d.ts +6 -3
- package/build/require/type/omit/omit.js +10 -8
- package/build/require/type/optional/optional-from-mapped-result.d.ts +5 -5
- package/build/require/type/optional/optional-from-mapped-result.js +7 -7
- package/build/require/type/partial/partial-from-mapped-result.d.ts +5 -5
- package/build/require/type/partial/partial-from-mapped-result.js +4 -4
- package/build/require/type/partial/partial.d.ts +2 -3
- package/build/require/type/partial/partial.js +8 -21
- 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-from-mapped-key.js +4 -5
- package/build/require/type/pick/pick-from-mapped-result.d.ts +11 -0
- package/build/require/type/pick/pick-from-mapped-result.js +22 -0
- package/build/require/type/pick/pick.d.ts +5 -2
- package/build/require/type/pick/pick.js +10 -9
- package/build/require/type/promise/promise.js +1 -1
- package/build/require/type/readonly/readonly-from-mapped-result.d.ts +5 -5
- package/build/require/type/readonly/readonly-from-mapped-result.js +4 -4
- package/build/require/type/record/record.d.ts +2 -2
- package/build/require/type/record/record.js +3 -0
- package/build/require/type/ref/ref.js +1 -1
- package/build/require/type/required/required-from-mapped-result.d.ts +5 -5
- package/build/require/type/required/required-from-mapped-result.js +7 -7
- package/build/require/type/required/required.d.ts +2 -3
- package/build/require/type/required/required.js +4 -14
- package/build/require/type/rest/rest.d.ts +2 -2
- package/build/require/type/rest/rest.js +1 -3
- package/build/require/type/sets/index.d.ts +1 -0
- package/build/require/type/{operators → sets}/index.js +1 -1
- package/build/require/type/sets/set.d.ts +24 -0
- package/build/require/type/sets/set.js +47 -0
- package/build/require/type/strict/strict.d.ts +1 -1
- package/build/require/type/strict/strict.js +1 -1
- package/build/require/type/template-literal/parse.js +1 -1
- package/build/require/type/template-literal/syntax.d.ts +1 -1
- package/build/require/type/template-literal/template-literal.d.ts +1 -1
- package/build/require/type/transform/transform.js +1 -1
- package/build/require/type/type/json.d.ts +6 -2
- package/build/require/type/union/union-evaluated.js +3 -14
- package/package.json +1 -1
- package/readme.md +64 -64
- package/build/import/type/operators/index.d.mts +0 -1
- package/build/import/type/operators/index.mjs +0 -1
- package/build/import/type/operators/operators.d.mts +0 -24
- package/build/import/type/operators/operators.mjs +0 -77
- package/build/require/type/operators/index.d.ts +0 -1
- package/build/require/type/operators/operators.d.ts +0 -24
- package/build/require/type/operators/operators.js +0 -89
|
@@ -2,10 +2,10 @@ import type { TSchema, SchemaOptions } from '../schema/index';
|
|
|
2
2
|
import type { TProperties } from '../object/index';
|
|
3
3
|
import { type TMappedResult } from '../mapped/index';
|
|
4
4
|
import { type TExclude } from './exclude';
|
|
5
|
-
type TFromProperties<K extends TProperties,
|
|
6
|
-
[K2 in keyof K]: TExclude<K[K2],
|
|
5
|
+
type TFromProperties<K extends TProperties, T extends TSchema> = ({
|
|
6
|
+
[K2 in keyof K]: TExclude<K[K2], T>;
|
|
7
7
|
});
|
|
8
|
-
type TFromMappedResult<
|
|
9
|
-
export type TExcludeFromMappedResult<
|
|
10
|
-
export declare function ExcludeFromMappedResult<
|
|
8
|
+
type TFromMappedResult<R extends TMappedResult, T extends TSchema> = (TFromProperties<R['properties'], T>);
|
|
9
|
+
export type TExcludeFromMappedResult<R extends TMappedResult, T extends TSchema, P extends TProperties = TFromMappedResult<R, T>> = (TMappedResult<P>);
|
|
10
|
+
export declare function ExcludeFromMappedResult<R extends TMappedResult, T extends TSchema, P extends TProperties = TFromMappedResult<R, T>>(R: R, T: T, options: SchemaOptions): TMappedResult<P>;
|
|
11
11
|
export {};
|
|
@@ -5,18 +5,18 @@ exports.ExcludeFromMappedResult = void 0;
|
|
|
5
5
|
const index_1 = require("../mapped/index");
|
|
6
6
|
const exclude_1 = require("./exclude");
|
|
7
7
|
// prettier-ignore
|
|
8
|
-
function FromProperties(
|
|
9
|
-
return globalThis.Object.getOwnPropertyNames(
|
|
10
|
-
return { ...Acc, [K2]: (0, exclude_1.Exclude)(
|
|
8
|
+
function FromProperties(P, U, options) {
|
|
9
|
+
return globalThis.Object.getOwnPropertyNames(P).reduce((Acc, K2) => {
|
|
10
|
+
return { ...Acc, [K2]: (0, exclude_1.Exclude)(P[K2], U, options) };
|
|
11
11
|
}, {});
|
|
12
12
|
}
|
|
13
13
|
// prettier-ignore
|
|
14
|
-
function FromMappedResult(
|
|
15
|
-
return FromProperties(
|
|
14
|
+
function FromMappedResult(R, T, options) {
|
|
15
|
+
return FromProperties(R.properties, T, options);
|
|
16
16
|
}
|
|
17
17
|
// prettier-ignore
|
|
18
|
-
function ExcludeFromMappedResult(
|
|
19
|
-
const P = FromMappedResult(
|
|
18
|
+
function ExcludeFromMappedResult(R, T, options) {
|
|
19
|
+
const P = FromMappedResult(R, T, options);
|
|
20
20
|
return (0, index_1.MappedResult)(P);
|
|
21
21
|
}
|
|
22
22
|
exports.ExcludeFromMappedResult = ExcludeFromMappedResult;
|
|
@@ -11,7 +11,6 @@ const exclude_from_mapped_result_1 = require("./exclude-from-mapped-result");
|
|
|
11
11
|
// ------------------------------------------------------------------
|
|
12
12
|
// TypeGuard
|
|
13
13
|
// ------------------------------------------------------------------
|
|
14
|
-
// prettier-ignore
|
|
15
14
|
const type_2 = require("../guard/type");
|
|
16
15
|
// prettier-ignore
|
|
17
16
|
function ExcludeResolve(L, R) {
|
|
@@ -2,7 +2,7 @@ import type { TSchema, SchemaOptions } from '../schema/index';
|
|
|
2
2
|
import type { TProperties } from '../object/index';
|
|
3
3
|
import type { Assert } from '../helpers/index';
|
|
4
4
|
import { type TMappedResult, type TMappedKey } from '../mapped/index';
|
|
5
|
-
import { TLiteral, TLiteralValue } from '../literal/index';
|
|
5
|
+
import { type TLiteral, type TLiteralValue } from '../literal/index';
|
|
6
6
|
import { type TExtends } from './extends';
|
|
7
7
|
type TFromPropertyKey<K extends PropertyKey, U extends TSchema, L extends TSchema, R extends TSchema> = {
|
|
8
8
|
[_ in K]: TExtends<TLiteral<Assert<K, TLiteralValue>>, U, L, R>;
|
|
@@ -12,11 +12,10 @@ function FromPropertyKey(K, U, L, R, options) {
|
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
// prettier-ignore
|
|
15
|
-
function FromPropertyKeys(K, U, L, R, options
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
: Acc);
|
|
15
|
+
function FromPropertyKeys(K, U, L, R, options) {
|
|
16
|
+
return K.reduce((Acc, LK) => {
|
|
17
|
+
return { ...Acc, ...FromPropertyKey(LK, U, L, R, options) };
|
|
18
|
+
}, {});
|
|
20
19
|
}
|
|
21
20
|
// prettier-ignore
|
|
22
21
|
function FromMappedKey(K, U, L, R, options) {
|
|
@@ -2,10 +2,10 @@ import type { TSchema, SchemaOptions } from '../schema/index';
|
|
|
2
2
|
import type { TProperties } from '../object/index';
|
|
3
3
|
import { type TMappedResult } from '../mapped/index';
|
|
4
4
|
import { type TExtends } from './extends';
|
|
5
|
-
type TFromProperties<
|
|
6
|
-
[K2 in keyof
|
|
5
|
+
type TFromProperties<P extends TProperties, Right extends TSchema, False extends TSchema, True extends TSchema> = ({
|
|
6
|
+
[K2 in keyof P]: TExtends<P[K2], Right, False, True>;
|
|
7
7
|
});
|
|
8
|
-
type TFromMappedResult<
|
|
9
|
-
export type TExtendsFromMappedResult<
|
|
10
|
-
export declare function ExtendsFromMappedResult<
|
|
8
|
+
type TFromMappedResult<Left extends TMappedResult, Right extends TSchema, True extends TSchema, False extends TSchema> = (TFromProperties<Left['properties'], Right, True, False>);
|
|
9
|
+
export type TExtendsFromMappedResult<Left extends TMappedResult, Right extends TSchema, True extends TSchema, False extends TSchema, P extends TProperties = TFromMappedResult<Left, Right, True, False>> = (TMappedResult<P>);
|
|
10
|
+
export declare function ExtendsFromMappedResult<Left extends TMappedResult, Right extends TSchema, True extends TSchema, False extends TSchema, P extends TProperties = TFromMappedResult<Left, Right, True, False>>(Left: Left, Right: Right, True: True, False: False, options: SchemaOptions): TMappedResult<P>;
|
|
11
11
|
export {};
|
|
@@ -5,18 +5,18 @@ exports.ExtendsFromMappedResult = void 0;
|
|
|
5
5
|
const index_1 = require("../mapped/index");
|
|
6
6
|
const extends_1 = require("./extends");
|
|
7
7
|
// prettier-ignore
|
|
8
|
-
function FromProperties(
|
|
9
|
-
return globalThis.Object.getOwnPropertyNames(
|
|
10
|
-
return { ...Acc, [K2]: (0, extends_1.Extends)(
|
|
8
|
+
function FromProperties(P, Right, True, False, options) {
|
|
9
|
+
return globalThis.Object.getOwnPropertyNames(P).reduce((Acc, K2) => {
|
|
10
|
+
return { ...Acc, [K2]: (0, extends_1.Extends)(P[K2], Right, True, False, options) };
|
|
11
11
|
}, {});
|
|
12
12
|
}
|
|
13
13
|
// prettier-ignore
|
|
14
|
-
function FromMappedResult(
|
|
15
|
-
return FromProperties(
|
|
14
|
+
function FromMappedResult(Left, Right, True, False, options) {
|
|
15
|
+
return FromProperties(Left.properties, Right, True, False, options);
|
|
16
16
|
}
|
|
17
17
|
// prettier-ignore
|
|
18
|
-
function ExtendsFromMappedResult(
|
|
19
|
-
const P = FromMappedResult(
|
|
18
|
+
function ExtendsFromMappedResult(Left, Right, True, False, options) {
|
|
19
|
+
const P = FromMappedResult(Left, Right, True, False, options);
|
|
20
20
|
return (0, index_1.MappedResult)(P);
|
|
21
21
|
}
|
|
22
22
|
exports.ExtendsFromMappedResult = ExtendsFromMappedResult;
|
|
@@ -10,7 +10,6 @@ const extends_from_mapped_result_1 = require("./extends-from-mapped-result");
|
|
|
10
10
|
// ------------------------------------------------------------------
|
|
11
11
|
// TypeGuard
|
|
12
12
|
// ------------------------------------------------------------------
|
|
13
|
-
// prettier-ignore
|
|
14
13
|
const type_2 = require("../guard/type");
|
|
15
14
|
// prettier-ignore
|
|
16
15
|
function ExtendsResolve(left, right, trueType, falseType) {
|
|
@@ -2,10 +2,10 @@ import type { TSchema, SchemaOptions } from '../schema/index';
|
|
|
2
2
|
import type { TProperties } from '../object/index';
|
|
3
3
|
import { type TMappedResult } from '../mapped/index';
|
|
4
4
|
import { type TExtract } from './extract';
|
|
5
|
-
type TFromProperties<
|
|
6
|
-
[K2 in keyof
|
|
5
|
+
type TFromProperties<P extends TProperties, T extends TSchema> = ({
|
|
6
|
+
[K2 in keyof P]: TExtract<P[K2], T>;
|
|
7
7
|
});
|
|
8
|
-
type TFromMappedResult<
|
|
9
|
-
export type TExtractFromMappedResult<
|
|
10
|
-
export declare function ExtractFromMappedResult<
|
|
8
|
+
type TFromMappedResult<R extends TMappedResult, T extends TSchema> = (TFromProperties<R['properties'], T>);
|
|
9
|
+
export type TExtractFromMappedResult<R extends TMappedResult, T extends TSchema, P extends TProperties = TFromMappedResult<R, T>> = (TMappedResult<P>);
|
|
10
|
+
export declare function ExtractFromMappedResult<R extends TMappedResult, T extends TSchema, P extends TProperties = TFromMappedResult<R, T>>(R: R, T: T, options: SchemaOptions): TMappedResult<P>;
|
|
11
11
|
export {};
|
|
@@ -5,18 +5,18 @@ exports.ExtractFromMappedResult = void 0;
|
|
|
5
5
|
const index_1 = require("../mapped/index");
|
|
6
6
|
const extract_1 = require("./extract");
|
|
7
7
|
// prettier-ignore
|
|
8
|
-
function FromProperties(
|
|
9
|
-
return globalThis.Object.getOwnPropertyNames(
|
|
10
|
-
return { ...Acc, [K2]: (0, extract_1.Extract)(
|
|
8
|
+
function FromProperties(P, T, options) {
|
|
9
|
+
return globalThis.Object.getOwnPropertyNames(P).reduce((Acc, K2) => {
|
|
10
|
+
return { ...Acc, [K2]: (0, extract_1.Extract)(P[K2], T, options) };
|
|
11
11
|
}, {});
|
|
12
12
|
}
|
|
13
13
|
// prettier-ignore
|
|
14
|
-
function FromMappedResult(
|
|
15
|
-
return FromProperties(
|
|
14
|
+
function FromMappedResult(R, T, options) {
|
|
15
|
+
return FromProperties(R.properties, T, options);
|
|
16
16
|
}
|
|
17
17
|
// prettier-ignore
|
|
18
|
-
function ExtractFromMappedResult(
|
|
19
|
-
const P = FromMappedResult(
|
|
18
|
+
function ExtractFromMappedResult(R, T, options) {
|
|
19
|
+
const P = FromMappedResult(R, T, options);
|
|
20
20
|
return (0, index_1.MappedResult)(P);
|
|
21
21
|
}
|
|
22
22
|
exports.ExtractFromMappedResult = ExtractFromMappedResult;
|
|
@@ -14,8 +14,7 @@ type TFromTemplateLiteral<T extends TTemplateLiteral, U extends TSchema> = Extra
|
|
|
14
14
|
type TFromArray<T extends TSchema[], U extends TSchema> = AssertRest<UnionToTuple<{
|
|
15
15
|
[K in keyof T]: Static<AssertType<T[K]>> extends Static<U> ? T[K] : never;
|
|
16
16
|
}[number]>> extends infer R extends TSchema[] ? TUnionEvaluated<R> : never;
|
|
17
|
-
|
|
18
|
-
export declare function ExtractResolve<L extends TSchema, R extends TSchema>(L: L, R: R): TExtractResolve<L, R>;
|
|
17
|
+
type TExtractResolve<T extends TSchema, U extends TSchema> = (T extends TTemplateLiteral ? TFromTemplateLiteral<T, U> : T extends TUnion<infer S> ? TFromArray<S, U> : T);
|
|
19
18
|
export type TExtract<T extends TSchema, U extends TSchema> = TExtractResolve<T, U>;
|
|
20
19
|
/** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */
|
|
21
20
|
export declare function Extract<L extends TMappedResult, R extends TSchema>(type: L, union: R, options?: SchemaOptions): TExtractFromMappedResult<L, R>;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Extract =
|
|
4
|
+
exports.Extract = void 0;
|
|
5
5
|
const index_1 = require("../template-literal/index");
|
|
6
6
|
const index_2 = require("../union/index");
|
|
7
7
|
const index_3 = require("../never/index");
|
|
8
8
|
const index_4 = require("../extends/index");
|
|
9
9
|
const type_1 = require("../clone/type");
|
|
10
10
|
const extract_from_mapped_result_1 = require("./extract-from-mapped-result");
|
|
11
|
-
//
|
|
11
|
+
// ------------------------------------------------------------------
|
|
12
|
+
// TypeGuard
|
|
13
|
+
// ------------------------------------------------------------------
|
|
12
14
|
const type_2 = require("../guard/type");
|
|
13
15
|
// prettier-ignore
|
|
14
16
|
function ExtractResolve(L, R) {
|
|
@@ -21,7 +23,6 @@ function ExtractResolve(L, R) {
|
|
|
21
23
|
(0, index_4.ExtendsCheck)(L, R) !== index_4.ExtendsResult.False ? L :
|
|
22
24
|
(0, index_3.Never)());
|
|
23
25
|
}
|
|
24
|
-
exports.ExtractResolve = ExtractResolve;
|
|
25
26
|
/** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */
|
|
26
27
|
function Extract(type, union, options = {}) {
|
|
27
28
|
if ((0, type_2.IsMappedResult)(type)) {
|
|
@@ -35,7 +35,6 @@ export * from './null/index';
|
|
|
35
35
|
export * from './number/index';
|
|
36
36
|
export * from './object/index';
|
|
37
37
|
export * from './omit/index';
|
|
38
|
-
export * from './operators/index';
|
|
39
38
|
export * from './optional/index';
|
|
40
39
|
export * from './parameters/index';
|
|
41
40
|
export * from './partial/index';
|
|
@@ -53,6 +52,7 @@ export * from './required/index';
|
|
|
53
52
|
export * from './rest/index';
|
|
54
53
|
export * from './return-type/index';
|
|
55
54
|
export * from './schema/index';
|
|
55
|
+
export * from './sets/index';
|
|
56
56
|
export * from './static/index';
|
|
57
57
|
export * from './strict/index';
|
|
58
58
|
export * from './string/index';
|
|
@@ -52,7 +52,6 @@ __exportStar(require("./null/index"), exports);
|
|
|
52
52
|
__exportStar(require("./number/index"), exports);
|
|
53
53
|
__exportStar(require("./object/index"), exports);
|
|
54
54
|
__exportStar(require("./omit/index"), exports);
|
|
55
|
-
__exportStar(require("./operators/index"), exports);
|
|
56
55
|
__exportStar(require("./optional/index"), exports);
|
|
57
56
|
__exportStar(require("./parameters/index"), exports);
|
|
58
57
|
__exportStar(require("./partial/index"), exports);
|
|
@@ -70,6 +69,7 @@ __exportStar(require("./required/index"), exports);
|
|
|
70
69
|
__exportStar(require("./rest/index"), exports);
|
|
71
70
|
__exportStar(require("./return-type/index"), exports);
|
|
72
71
|
__exportStar(require("./schema/index"), exports);
|
|
72
|
+
__exportStar(require("./sets/index"), exports);
|
|
73
73
|
__exportStar(require("./static/index"), exports);
|
|
74
74
|
__exportStar(require("./strict/index"), exports);
|
|
75
75
|
__exportStar(require("./string/index"), exports);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { TSchema, SchemaOptions } from '../schema/index';
|
|
2
|
-
import {
|
|
2
|
+
import type { Evaluate } from '../helpers/index';
|
|
3
|
+
import type { TProperties } from '../object/index';
|
|
3
4
|
import { type TIndex } from './indexed';
|
|
4
5
|
import { type TMappedResult, type TMappedKey } from '../mapped/index';
|
|
5
|
-
import { Evaluate } from '../helpers/index';
|
|
6
6
|
type TMappedIndexPropertyKey<T extends TSchema, K extends PropertyKey> = {
|
|
7
7
|
[_ in K]: TIndex<T, [K]>;
|
|
8
8
|
};
|
|
@@ -9,11 +9,10 @@ function MappedIndexPropertyKey(T, K, options) {
|
|
|
9
9
|
return { [K]: (0, indexed_1.Index)(T, [K], options) };
|
|
10
10
|
}
|
|
11
11
|
// prettier-ignore
|
|
12
|
-
function MappedIndexPropertyKeys(T, K, options
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
: Acc);
|
|
12
|
+
function MappedIndexPropertyKeys(T, K, options) {
|
|
13
|
+
return K.reduce((Acc, L) => {
|
|
14
|
+
return { ...Acc, ...MappedIndexPropertyKey(T, L, options) };
|
|
15
|
+
}, {});
|
|
17
16
|
}
|
|
18
17
|
// prettier-ignore
|
|
19
18
|
function MappedIndexProperties(T, K, options) {
|
|
@@ -6,7 +6,7 @@ import { type TIndex } from './index';
|
|
|
6
6
|
type TFromProperties<T extends TSchema, P extends TProperties> = ({
|
|
7
7
|
[K2 in keyof P]: TIndex<T, TIndexPropertyKeys<P[K2]>>;
|
|
8
8
|
});
|
|
9
|
-
type TFromMappedResult<T extends TSchema,
|
|
9
|
+
type TFromMappedResult<T extends TSchema, R extends TMappedResult> = (TFromProperties<T, R['properties']>);
|
|
10
10
|
export type TIndexFromMappedResult<T extends TSchema, R extends TMappedResult, P extends TProperties = TFromMappedResult<T, R>> = (TMappedResult<P>);
|
|
11
11
|
export declare function IndexFromMappedResult<T extends TSchema, R extends TMappedResult, P extends TProperties = TFromMappedResult<T, R>>(T: T, R: R, options: SchemaOptions): TMappedResult<P>;
|
|
12
12
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { type TTemplateLiteralGenerate, type TTemplateLiteral } from '../template-literal/index';
|
|
2
|
+
import type { TLiteral, TLiteralValue } from '../literal/index';
|
|
3
|
+
import type { TInteger } from '../integer/index';
|
|
4
|
+
import type { TNumber } from '../number/index';
|
|
5
|
+
import type { TSchema } from '../schema/index';
|
|
6
|
+
import type { TUnion } from '../union/index';
|
|
7
7
|
type TFromTemplateLiteral<T extends TTemplateLiteral, R extends string[] = TTemplateLiteralGenerate<T>> = (R);
|
|
8
8
|
type TFromUnion<T extends TSchema[], Acc extends string[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromUnion<R, [...TIndexPropertyKeys<L>, ...Acc]> : Acc);
|
|
9
9
|
type TFromLiteral<T extends TLiteralValue> = (T extends PropertyKey ? [`${T}`] : []);
|
|
@@ -6,7 +6,6 @@ const index_1 = require("../template-literal/index");
|
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
7
|
// TypeGuard
|
|
8
8
|
// ------------------------------------------------------------------
|
|
9
|
-
// prettier-ignore
|
|
10
9
|
const type_1 = require("../guard/type");
|
|
11
10
|
// prettier-ignore
|
|
12
11
|
function FromTemplateLiteral(T) {
|
|
@@ -15,10 +14,9 @@ function FromTemplateLiteral(T) {
|
|
|
15
14
|
}
|
|
16
15
|
// prettier-ignore
|
|
17
16
|
function FromUnion(T) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
: []);
|
|
17
|
+
return T.reduce((Acc, L) => {
|
|
18
|
+
return [...Acc, ...IndexPropertyKeys(L)];
|
|
19
|
+
}, []);
|
|
22
20
|
}
|
|
23
21
|
// prettier-ignore
|
|
24
22
|
function FromLiteral(T) {
|
|
@@ -16,7 +16,7 @@ import { type TIndexFromMappedResult } from './indexed-from-mapped-result';
|
|
|
16
16
|
type TFromRest<T extends TSchema[], K extends PropertyKey, Acc extends TSchema[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest<R, K, [...Acc, Assert<TFromKey<L, K>, TSchema>]> : Acc);
|
|
17
17
|
type TFromIntersectRest<T extends TSchema[], Acc extends TSchema[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? L extends TNever ? TFromIntersectRest<R, [...Acc]> : TFromIntersectRest<R, [...Acc, L]> : Acc);
|
|
18
18
|
type TFromIntersect<T extends TSchema[], K extends PropertyKey> = (TIntersectEvaluated<TFromIntersectRest<TFromRest<T, K>>>);
|
|
19
|
-
type TFromUnionRest<T extends TSchema[]
|
|
19
|
+
type TFromUnionRest<T extends TSchema[]> = T;
|
|
20
20
|
type TFromUnion<T extends TSchema[], K extends PropertyKey> = (TUnionEvaluated<TFromUnionRest<TFromRest<T, K>>>);
|
|
21
21
|
type TFromTuple<T extends TSchema[], K extends PropertyKey> = (K extends keyof T ? T[K] : K extends '[number]' ? TUnionEvaluated<T> : TNever);
|
|
22
22
|
type TFromArray<T extends TSchema, K extends PropertyKey> = (K extends '[number]' ? T : TNever);
|
|
@@ -14,33 +14,20 @@ const indexed_from_mapped_result_1 = require("./indexed-from-mapped-result");
|
|
|
14
14
|
// ------------------------------------------------------------------
|
|
15
15
|
const type_2 = require("../guard/type");
|
|
16
16
|
// prettier-ignore
|
|
17
|
-
function FromRest(T, K
|
|
18
|
-
|
|
19
|
-
return (T.length > 0
|
|
20
|
-
? FromRest(R, K, [...Acc, FromKey(L, K)])
|
|
21
|
-
: Acc);
|
|
17
|
+
function FromRest(T, K) {
|
|
18
|
+
return T.map(L => FromKey(L, K));
|
|
22
19
|
}
|
|
23
20
|
// prettier-ignore
|
|
24
|
-
function FromIntersectRest(T
|
|
25
|
-
|
|
26
|
-
return (T.length > 0
|
|
27
|
-
? (0, type_2.IsNever)(L)
|
|
28
|
-
? FromIntersectRest(R, [...Acc])
|
|
29
|
-
: FromIntersectRest(R, [...Acc, L])
|
|
30
|
-
: Acc);
|
|
21
|
+
function FromIntersectRest(T) {
|
|
22
|
+
return T.filter(L => !(0, type_2.IsNever)(L));
|
|
31
23
|
}
|
|
32
24
|
// prettier-ignore
|
|
33
25
|
function FromIntersect(T, K) {
|
|
34
26
|
return ((0, index_2.IntersectEvaluated)(FromIntersectRest(FromRest(T, K))));
|
|
35
27
|
}
|
|
36
28
|
// prettier-ignore
|
|
37
|
-
function FromUnionRest(T
|
|
38
|
-
|
|
39
|
-
return (T.length > 0
|
|
40
|
-
? (0, type_2.IsNever)(L)
|
|
41
|
-
? []
|
|
42
|
-
: FromUnionRest(R, Acc)
|
|
43
|
-
: Acc);
|
|
29
|
+
function FromUnionRest(T) {
|
|
30
|
+
return T; // review this
|
|
44
31
|
}
|
|
45
32
|
// prettier-ignore
|
|
46
33
|
function FromUnion(T, K) {
|
|
@@ -60,9 +47,7 @@ function FromArray(T, K) {
|
|
|
60
47
|
}
|
|
61
48
|
// prettier-ignore
|
|
62
49
|
function FromProperty(T, K) {
|
|
63
|
-
return (K in T
|
|
64
|
-
? T[K]
|
|
65
|
-
: (0, index_1.Never)());
|
|
50
|
+
return (K in T ? T[K] : (0, index_1.Never)());
|
|
66
51
|
}
|
|
67
52
|
// prettier-ignore
|
|
68
53
|
function FromKey(T, K) {
|
|
@@ -74,11 +59,8 @@ function FromKey(T, K) {
|
|
|
74
59
|
(0, index_1.Never)());
|
|
75
60
|
}
|
|
76
61
|
// prettier-ignore
|
|
77
|
-
function FromKeys(T, K
|
|
78
|
-
|
|
79
|
-
return (K.length > 0
|
|
80
|
-
? FromKeys(T, R, [...Acc, FromKey(T, L)])
|
|
81
|
-
: Acc);
|
|
62
|
+
function FromKeys(T, K) {
|
|
63
|
+
return K.map(L => FromKey(T, L));
|
|
82
64
|
}
|
|
83
65
|
// prettier-ignore
|
|
84
66
|
function FromSchema(T, K) {
|
|
@@ -15,25 +15,15 @@ const intersect_create_1 = require("./intersect-create");
|
|
|
15
15
|
const type_2 = require("../guard/type");
|
|
16
16
|
// prettier-ignore
|
|
17
17
|
function IsIntersectOptional(T) {
|
|
18
|
-
|
|
19
|
-
return (T.length > 0
|
|
20
|
-
? (0, type_2.IsOptional)(L)
|
|
21
|
-
? IsIntersectOptional(R)
|
|
22
|
-
: false
|
|
23
|
-
: true);
|
|
18
|
+
return T.every(L => (0, type_2.IsOptional)(L));
|
|
24
19
|
}
|
|
25
20
|
// prettier-ignore
|
|
26
21
|
function RemoveOptionalFromType(T) {
|
|
27
22
|
return ((0, index_2.Discard)(T, [index_1.OptionalKind]));
|
|
28
23
|
}
|
|
29
24
|
// prettier-ignore
|
|
30
|
-
function RemoveOptionalFromRest(T
|
|
31
|
-
|
|
32
|
-
return (T.length > 0
|
|
33
|
-
? (0, type_2.IsOptional)(L)
|
|
34
|
-
? RemoveOptionalFromRest(R, [...Acc, RemoveOptionalFromType(L)])
|
|
35
|
-
: RemoveOptionalFromRest(R, [...Acc, L])
|
|
36
|
-
: Acc);
|
|
25
|
+
function RemoveOptionalFromRest(T) {
|
|
26
|
+
return T.map(L => (0, type_2.IsOptional)(L) ? RemoveOptionalFromType(L) : L);
|
|
37
27
|
}
|
|
38
28
|
// prettier-ignore
|
|
39
29
|
function ResolveIntersect(T, options) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TSchema, SchemaOptions } from '../schema/index';
|
|
2
|
-
import { TIntrinsic } from './intrinsic';
|
|
1
|
+
import type { TSchema, SchemaOptions } from '../schema/index';
|
|
2
|
+
import { type TIntrinsic } from './intrinsic';
|
|
3
3
|
export type TCapitalize<T extends TSchema> = TIntrinsic<T, 'Capitalize'>;
|
|
4
4
|
/** `[Json]` Intrinsic function to Capitalize LiteralString types */
|
|
5
5
|
export declare function Capitalize<T extends TSchema>(T: T, options?: SchemaOptions): TCapitalize<T>;
|
|
@@ -3,7 +3,7 @@ import type { TProperties } from '../object/index';
|
|
|
3
3
|
import { Assert } from '../helpers/index';
|
|
4
4
|
import { type TMappedResult, type TMappedKey } from '../mapped/index';
|
|
5
5
|
import { type TIntrinsic, type IntrinsicMode } from './intrinsic';
|
|
6
|
-
import { TLiteral, TLiteralValue } from '../literal/index';
|
|
6
|
+
import { type TLiteral, type TLiteralValue } from '../literal/index';
|
|
7
7
|
type TMappedIntrinsicPropertyKey<K extends PropertyKey, M extends IntrinsicMode> = {
|
|
8
8
|
[_ in K]: TIntrinsic<TLiteral<Assert<K, TLiteralValue>>, M>;
|
|
9
9
|
};
|
|
@@ -12,11 +12,10 @@ function MappedIntrinsicPropertyKey(K, M, options) {
|
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
// prettier-ignore
|
|
15
|
-
function MappedIntrinsicPropertyKeys(K, M, options
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
: Acc);
|
|
15
|
+
function MappedIntrinsicPropertyKeys(K, M, options) {
|
|
16
|
+
return K.reduce((Acc, L) => {
|
|
17
|
+
return { ...Acc, ...MappedIntrinsicPropertyKey(L, M, options) };
|
|
18
|
+
}, {});
|
|
20
19
|
}
|
|
21
20
|
// prettier-ignore
|
|
22
21
|
function MappedIntrinsicProperties(T, M, options) {
|
|
@@ -7,9 +7,8 @@ import { type TMappedKey } from '../mapped/index';
|
|
|
7
7
|
export type IntrinsicMode = 'Uppercase' | 'Lowercase' | 'Capitalize' | 'Uncapitalize';
|
|
8
8
|
type TFromTemplateLiteral<T extends TTemplateLiteralKind[], M extends IntrinsicMode> = M extends IntrinsicMode ? T extends [infer L extends TTemplateLiteralKind, ...infer R extends TTemplateLiteralKind[]] ? [TIntrinsic<L, M>, ...TFromTemplateLiteral<R, M>] : T : T;
|
|
9
9
|
type TFromLiteralValue<T, M extends IntrinsicMode> = (T extends string ? M extends 'Uncapitalize' ? Uncapitalize<T> : M extends 'Capitalize' ? Capitalize<T> : M extends 'Uppercase' ? Uppercase<T> : M extends 'Lowercase' ? Lowercase<T> : string : T);
|
|
10
|
-
type
|
|
11
|
-
|
|
12
|
-
export type TIntrinsic<T extends TSchema, M extends IntrinsicMode> = T extends TMappedKey ? TIntrinsicFromMappedKey<T, M> : T extends TTemplateLiteral<infer S> ? TTemplateLiteral<TFromTemplateLiteral<S, M>> : T extends TUnion<infer S> ? TUnion<FromRest<S, M>> : T extends TLiteral<infer S> ? TLiteral<TFromLiteralValue<S, M>> : T;
|
|
10
|
+
type TFromRest<T extends TSchema[], M extends IntrinsicMode, Acc extends TSchema[] = []> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest<R, M, [...Acc, TIntrinsic<L, M>]> : Acc;
|
|
11
|
+
export type TIntrinsic<T extends TSchema, M extends IntrinsicMode> = T extends TMappedKey ? TIntrinsicFromMappedKey<T, M> : T extends TTemplateLiteral<infer S> ? TTemplateLiteral<TFromTemplateLiteral<S, M>> : T extends TUnion<infer S> ? TUnion<TFromRest<S, M>> : T extends TLiteral<infer S> ? TLiteral<TFromLiteralValue<S, M>> : T;
|
|
13
12
|
/** Applies an intrinsic string manipulation to the given type. */
|
|
14
13
|
export declare function Intrinsic<T extends TMappedKey, M extends IntrinsicMode>(schema: T, mode: M, options?: SchemaOptions): TIntrinsicFromMappedKey<T, M>;
|
|
15
14
|
/** Applies an intrinsic string manipulation to the given type. */
|
|
@@ -49,11 +49,8 @@ function FromLiteralValue(value, mode) {
|
|
|
49
49
|
value) : value.toString());
|
|
50
50
|
}
|
|
51
51
|
// prettier-ignore
|
|
52
|
-
function FromRest(T, M
|
|
53
|
-
|
|
54
|
-
return (T.length > 0
|
|
55
|
-
? FromRest(R, M, [...Acc, Intrinsic(L, M)])
|
|
56
|
-
: Acc);
|
|
52
|
+
function FromRest(T, M) {
|
|
53
|
+
return T.map(L => Intrinsic(L, M));
|
|
57
54
|
}
|
|
58
55
|
/** Applies an intrinsic string manipulation to the given type. */
|
|
59
56
|
function Intrinsic(schema, mode, options = {}) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TSchema, SchemaOptions } from '../schema/index';
|
|
2
|
-
import { TIntrinsic } from './intrinsic';
|
|
1
|
+
import type { TSchema, SchemaOptions } from '../schema/index';
|
|
2
|
+
import { type TIntrinsic } from './intrinsic';
|
|
3
3
|
export type TLowercase<T extends TSchema> = TIntrinsic<T, 'Lowercase'>;
|
|
4
4
|
/** `[Json]` Intrinsic function to Lowercase LiteralString types */
|
|
5
5
|
export declare function Lowercase<T extends TSchema>(T: T, options?: SchemaOptions): TLowercase<T>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TSchema, SchemaOptions } from '../schema/index';
|
|
2
|
-
import { TIntrinsic } from './intrinsic';
|
|
1
|
+
import type { TSchema, SchemaOptions } from '../schema/index';
|
|
2
|
+
import { type TIntrinsic } from './intrinsic';
|
|
3
3
|
export type TUncapitalize<T extends TSchema> = TIntrinsic<T, 'Uncapitalize'>;
|
|
4
4
|
/** `[Json]` Intrinsic function to Uncapitalize LiteralString types */
|
|
5
5
|
export declare function Uncapitalize<T extends TSchema>(T: T, options?: SchemaOptions): TUncapitalize<T>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TSchema, SchemaOptions } from '../schema/index';
|
|
2
|
-
import { TIntrinsic } from './intrinsic';
|
|
1
|
+
import type { TSchema, SchemaOptions } from '../schema/index';
|
|
2
|
+
import { type TIntrinsic } from './intrinsic';
|
|
3
3
|
export type TUppercase<T extends TSchema> = TIntrinsic<T, 'Uppercase'>;
|
|
4
4
|
/** `[Json]` Intrinsic function to Uppercase LiteralString types */
|
|
5
5
|
export declare function Uppercase<T extends TSchema>(T: T, options?: SchemaOptions): TUppercase<T>;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.Iterator = void 0;
|
|
5
|
-
const index_1 = require("../symbols/index");
|
|
6
5
|
const type_1 = require("../clone/type");
|
|
6
|
+
const index_1 = require("../symbols/index");
|
|
7
7
|
/** `[JavaScript]` Creates an Iterator type */
|
|
8
8
|
function Iterator(items, options = {}) {
|
|
9
9
|
return {
|
|
@@ -5,7 +5,7 @@ import { type TKeyOf } from './keyof';
|
|
|
5
5
|
type TFromProperties<K extends TProperties> = ({
|
|
6
6
|
[K2 in keyof K]: TKeyOf<K[K2]>;
|
|
7
7
|
});
|
|
8
|
-
type TFromMappedResult<
|
|
9
|
-
export type TKeyOfFromMappedResult<
|
|
10
|
-
export declare function KeyOfFromMappedResult<
|
|
8
|
+
type TFromMappedResult<R extends TMappedResult> = (TFromProperties<R['properties']>);
|
|
9
|
+
export type TKeyOfFromMappedResult<R extends TMappedResult, P extends TProperties = TFromMappedResult<R>> = (TMappedResult<P>);
|
|
10
|
+
export declare function KeyOfFromMappedResult<R extends TMappedResult, P extends TProperties = TFromMappedResult<R>>(R: R, options: SchemaOptions): TMappedResult<P>;
|
|
11
11
|
export {};
|
|
@@ -11,12 +11,12 @@ function FromProperties(K, options) {
|
|
|
11
11
|
}, {});
|
|
12
12
|
}
|
|
13
13
|
// prettier-ignore
|
|
14
|
-
function FromMappedResult(
|
|
15
|
-
return FromProperties(
|
|
14
|
+
function FromMappedResult(R, options) {
|
|
15
|
+
return FromProperties(R.properties, options);
|
|
16
16
|
}
|
|
17
17
|
// prettier-ignore
|
|
18
|
-
function KeyOfFromMappedResult(
|
|
19
|
-
const P = FromMappedResult(
|
|
18
|
+
function KeyOfFromMappedResult(R, options) {
|
|
19
|
+
const P = FromMappedResult(R, options);
|
|
20
20
|
return (0, index_1.MappedResult)(P);
|
|
21
21
|
}
|
|
22
22
|
exports.KeyOfFromMappedResult = KeyOfFromMappedResult;
|
|
@@ -6,11 +6,11 @@ import type { TUnion } from '../union/index';
|
|
|
6
6
|
import type { TTuple } from '../tuple/index';
|
|
7
7
|
import type { TArray } from '../array/index';
|
|
8
8
|
import type { TObject, TProperties } from '../object/index';
|
|
9
|
-
import {
|
|
9
|
+
import { type TSetUnionMany, type TSetIntersectMany } from '../sets/index';
|
|
10
10
|
type TFromRest<T extends TSchema[], Acc extends PropertyKey[][] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest<R, [...Acc, TKeyOfPropertyKeys<L>]> : Acc);
|
|
11
|
-
type FromIntersect<T extends TSchema[], C extends PropertyKey[][] = TFromRest<T>, R extends PropertyKey[] =
|
|
11
|
+
type FromIntersect<T extends TSchema[], C extends PropertyKey[][] = TFromRest<T>, R extends PropertyKey[] = TSetUnionMany<C>> = R;
|
|
12
12
|
declare function FromIntersect<T extends TSchema[]>(T: [...T]): FromIntersect<T>;
|
|
13
|
-
type FromUnion<T extends TSchema[], C extends PropertyKey[][] = TFromRest<T>, R extends PropertyKey[] =
|
|
13
|
+
type FromUnion<T extends TSchema[], C extends PropertyKey[][] = TFromRest<T>, R extends PropertyKey[] = TSetIntersectMany<C>> = R;
|
|
14
14
|
declare function FromUnion<T extends TSchema[]>(T: [...T]): FromUnion<T>;
|
|
15
15
|
type TFromTuple<T extends TSchema[], I extends string = ZeroString, Acc extends PropertyKey[] = []> = T extends [infer _ extends TSchema, ...infer R extends TSchema[]] ? TFromTuple<R, Increment<I>, [...Acc, I]> : Acc;
|
|
16
16
|
type TFromArray<_ extends TSchema> = ([
|