@sinclair/typebox 0.32.0-dev-11 → 0.32.0-dev-12
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/compiler/compiler.mjs +3 -3
- package/build/import/errors/errors.mjs +3 -3
- package/build/import/index.d.mts +3 -3
- package/build/import/index.mjs +2 -2
- package/build/import/type/composite/composite.d.mts +2 -2
- package/build/import/type/composite/composite.mjs +2 -2
- package/build/import/type/extends/extends-mapped-result.d.mts +13 -0
- package/build/import/type/extends/extends-mapped-result.mjs +14 -0
- package/build/import/type/extends/extends-mapped.d.mts +17 -0
- package/build/import/type/extends/extends-mapped.mjs +21 -0
- package/build/import/type/extends/extends.d.mts +8 -2
- package/build/import/type/extends/extends.mjs +7 -3
- package/build/import/type/extends/index.d.mts +2 -0
- package/build/import/type/extends/index.mjs +2 -0
- package/build/import/type/guard/type.d.mts +5 -1
- package/build/import/type/guard/type.mjs +18 -2
- package/build/import/type/indexed/index.d.mts +2 -1
- package/build/import/type/indexed/index.mjs +2 -1
- package/build/import/type/indexed/indexed-mapped.d.mts +16 -0
- package/build/import/type/indexed/indexed-mapped.mjs +18 -0
- package/build/import/type/indexed/{indexed-key.d.mts → indexed-property-keys.d.mts} +3 -3
- package/build/import/type/indexed/{indexed-key.mjs → indexed-property-keys.mjs} +2 -2
- package/build/import/type/indexed/indexed-type.d.mts +2 -2
- package/build/import/type/indexed/indexed-type.mjs +1 -1
- package/build/import/type/indexed/indexed.d.mts +7 -4
- package/build/import/type/indexed/indexed.mjs +7 -6
- package/build/import/type/keyof/index.d.mts +1 -2
- package/build/import/type/keyof/index.mjs +1 -2
- package/build/import/type/keyof/{keyof-string.d.mts → keyof-property-keys.d.mts} +4 -4
- package/build/import/type/keyof/{keyof-string.mjs → keyof-property-keys.mjs} +4 -4
- package/build/import/type/keyof/keyof.d.mts +12 -4
- package/build/import/type/keyof/keyof.mjs +14 -3
- package/build/import/type/mapped/mapped.d.mts +41 -15
- package/build/import/type/mapped/mapped.mjs +75 -11
- package/build/import/type/omit/omit.d.mts +2 -2
- package/build/import/type/omit/omit.mjs +2 -2
- 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.mjs +3 -3
- package/build/import/type/type/json.d.mts +13 -6
- package/build/import/type/type/json.mjs +6 -2
- package/build/import/value/check/check.mjs +3 -3
- package/build/import/value/clean/clean.mjs +2 -2
- package/build/import/value/transform/decode.mjs +5 -5
- package/build/import/value/transform/encode.mjs +5 -5
- package/build/require/compiler/compiler.js +2 -2
- package/build/require/errors/errors.js +2 -2
- package/build/require/index.d.ts +3 -3
- package/build/require/index.js +7 -7
- package/build/require/type/composite/composite.d.ts +2 -2
- package/build/require/type/composite/composite.js +1 -1
- package/build/require/type/extends/extends-mapped-result.d.ts +13 -0
- package/build/require/type/extends/extends-mapped-result.js +18 -0
- package/build/require/type/extends/extends-mapped.d.ts +17 -0
- package/build/require/type/extends/extends-mapped.js +25 -0
- package/build/require/type/extends/extends.d.ts +8 -2
- package/build/require/type/extends/extends.js +8 -5
- package/build/require/type/extends/index.d.ts +2 -0
- package/build/require/type/extends/index.js +2 -0
- package/build/require/type/guard/type.d.ts +5 -1
- package/build/require/type/guard/type.js +53 -34
- package/build/require/type/indexed/index.d.ts +2 -1
- package/build/require/type/indexed/index.js +2 -1
- package/build/require/type/indexed/indexed-mapped.d.ts +16 -0
- package/build/require/type/indexed/indexed-mapped.js +22 -0
- package/build/require/type/indexed/{indexed-key.d.ts → indexed-property-keys.d.ts} +3 -3
- package/build/require/type/indexed/{indexed-key.js → indexed-property-keys.js} +4 -4
- package/build/require/type/indexed/indexed-type.d.ts +2 -2
- package/build/require/type/indexed/indexed-type.js +3 -3
- package/build/require/type/indexed/indexed.d.ts +7 -4
- package/build/require/type/indexed/indexed.js +7 -6
- package/build/require/type/keyof/index.d.ts +1 -2
- package/build/require/type/keyof/index.js +1 -2
- package/build/require/type/keyof/{keyof-string.d.ts → keyof-property-keys.d.ts} +4 -4
- package/build/require/type/keyof/{keyof-string.js → keyof-property-keys.js} +7 -7
- package/build/require/type/keyof/keyof.d.ts +12 -4
- package/build/require/type/keyof/keyof.js +14 -3
- package/build/require/type/mapped/mapped.d.ts +41 -15
- package/build/require/type/mapped/mapped.js +80 -12
- package/build/require/type/omit/omit.d.ts +2 -2
- package/build/require/type/omit/omit.js +1 -1
- package/build/require/type/pick/pick.d.ts +2 -2
- package/build/require/type/pick/pick.js +1 -1
- package/build/require/type/record/record.js +2 -2
- package/build/require/type/type/json.d.ts +13 -6
- package/build/require/type/type/json.js +54 -50
- package/build/require/value/check/check.js +2 -2
- package/build/require/value/clean/clean.js +15 -15
- package/build/require/value/transform/decode.js +3 -3
- package/build/require/value/transform/encode.js +3 -3
- package/package.json +1 -1
- package/build/import/type/keyof/keyof-type.d.mts +0 -11
- package/build/import/type/keyof/keyof-type.mjs +0 -15
- package/build/require/type/keyof/keyof-type.d.ts +0 -11
- package/build/require/type/keyof/keyof-type.js +0 -19
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MappedResultExtends = void 0;
|
|
4
|
+
const index_1 = require("../mapped/index");
|
|
5
|
+
const extends_1 = require("./extends");
|
|
6
|
+
function MappedResultExtendsPropertyKeys(K, U, L, R) {
|
|
7
|
+
return globalThis.Object.getOwnPropertyNames(K).reduce((Acc, K2) => {
|
|
8
|
+
return { ...Acc, [K2]: (0, extends_1.Extends)(K[K2], U, L, R) };
|
|
9
|
+
}, {});
|
|
10
|
+
}
|
|
11
|
+
function MappedResultExtendsProperties(K, U, L, R) {
|
|
12
|
+
return MappedResultExtendsPropertyKeys(K.properties, U, L, R);
|
|
13
|
+
}
|
|
14
|
+
function MappedResultExtends(T, U, L, R) {
|
|
15
|
+
const P = MappedResultExtendsProperties(T, U, L, R);
|
|
16
|
+
return (0, index_1.MappedResult)(P);
|
|
17
|
+
}
|
|
18
|
+
exports.MappedResultExtends = MappedResultExtends;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TSchema } from '../schema/index';
|
|
2
|
+
import type { TProperties } from '../object/index';
|
|
3
|
+
import type { Assert } from '../helpers/index';
|
|
4
|
+
import { type TMappedResult, type TMappedKey } from '../mapped/index';
|
|
5
|
+
import { TLiteral, TLiteralValue } from '../literal/index';
|
|
6
|
+
import { type TExtends } from './extends';
|
|
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 MappedExtends<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 MappedExtends<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>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MappedExtends = void 0;
|
|
4
|
+
const index_1 = require("../mapped/index");
|
|
5
|
+
const index_2 = require("../literal/index");
|
|
6
|
+
const extends_1 = require("./extends");
|
|
7
|
+
function MappedExtendsPropertyKey(K, U, L, R) {
|
|
8
|
+
return {
|
|
9
|
+
[K]: (0, extends_1.Extends)((0, index_2.Literal)(K), U, L, R)
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function MappedExtendsPropertyKeys(K, U, L, R) {
|
|
13
|
+
const [LK, ...RK] = K;
|
|
14
|
+
return (K.length > 0
|
|
15
|
+
? { ...MappedExtendsPropertyKey(LK, U, L, R), ...MappedExtendsPropertyKeys(RK, U, L, R) }
|
|
16
|
+
: {});
|
|
17
|
+
}
|
|
18
|
+
function MappedExtendsProperties(K, U, L, R) {
|
|
19
|
+
return MappedExtendsPropertyKeys(K.keys, U, L, R);
|
|
20
|
+
}
|
|
21
|
+
function MappedExtends(T, U, L, R) {
|
|
22
|
+
const P = MappedExtendsProperties(T, U, L, R);
|
|
23
|
+
return (0, index_1.MappedResult)(P);
|
|
24
|
+
}
|
|
25
|
+
exports.MappedExtends = MappedExtends;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type { TSchema, SchemaOptions } from '../schema/index';
|
|
2
2
|
import type { Static } from '../static/index';
|
|
3
3
|
import { type TUnion } from '../union/index';
|
|
4
|
+
import { TMappedKey, TMappedResult } from '../mapped/index';
|
|
4
5
|
import { UnionToTuple } from '../helpers/index';
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
import { MappedExtends } from './extends-mapped';
|
|
7
|
+
import { MappedResultExtends } from './extends-mapped-result';
|
|
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
|
+
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>;
|
|
7
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): MappedResultExtends<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): MappedExtends<L, R, T, F>;
|
|
8
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
|
+
export {};
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Extends =
|
|
3
|
+
exports.Extends = void 0;
|
|
4
|
+
const type_1 = require("../guard/type");
|
|
4
5
|
const index_1 = require("../union/index");
|
|
5
6
|
const extends_check_1 = require("./extends-check");
|
|
6
|
-
const
|
|
7
|
+
const type_2 = require("../clone/type");
|
|
8
|
+
const extends_mapped_1 = require("./extends-mapped");
|
|
9
|
+
const extends_mapped_result_1 = require("./extends-mapped-result");
|
|
7
10
|
function ExtendsResolve(left, right, trueType, falseType) {
|
|
8
11
|
const R = (0, extends_check_1.ExtendsCheck)(left, right);
|
|
9
12
|
return (R === extends_check_1.ExtendsResult.Union ? (0, index_1.Union)([trueType, falseType]) :
|
|
10
13
|
R === extends_check_1.ExtendsResult.True ? trueType :
|
|
11
14
|
falseType);
|
|
12
15
|
}
|
|
13
|
-
exports.ExtendsResolve = ExtendsResolve;
|
|
14
16
|
function Extends(L, R, T, F, options = {}) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
return ((0, type_1.TMappedResult)(L) ? (0, type_2.CloneType)((0, extends_mapped_result_1.MappedResultExtends)(L, R, T, F), options) :
|
|
18
|
+
(0, type_1.TMappedKey)(L) ? (0, type_2.CloneType)((0, extends_mapped_1.MappedExtends)(L, R, T, F), options) :
|
|
19
|
+
(0, type_2.CloneType)(ExtendsResolve(L, R, T, F), options));
|
|
17
20
|
}
|
|
18
21
|
exports.Extends = Extends;
|
|
@@ -15,5 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./extends-check"), exports);
|
|
18
|
+
__exportStar(require("./extends-mapped-result"), exports);
|
|
19
|
+
__exportStar(require("./extends-mapped"), exports);
|
|
18
20
|
__exportStar(require("./extends-undefined"), exports);
|
|
19
21
|
__exportStar(require("./extends"), exports);
|
|
@@ -15,11 +15,12 @@ import type { TInteger } from '../integer/index';
|
|
|
15
15
|
import type { TIntersect } from '../intersect/index';
|
|
16
16
|
import type { TIterator } from '../iterator/index';
|
|
17
17
|
import type { TLiteral } from '../literal/index';
|
|
18
|
+
import type { TMappedKey, TMappedResult } from '../mapped/index';
|
|
18
19
|
import type { TNever } from '../never/index';
|
|
19
20
|
import type { TNot } from '../not/index';
|
|
20
21
|
import type { TNull } from '../null/index';
|
|
21
22
|
import type { TNumber } from '../number/index';
|
|
22
|
-
import type { TObject } from '../object/index';
|
|
23
|
+
import type { TObject, TProperties } from '../object/index';
|
|
23
24
|
import type { TOptional } from '../optional/index';
|
|
24
25
|
import type { TPromise } from '../promise/index';
|
|
25
26
|
import type { TReadonly } from '../readonly/index';
|
|
@@ -47,6 +48,7 @@ export declare function TConstructor(schema: unknown): schema is TConstructor;
|
|
|
47
48
|
export declare function TDate(schema: unknown): schema is TDate;
|
|
48
49
|
export declare function TFunction(schema: unknown): schema is TFunction;
|
|
49
50
|
export declare function TInteger(schema: unknown): schema is TInteger;
|
|
51
|
+
export declare function TProperties(schema: unknown): schema is TProperties;
|
|
50
52
|
export declare function TIntersect(schema: unknown): schema is TIntersect;
|
|
51
53
|
export declare function TIterator(schema: unknown): schema is TIterator;
|
|
52
54
|
export declare function TKindOf<T extends string>(schema: unknown, kind: T): schema is Record<PropertyKey, unknown> & {
|
|
@@ -56,6 +58,8 @@ export declare function TLiteralString(schema: unknown): schema is TLiteral<stri
|
|
|
56
58
|
export declare function TLiteralNumber(schema: unknown): schema is TLiteral<number>;
|
|
57
59
|
export declare function TLiteralBoolean(schema: unknown): schema is TLiteral<boolean>;
|
|
58
60
|
export declare function TLiteral(schema: unknown): schema is TLiteral;
|
|
61
|
+
export declare function TMappedKey(schema: unknown): schema is TMappedKey;
|
|
62
|
+
export declare function TMappedResult(schema: unknown): schema is TMappedResult;
|
|
59
63
|
export declare function TNever(schema: unknown): schema is TNever;
|
|
60
64
|
export declare function TNot(schema: unknown): schema is TNot;
|
|
61
65
|
export declare function TNull(schema: unknown): schema is TNull;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TSchema = exports.TKind = exports.TVoid = exports.TUnsafe = exports.TUnknown = exports.TUint8Array = exports.TUnion = exports.TUnionLiteral = exports.TUndefined = exports.TTuple = exports.TTransform = exports.TThis = exports.TTemplateLiteral = exports.TSymbol = exports.TString = exports.TRef = exports.TRecursive = exports.TRecord = exports.TPromise = exports.TObject = exports.TNumber = exports.TNull = exports.TNot = exports.TNever = exports.TLiteral = exports.TLiteralBoolean = exports.TLiteralNumber = exports.TLiteralString = exports.TKindOf = exports.TIterator = exports.TIntersect = exports.TInteger = exports.TFunction = exports.TDate = exports.TConstructor = exports.TBoolean = exports.TBigInt = exports.TAsyncIterator = exports.TArray = exports.TAny = exports.TOptional = exports.TReadonly = exports.TypeGuardUnknownTypeError = void 0;
|
|
3
|
+
exports.TSchema = exports.TKind = exports.TVoid = exports.TUnsafe = exports.TUnknown = exports.TUint8Array = exports.TUnion = exports.TUnionLiteral = exports.TUndefined = exports.TTuple = exports.TTransform = exports.TThis = exports.TTemplateLiteral = exports.TSymbol = exports.TString = exports.TRef = exports.TRecursive = exports.TRecord = exports.TPromise = exports.TObject = exports.TNumber = exports.TNull = exports.TNot = exports.TNever = exports.TMappedResult = exports.TMappedKey = exports.TLiteral = exports.TLiteralBoolean = exports.TLiteralNumber = exports.TLiteralString = exports.TKindOf = exports.TIterator = exports.TIntersect = exports.TProperties = exports.TInteger = exports.TFunction = exports.TDate = exports.TConstructor = exports.TBoolean = exports.TBigInt = exports.TAsyncIterator = exports.TArray = exports.TAny = exports.TOptional = exports.TReadonly = exports.TypeGuardUnknownTypeError = void 0;
|
|
4
4
|
const ValueGuard = require("./value");
|
|
5
5
|
const index_1 = require("../symbols/index");
|
|
6
6
|
class TypeGuardUnknownTypeError extends Error {
|
|
@@ -20,6 +20,8 @@ const KnownTypes = [
|
|
|
20
20
|
'Intersect',
|
|
21
21
|
'Iterator',
|
|
22
22
|
'Literal',
|
|
23
|
+
'MappedKey',
|
|
24
|
+
'MappedResult',
|
|
23
25
|
'Not',
|
|
24
26
|
'Null',
|
|
25
27
|
'Number',
|
|
@@ -172,6 +174,11 @@ function TInteger(schema) {
|
|
|
172
174
|
IsOptionalNumber(schema.multipleOf));
|
|
173
175
|
}
|
|
174
176
|
exports.TInteger = TInteger;
|
|
177
|
+
function TProperties(schema) {
|
|
178
|
+
return (ValueGuard.IsObject(schema) &&
|
|
179
|
+
Object.entries(schema).every(([key, schema]) => IsControlCharacterFree(key) && (0, index_2.TSchema)(schema)));
|
|
180
|
+
}
|
|
181
|
+
exports.TProperties = TProperties;
|
|
175
182
|
function TIntersect(schema) {
|
|
176
183
|
return (TKindOf(schema, 'Intersect') &&
|
|
177
184
|
(ValueGuard.IsString(schema.type) && schema.type !== 'object' ? false : true) &&
|
|
@@ -212,6 +219,17 @@ function TLiteral(schema) {
|
|
|
212
219
|
ValueGuard.IsString(schema.const)));
|
|
213
220
|
}
|
|
214
221
|
exports.TLiteral = TLiteral;
|
|
222
|
+
function TMappedKey(schema) {
|
|
223
|
+
return (TKindOf(schema, 'MappedKey') &&
|
|
224
|
+
ValueGuard.IsArray(schema.keys) &&
|
|
225
|
+
schema.keys.every(key => ValueGuard.IsNumber(key) || ValueGuard.IsString(key)));
|
|
226
|
+
}
|
|
227
|
+
exports.TMappedKey = TMappedKey;
|
|
228
|
+
function TMappedResult(schema) {
|
|
229
|
+
return (TKindOf(schema, 'MappedResult') &&
|
|
230
|
+
(0, index_4.TProperties)(schema.properties));
|
|
231
|
+
}
|
|
232
|
+
exports.TMappedResult = TMappedResult;
|
|
215
233
|
function TNever(schema) {
|
|
216
234
|
return (TKindOf(schema, 'Never') &&
|
|
217
235
|
ValueGuard.IsObject(schema.not) &&
|
|
@@ -244,8 +262,7 @@ function TObject(schema) {
|
|
|
244
262
|
return (TKindOf(schema, 'Object') &&
|
|
245
263
|
schema.type === 'object' &&
|
|
246
264
|
IsOptionalString(schema.$id) &&
|
|
247
|
-
|
|
248
|
-
Object.entries(schema.properties).every(([key, schema]) => IsControlCharacterFree(key) && (0, index_2.TSchema)(schema)) &&
|
|
265
|
+
(0, index_4.TProperties)(schema.properties) &&
|
|
249
266
|
IsAdditionalProperties(schema.additionalProperties) &&
|
|
250
267
|
IsOptionalNumber(schema.minProperties) &&
|
|
251
268
|
IsOptionalNumber(schema.maxProperties));
|
|
@@ -337,7 +354,7 @@ function TUndefined(schema) {
|
|
|
337
354
|
}
|
|
338
355
|
exports.TUndefined = TUndefined;
|
|
339
356
|
function TUnionLiteral(schema) {
|
|
340
|
-
return (0,
|
|
357
|
+
return (0, index_5.TUnion)(schema) && schema.anyOf.every((schema) => TLiteralString(schema) || TLiteralNumber(schema));
|
|
341
358
|
}
|
|
342
359
|
exports.TUnionLiteral = TUnionLiteral;
|
|
343
360
|
function TUnion(schema) {
|
|
@@ -376,37 +393,39 @@ function TKind(schema) {
|
|
|
376
393
|
}
|
|
377
394
|
exports.TKind = TKind;
|
|
378
395
|
function TSchema(schema) {
|
|
379
|
-
return (ValueGuard.IsObject(schema)) && ((0,
|
|
380
|
-
(0,
|
|
381
|
-
(0,
|
|
382
|
-
(0,
|
|
383
|
-
(0,
|
|
384
|
-
(0,
|
|
385
|
-
(0,
|
|
386
|
-
(0,
|
|
387
|
-
(0,
|
|
388
|
-
(0,
|
|
389
|
-
(0,
|
|
396
|
+
return (ValueGuard.IsObject(schema)) && ((0, index_6.TAny)(schema) ||
|
|
397
|
+
(0, index_7.TArray)(schema) ||
|
|
398
|
+
(0, index_8.TBoolean)(schema) ||
|
|
399
|
+
(0, index_9.TBigInt)(schema) ||
|
|
400
|
+
(0, index_10.TAsyncIterator)(schema) ||
|
|
401
|
+
(0, index_11.TConstructor)(schema) ||
|
|
402
|
+
(0, index_12.TDate)(schema) ||
|
|
403
|
+
(0, index_13.TFunction)(schema) ||
|
|
404
|
+
(0, index_14.TInteger)(schema) ||
|
|
405
|
+
(0, index_15.TIntersect)(schema) ||
|
|
406
|
+
(0, index_16.TIterator)(schema) ||
|
|
390
407
|
(0, index_3.TLiteral)(schema) ||
|
|
391
|
-
(0,
|
|
392
|
-
(0, index_17.
|
|
393
|
-
(0, index_18.
|
|
394
|
-
(0, index_19.
|
|
395
|
-
(0, index_20.
|
|
396
|
-
(0, index_21.
|
|
397
|
-
(0,
|
|
398
|
-
(0,
|
|
399
|
-
(0,
|
|
400
|
-
(0,
|
|
401
|
-
(0,
|
|
402
|
-
(0,
|
|
403
|
-
(0,
|
|
404
|
-
(0,
|
|
405
|
-
(0,
|
|
406
|
-
(0, index_30.
|
|
407
|
-
(0,
|
|
408
|
-
(0,
|
|
409
|
-
(0,
|
|
408
|
+
(0, index_17.TMappedKey)(schema) ||
|
|
409
|
+
(0, index_17.TMappedResult)(schema) ||
|
|
410
|
+
(0, index_18.TNever)(schema) ||
|
|
411
|
+
(0, index_19.TNot)(schema) ||
|
|
412
|
+
(0, index_20.TNull)(schema) ||
|
|
413
|
+
(0, index_21.TNumber)(schema) ||
|
|
414
|
+
(0, index_4.TObject)(schema) ||
|
|
415
|
+
(0, index_22.TPromise)(schema) ||
|
|
416
|
+
(0, index_23.TRecord)(schema) ||
|
|
417
|
+
(0, index_24.TRef)(schema) ||
|
|
418
|
+
(0, index_25.TString)(schema) ||
|
|
419
|
+
(0, index_26.TSymbol)(schema) ||
|
|
420
|
+
(0, index_27.TTemplateLiteral)(schema) ||
|
|
421
|
+
(0, index_28.TThis)(schema) ||
|
|
422
|
+
(0, index_29.TTuple)(schema) ||
|
|
423
|
+
(0, index_30.TUndefined)(schema) ||
|
|
424
|
+
(0, index_5.TUnion)(schema) ||
|
|
425
|
+
(0, index_31.TUint8Array)(schema) ||
|
|
426
|
+
(0, index_32.TUnknown)(schema) ||
|
|
427
|
+
(0, index_33.TUnsafe)(schema) ||
|
|
428
|
+
(0, index_34.TVoid)(schema) ||
|
|
410
429
|
TKind(schema));
|
|
411
430
|
}
|
|
412
431
|
exports.TSchema = TSchema;
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./indexed-
|
|
17
|
+
__exportStar(require("./indexed-mapped"), exports);
|
|
18
|
+
__exportStar(require("./indexed-property-keys"), exports);
|
|
18
19
|
__exportStar(require("./indexed-type"), exports);
|
|
19
20
|
__exportStar(require("./indexed"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type TSchema } from '../schema/index';
|
|
2
|
+
import { type TProperties } from '../object/index';
|
|
3
|
+
import { IndexedType } from './indexed-type';
|
|
4
|
+
import { type TMappedResult, type TMappedKey } from '../mapped/index';
|
|
5
|
+
import { Evaluate } from '../helpers/index';
|
|
6
|
+
type MappedIndexPropertyKey<T extends TSchema, K extends PropertyKey> = {
|
|
7
|
+
[_ in K]: IndexedType<T, [K]>;
|
|
8
|
+
};
|
|
9
|
+
declare function MappedIndexPropertyKey<T extends TSchema, K extends PropertyKey>(T: T, K: K): MappedIndexPropertyKey<T, K>;
|
|
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>;
|
|
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 TMappedIndex<T extends TSchema, K extends TMappedKey, P extends TProperties = MappedIndexProperties<T, K>> = TMappedResult<P>;
|
|
15
|
+
export declare function MappedIndex<T extends TSchema, K extends TMappedKey, P extends TProperties = MappedIndexProperties<T, K>>(T: T, K: K): TMappedResult<P>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MappedIndex = void 0;
|
|
4
|
+
const indexed_type_1 = require("./indexed-type");
|
|
5
|
+
const index_1 = require("../mapped/index");
|
|
6
|
+
function MappedIndexPropertyKey(T, K) {
|
|
7
|
+
return { [K]: (0, indexed_type_1.IndexedType)(T, [K]) };
|
|
8
|
+
}
|
|
9
|
+
function MappedIndexPropertyKeys(T, K) {
|
|
10
|
+
const [L, ...R] = K;
|
|
11
|
+
return (K.length > 0
|
|
12
|
+
? { ...MappedIndexPropertyKey(T, L), ...MappedIndexPropertyKeys(T, R) }
|
|
13
|
+
: {});
|
|
14
|
+
}
|
|
15
|
+
function MappedIndexProperties(T, K) {
|
|
16
|
+
return MappedIndexPropertyKeys(T, K.keys);
|
|
17
|
+
}
|
|
18
|
+
function MappedIndex(T, K) {
|
|
19
|
+
const P = MappedIndexProperties(T, K);
|
|
20
|
+
return (0, index_1.MappedResult)(P);
|
|
21
|
+
}
|
|
22
|
+
exports.MappedIndex = MappedIndex;
|
|
@@ -6,11 +6,11 @@ import { type TSchema } from '../schema/index';
|
|
|
6
6
|
import { type TUnion } from '../union/index';
|
|
7
7
|
type FromTemplateLiteral<T extends TTemplateLiteral, F = IsTemplateLiteralFinite<T>> = (F extends true ? TemplateLiteralGenerate<T> extends infer R extends string[] ? R : [] : []);
|
|
8
8
|
declare function FromTemplateLiteral<T extends TTemplateLiteral>(T: T): FromTemplateLiteral<T>;
|
|
9
|
-
type FromUnion<T extends TSchema[]> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [...
|
|
9
|
+
type FromUnion<T extends TSchema[]> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [...IndexedPropertyKeys<L>, ...FromUnion<R>] : []);
|
|
10
10
|
declare function FromUnion<T extends TSchema[]>(T: T): FromUnion<T>;
|
|
11
11
|
type FromLiteral<T extends TLiteralValue> = (T extends PropertyKey ? [`${T}`] : []);
|
|
12
12
|
declare function FromLiteral<T extends TLiteralValue>(T: T): FromLiteral<T>;
|
|
13
|
-
export type
|
|
13
|
+
export type IndexedPropertyKeys<T extends TSchema> = (T extends TTemplateLiteral ? FromTemplateLiteral<T> : T extends TUnion<infer S> ? FromUnion<S> : T extends TLiteral<infer S> ? FromLiteral<S> : T extends TNumber ? ['[number]'] : T extends TInteger ? ['[number]'] : [
|
|
14
14
|
]);
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function IndexedPropertyKeys<T extends TSchema>(T: T): IndexedPropertyKeys<T>;
|
|
16
16
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.IndexedPropertyKeys = void 0;
|
|
4
4
|
const index_1 = require("../template-literal/index");
|
|
5
5
|
const type_1 = require("../guard/type");
|
|
6
6
|
function FromTemplateLiteral(T) {
|
|
@@ -16,13 +16,13 @@ function FromTemplateLiteral(T) {
|
|
|
16
16
|
function FromUnion(T) {
|
|
17
17
|
const [L, ...R] = T;
|
|
18
18
|
return (T.length > 0
|
|
19
|
-
? [...
|
|
19
|
+
? [...IndexedPropertyKeys(L), ...FromUnion(R)]
|
|
20
20
|
: []);
|
|
21
21
|
}
|
|
22
22
|
function FromLiteral(T) {
|
|
23
23
|
return ([T.toString()]);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function IndexedPropertyKeys(T) {
|
|
26
26
|
return [...new Set(((0, type_1.TTemplateLiteral)(T) ? FromTemplateLiteral(T) :
|
|
27
27
|
(0, type_1.TUnion)(T) ? FromUnion(T.anyOf) :
|
|
28
28
|
(0, type_1.TLiteral)(T) ? FromLiteral(T.const) :
|
|
@@ -30,4 +30,4 @@ function IndexedKeyResolve(T) {
|
|
|
30
30
|
(0, type_1.TInteger)(T) ? ['[number]'] :
|
|
31
31
|
[]))];
|
|
32
32
|
}
|
|
33
|
-
exports.
|
|
33
|
+
exports.IndexedPropertyKeys = IndexedPropertyKeys;
|
|
@@ -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
|
|
32
|
-
export declare function
|
|
31
|
+
export type IndexedType<T extends TSchema, K extends PropertyKey[]> = (UnionResolve<FromKeys<T, K>>);
|
|
32
|
+
export declare function IndexedType<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K]): IndexedType<T, K>;
|
|
33
33
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.IndexedType = void 0;
|
|
4
4
|
const index_1 = require("../never/index");
|
|
5
5
|
const index_2 = require("../intersect/index");
|
|
6
6
|
const index_3 = require("../union/index");
|
|
@@ -62,7 +62,7 @@ function FromKeys(T, K) {
|
|
|
62
62
|
? [FromKey(T, L), ...FromKeys(T, R)]
|
|
63
63
|
: []);
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function IndexedType(T, K) {
|
|
66
66
|
return ((0, index_3.UnionResolve)(FromKeys(T, K)));
|
|
67
67
|
}
|
|
68
|
-
exports.
|
|
68
|
+
exports.IndexedType = IndexedType;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { TSchema, SchemaOptions } from '../schema/index';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { IndexedType } from './indexed-type';
|
|
3
|
+
import { IndexedPropertyKeys } from './indexed-property-keys';
|
|
4
|
+
import { type TMappedIndex } from './indexed-mapped';
|
|
5
|
+
import { TMappedKey } from '../mapped/index';
|
|
6
|
+
export type TIndex<T extends TSchema, K extends PropertyKey[]> = IndexedType<T, K>;
|
|
7
|
+
export declare function Index<T extends TSchema, K extends TMappedKey>(T: T, K: K): TMappedIndex<T, K>;
|
|
8
|
+
export declare function Index<T extends TSchema, K extends TSchema, I extends PropertyKey[] = IndexedPropertyKeys<K>>(T: T, K: K, options?: SchemaOptions): TIndex<T, I>;
|
|
6
9
|
export declare function Index<T extends TSchema, K extends PropertyKey[]>(T: T, K: readonly [...K], options?: SchemaOptions): TIndex<T, K>;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Index = void 0;
|
|
4
|
+
const type_1 = require("../guard/type");
|
|
4
5
|
const indexed_type_1 = require("./indexed-type");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const type_2 = require("../
|
|
6
|
+
const indexed_property_keys_1 = require("./indexed-property-keys");
|
|
7
|
+
const indexed_mapped_1 = require("./indexed-mapped");
|
|
8
|
+
const type_2 = require("../clone/type");
|
|
8
9
|
function Index(T, K, options = {}) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
return ((0, type_1.TMappedKey)(K) ? (0, type_2.CloneType)((0, indexed_mapped_1.MappedIndex)(T, K), options) :
|
|
11
|
+
(0, type_1.TSchema)(K) ? (0, type_2.CloneType)((0, indexed_type_1.IndexedType)(T, (0, indexed_property_keys_1.IndexedPropertyKeys)(K)), options) :
|
|
12
|
+
(0, type_2.CloneType)((0, indexed_type_1.IndexedType)(T, K), options));
|
|
12
13
|
}
|
|
13
14
|
exports.Index = Index;
|
|
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./keyof-
|
|
18
|
-
__exportStar(require("./keyof-type"), exports);
|
|
17
|
+
__exportStar(require("./keyof-property-keys"), exports);
|
|
19
18
|
__exportStar(require("./keyof"), exports);
|
|
@@ -7,7 +7,7 @@ import type { TTuple } from '../tuple/index';
|
|
|
7
7
|
import type { TArray } from '../array/index';
|
|
8
8
|
import type { TObject, TProperties } from '../object/index';
|
|
9
9
|
import { OperatorUnionMany, OperatorIntersectMany } from '../operators/index';
|
|
10
|
-
type FromRest<T extends TSchema[]> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [
|
|
10
|
+
type FromRest<T extends TSchema[]> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [KeyOfPropertyKeys<L>, ...FromRest<R>] : []);
|
|
11
11
|
declare function FromRest<T extends TSchema[]>(T: [...T]): FromRest<T>;
|
|
12
12
|
type FromIntersect<T extends TSchema[], C extends PropertyKey[][] = FromRest<T>> = (OperatorUnionMany<C>);
|
|
13
13
|
declare function FromIntersect<T extends TSchema[]>(T: [...T], C?: FromRest<T>): FromIntersect<T>;
|
|
@@ -21,8 +21,8 @@ type FromArray<_ extends TSchema> = ([
|
|
|
21
21
|
declare function FromArray<_ extends TSchema>(_: _): FromArray<_>;
|
|
22
22
|
type FromProperties<T extends TProperties> = (UnionToTuple<keyof T>);
|
|
23
23
|
declare function FromProperties<T extends TProperties>(T: T): FromProperties<T>;
|
|
24
|
-
export type
|
|
24
|
+
export type KeyOfPropertyKeys<T extends TSchema> = (T extends TRecursive<infer S> ? KeyOfPropertyKeys<S> : T extends TIntersect<infer S> ? FromIntersect<S> : T extends TUnion<infer S> ? FromUnion<S> : T extends TTuple<infer S> ? FromTuple<S> : T extends TArray<infer S> ? FromArray<S> : T extends TObject<infer S> ? FromProperties<S> : [
|
|
25
25
|
]);
|
|
26
|
-
export declare function
|
|
27
|
-
export declare function
|
|
26
|
+
export declare function KeyOfPropertyKeys<T extends TSchema>(T: T): KeyOfPropertyKeys<T>;
|
|
27
|
+
export declare function KeyOfPattern(schema: TSchema): string;
|
|
28
28
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.KeyOfPattern = exports.KeyOfPropertyKeys = void 0;
|
|
4
4
|
const index_1 = require("../helpers/index");
|
|
5
5
|
const index_2 = require("../operators/index");
|
|
6
6
|
const type_1 = require("../guard/type");
|
|
7
7
|
function FromRest(T) {
|
|
8
8
|
const [L, ...R] = T;
|
|
9
9
|
return (T.length > 0
|
|
10
|
-
? [
|
|
10
|
+
? [KeyOfPropertyKeys(L), ...FromRest(R)]
|
|
11
11
|
: []);
|
|
12
12
|
}
|
|
13
13
|
function FromIntersect(T, C = FromRest(T)) {
|
|
@@ -39,7 +39,7 @@ function FromPatternProperties(patternProperties) {
|
|
|
39
39
|
: key;
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function KeyOfPropertyKeys(T) {
|
|
43
43
|
return ((0, type_1.TIntersect)(T) ? FromIntersect(T.allOf) :
|
|
44
44
|
(0, type_1.TUnion)(T) ? FromUnion(T.anyOf) :
|
|
45
45
|
(0, type_1.TTuple)(T) ? FromTuple(T.items ?? []) :
|
|
@@ -48,13 +48,13 @@ function KeyOfStringResolve(T) {
|
|
|
48
48
|
(0, type_1.TRecord)(T) ? FromPatternProperties(T.patternProperties) :
|
|
49
49
|
[]);
|
|
50
50
|
}
|
|
51
|
-
exports.
|
|
51
|
+
exports.KeyOfPropertyKeys = KeyOfPropertyKeys;
|
|
52
52
|
let includePatternProperties = false;
|
|
53
|
-
function
|
|
53
|
+
function KeyOfPattern(schema) {
|
|
54
54
|
includePatternProperties = true;
|
|
55
|
-
const keys =
|
|
55
|
+
const keys = KeyOfPropertyKeys(schema);
|
|
56
56
|
includePatternProperties = false;
|
|
57
57
|
const pattern = keys.map((key) => `(${key})`);
|
|
58
58
|
return `^(${pattern.join('|')})$`;
|
|
59
59
|
}
|
|
60
|
-
exports.
|
|
60
|
+
exports.KeyOfPattern = KeyOfPattern;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import type { TSchema
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { TSchema } from '../schema/index';
|
|
2
|
+
import type { Ensure } from '../helpers/index';
|
|
3
|
+
import { type TLiteral, TLiteralValue } from '../literal/index';
|
|
4
|
+
import { type TNumber } from '../number/index';
|
|
5
|
+
import { type SchemaOptions } from '../schema/index';
|
|
6
|
+
import { KeyOfPropertyKeys } from './keyof-property-keys';
|
|
7
|
+
import { UnionResolve } from '../union/index';
|
|
8
|
+
type FromLiterals<T extends TLiteralValue[]> = (T extends [infer L extends TLiteralValue, ...infer R extends TLiteralValue[]] ? L extends '[number]' ? [TNumber, ...FromLiterals<R>] : [TLiteral<L>, ...FromLiterals<R>] : []);
|
|
9
|
+
declare function FromLiterals<T extends TLiteralValue[]>(T: [...T]): FromLiterals<T>;
|
|
10
|
+
export type TKeyOf<T extends TSchema> = (Ensure<UnionResolve<FromLiterals<KeyOfPropertyKeys<T>>>>);
|
|
11
|
+
export declare function KeyOf<T extends TSchema>(T: T, options?: SchemaOptions): TKeyOf<T>;
|
|
12
|
+
export {};
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.KeyOf = void 0;
|
|
4
|
-
const
|
|
4
|
+
const index_1 = require("../literal/index");
|
|
5
|
+
const index_2 = require("../number/index");
|
|
6
|
+
const keyof_property_keys_1 = require("./keyof-property-keys");
|
|
7
|
+
const index_3 = require("../union/index");
|
|
5
8
|
const type_1 = require("../clone/type");
|
|
6
|
-
function
|
|
7
|
-
const
|
|
9
|
+
function FromLiterals(T) {
|
|
10
|
+
const [L, ...R] = T;
|
|
11
|
+
return (T.length > 0
|
|
12
|
+
? L === '[number]'
|
|
13
|
+
? [(0, index_2.Number)(), ...FromLiterals(R)]
|
|
14
|
+
: [(0, index_1.Literal)(L), ...FromLiterals(R)]
|
|
15
|
+
: []);
|
|
16
|
+
}
|
|
17
|
+
function KeyOf(T, options = {}) {
|
|
18
|
+
const K = (0, index_3.UnionResolve)(FromLiterals((0, keyof_property_keys_1.KeyOfPropertyKeys)(T)));
|
|
8
19
|
return (0, type_1.CloneType)(K, options);
|
|
9
20
|
}
|
|
10
21
|
exports.KeyOf = KeyOf;
|