@sinclair/typebox 0.34.40 → 0.34.42
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/cjs/parser/index.js +35 -2
- package/build/cjs/parser/runtime/index.js +24 -2
- package/build/cjs/parser/runtime/parse.js +35 -2
- package/build/cjs/parser/static/index.js +23 -1
- package/build/cjs/syntax/mapping.js +34 -1
- package/build/cjs/syntax/parser.js +34 -1
- package/build/cjs/syntax/syntax.js +34 -1
- package/build/cjs/type/clone/value.js +34 -1
- package/build/cjs/type/composite/composite.d.ts +1 -1
- package/build/cjs/type/constructor-parameters/constructor-parameters.js +34 -1
- package/build/cjs/type/create/immutable.js +34 -1
- package/build/cjs/type/guard/index.js +36 -3
- package/build/cjs/type/guard/kind.js +34 -1
- package/build/cjs/type/guard/type.js +34 -1
- package/build/cjs/type/instance-type/instance-type.js +34 -1
- package/build/cjs/type/instantiate/instantiate.d.ts +1 -1
- package/build/cjs/type/instantiate/instantiate.js +35 -2
- package/build/cjs/type/module/compute.js +34 -1
- package/build/cjs/type/object/object.d.ts +6 -2
- package/build/cjs/type/object/object.js +6 -10
- package/build/cjs/type/omit/omit.d.ts +3 -3
- package/build/cjs/type/omit/omit.js +8 -8
- package/build/cjs/type/parameters/parameters.js +34 -1
- package/build/cjs/type/partial/partial.d.ts +2 -2
- package/build/cjs/type/partial/partial.js +38 -5
- package/build/cjs/type/pick/pick.d.ts +3 -3
- package/build/cjs/type/pick/pick.js +8 -8
- package/build/cjs/type/registry/index.js +35 -2
- package/build/cjs/type/required/required.d.ts +2 -2
- package/build/cjs/type/required/required.js +38 -5
- package/build/cjs/type/return-type/return-type.js +34 -1
- package/build/cjs/type/tuple/tuple.d.ts +3 -3
- package/build/cjs/type/type/index.js +34 -1
- package/build/cjs/value/pointer/index.js +34 -1
- package/build/cjs/value/value/index.js +34 -1
- package/build/esm/type/composite/composite.d.mts +1 -1
- package/build/esm/type/instantiate/instantiate.d.mts +1 -1
- package/build/esm/type/object/object.d.mts +6 -2
- package/build/esm/type/object/object.mjs +6 -10
- package/build/esm/type/omit/omit.d.mts +3 -3
- package/build/esm/type/omit/omit.mjs +8 -8
- package/build/esm/type/partial/partial.d.mts +2 -2
- package/build/esm/type/partial/partial.mjs +4 -4
- package/build/esm/type/pick/pick.d.mts +3 -3
- package/build/esm/type/pick/pick.mjs +8 -8
- package/build/esm/type/required/required.d.mts +2 -2
- package/build/esm/type/required/required.mjs +4 -4
- package/build/esm/type/tuple/tuple.d.mts +3 -3
- package/license +24 -24
- package/package.json +2 -2
- package/readme.md +1863 -1861
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
3
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
37
|
exports.FromTypes = FromTypes;
|
|
5
38
|
exports.Instantiate = Instantiate;
|
|
@@ -10,8 +43,8 @@ const index_3 = require("../readonly/index");
|
|
|
10
43
|
const index_4 = require("../optional/index");
|
|
11
44
|
const index_5 = require("../object/index");
|
|
12
45
|
const index_6 = require("../record/index");
|
|
13
|
-
const ValueGuard = require("../guard/value");
|
|
14
|
-
const KindGuard = require("../guard/kind");
|
|
46
|
+
const ValueGuard = __importStar(require("../guard/value"));
|
|
47
|
+
const KindGuard = __importStar(require("../guard/kind"));
|
|
15
48
|
// prettier-ignore
|
|
16
49
|
function FromConstructor(args, type) {
|
|
17
50
|
type.parameters = FromTypes(args, type.parameters);
|
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
3
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
37
|
exports.FromType = FromType;
|
|
5
38
|
exports.ComputeType = ComputeType;
|
|
@@ -32,7 +65,7 @@ const index_22 = require("../symbols/index");
|
|
|
32
65
|
// ------------------------------------------------------------------
|
|
33
66
|
// KindGuard
|
|
34
67
|
// ------------------------------------------------------------------
|
|
35
|
-
const KindGuard = require("../guard/kind");
|
|
68
|
+
const KindGuard = __importStar(require("../guard/kind"));
|
|
36
69
|
// prettier-ignore
|
|
37
70
|
function DereferenceParameters(moduleProperties, types) {
|
|
38
71
|
return types.map((type) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TSchema, SchemaOptions } from '../schema/index';
|
|
2
2
|
import type { Static } from '../static/index';
|
|
3
|
-
import type { Evaluate } from '../helpers/index';
|
|
3
|
+
import type { Evaluate, UnionToTuple } from '../helpers/index';
|
|
4
4
|
import type { TReadonly } from '../readonly/index';
|
|
5
5
|
import type { TOptional } from '../optional/index';
|
|
6
6
|
import { Kind } from '../symbols/index';
|
|
@@ -20,6 +20,10 @@ type ObjectStatic<T extends TProperties, P extends unknown[]> = ObjectStaticProp
|
|
|
20
20
|
}>;
|
|
21
21
|
export type TPropertyKey = string | number;
|
|
22
22
|
export type TProperties = Record<TPropertyKey, TSchema>;
|
|
23
|
+
/** Creates a RequiredArray derived from the given TProperties value. */
|
|
24
|
+
type TRequiredArray<Properties extends TProperties, RequiredProperties extends TProperties = {
|
|
25
|
+
[Key in keyof Properties as Properties[Key] extends TOptional<Properties[Key]> ? never : Key]: Properties[Key];
|
|
26
|
+
}, RequiredKeys extends string[] = UnionToTuple<Extract<keyof RequiredProperties, string>>, Result extends string[] | undefined = RequiredKeys extends [] ? undefined : RequiredKeys> = Result;
|
|
23
27
|
export type TAdditionalProperties = undefined | TSchema | boolean;
|
|
24
28
|
export interface ObjectOptions extends SchemaOptions {
|
|
25
29
|
/** Additional property constraints for this object */
|
|
@@ -35,7 +39,7 @@ export interface TObject<T extends TProperties = TProperties> extends TSchema, O
|
|
|
35
39
|
additionalProperties?: TAdditionalProperties;
|
|
36
40
|
type: 'object';
|
|
37
41
|
properties: T;
|
|
38
|
-
required
|
|
42
|
+
required: TRequiredArray<T>;
|
|
39
43
|
}
|
|
40
44
|
/** `[Json]` Creates an Object type */
|
|
41
45
|
declare function _Object<T extends TProperties>(properties: T, options?: ObjectOptions): TObject<T>;
|
|
@@ -8,19 +8,15 @@ const index_1 = require("../symbols/index");
|
|
|
8
8
|
// TypeGuard
|
|
9
9
|
// ------------------------------------------------------------------
|
|
10
10
|
const kind_1 = require("../guard/kind");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (!(0, kind_1.IsOptional)(properties[key]))
|
|
15
|
-
keys.push(key);
|
|
16
|
-
}
|
|
17
|
-
return keys;
|
|
11
|
+
/** Creates a RequiredArray derived from the given TProperties value. */
|
|
12
|
+
function RequiredArray(properties) {
|
|
13
|
+
return globalThis.Object.keys(properties).filter((key) => !(0, kind_1.IsOptional)(properties[key]));
|
|
18
14
|
}
|
|
19
15
|
/** `[Json]` Creates an Object type */
|
|
20
16
|
function _Object(properties, options) {
|
|
21
|
-
const required =
|
|
22
|
-
const
|
|
23
|
-
return (0, type_1.CreateType)(
|
|
17
|
+
const required = RequiredArray(properties);
|
|
18
|
+
const schema = required.length > 0 ? { [index_1.Kind]: 'Object', type: 'object', required, properties } : { [index_1.Kind]: 'Object', type: 'object', properties };
|
|
19
|
+
return (0, type_1.CreateType)(schema, options);
|
|
24
20
|
}
|
|
25
21
|
/** `[Json]` Creates an Object type */
|
|
26
22
|
exports.Object = _Object;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SchemaOptions, TSchema } from '../schema/index';
|
|
2
|
-
import type { TupleToUnion, Evaluate
|
|
2
|
+
import type { TupleToUnion, Evaluate } from '../helpers/index';
|
|
3
3
|
import { type TRecursive } from '../recursive/index';
|
|
4
4
|
import type { TMappedKey, TMappedResult } from '../mapped/index';
|
|
5
5
|
import { TComputed } from '../computed/index';
|
|
@@ -14,9 +14,9 @@ import { type TOmitFromMappedResult } from './omit-from-mapped-result';
|
|
|
14
14
|
type TFromIntersect<Types extends TSchema[], PropertyKeys extends PropertyKey[], Result extends TSchema[] = []> = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromIntersect<R, PropertyKeys, [...Result, TOmit<L, PropertyKeys>]> : Result);
|
|
15
15
|
type TFromUnion<T extends TSchema[], K extends PropertyKey[], Result extends TSchema[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromUnion<R, K, [...Result, TOmit<L, K>]> : Result);
|
|
16
16
|
type TFromProperties<Properties extends TProperties, PropertyKeys extends PropertyKey[], UnionKey extends PropertyKey = TupleToUnion<PropertyKeys>> = (Evaluate<Omit<Properties, UnionKey>>);
|
|
17
|
-
type TFromObject<
|
|
17
|
+
type TFromObject<_Type extends TObject, PropertyKeys extends PropertyKey[], Properties extends TProperties, MappedProperties extends TProperties = TFromProperties<Properties, PropertyKeys>, Result extends TSchema = TObject<MappedProperties>> = Result;
|
|
18
18
|
type TUnionFromPropertyKeys<PropertyKeys extends PropertyKey[], Result extends TLiteral[] = []> = (PropertyKeys extends [infer Key extends PropertyKey, ...infer Rest extends PropertyKey[]] ? Key extends TLiteralValue ? TUnionFromPropertyKeys<Rest, [...Result, TLiteral<Key>]> : TUnionFromPropertyKeys<Rest, [...Result]> : TUnion<Result>);
|
|
19
|
-
export type TOmitResolve<Properties extends TProperties, PropertyKeys extends PropertyKey[]> = (Properties extends TRecursive<infer Types extends TSchema> ? TRecursive<TOmitResolve<Types, PropertyKeys>> : Properties extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromIntersect<Types, PropertyKeys>> : Properties extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromUnion<Types, PropertyKeys>> : Properties extends TObject<infer
|
|
19
|
+
export type TOmitResolve<Properties extends TProperties, PropertyKeys extends PropertyKey[]> = (Properties extends TRecursive<infer Types extends TSchema> ? TRecursive<TOmitResolve<Types, PropertyKeys>> : Properties extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromIntersect<Types, PropertyKeys>> : Properties extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromUnion<Types, PropertyKeys>> : Properties extends TObject<infer Properties extends TProperties> ? TFromObject<TObject, PropertyKeys, Properties> : TObject<{}>);
|
|
20
20
|
type TResolvePropertyKeys<Key extends TSchema | PropertyKey[]> = Key extends TSchema ? TIndexPropertyKeys<Key> : Key;
|
|
21
21
|
type TResolveTypeKey<Key extends TSchema | PropertyKey[]> = Key extends PropertyKey[] ? TUnionFromPropertyKeys<Key> : Key;
|
|
22
22
|
export type TOmit<Type extends TSchema, Key extends TSchema | PropertyKey[], IsTypeRef extends boolean = Type extends TRef ? true : false, IsKeyRef extends boolean = Key extends TRef ? true : false> = (Type extends TMappedResult ? TOmitFromMappedResult<Type, TResolvePropertyKeys<Key>> : Key extends TMappedKey ? TOmitFromMappedKey<Type, Key> : [
|
|
@@ -42,10 +42,10 @@ function FromProperties(properties, propertyKeys) {
|
|
|
42
42
|
return propertyKeys.reduce((T, K2) => FromProperty(T, K2), properties);
|
|
43
43
|
}
|
|
44
44
|
// prettier-ignore
|
|
45
|
-
function FromObject(
|
|
46
|
-
const options = (0, discard_1.Discard)(
|
|
47
|
-
const
|
|
48
|
-
return (0, index_6.Object)(
|
|
45
|
+
function FromObject(type, propertyKeys, properties) {
|
|
46
|
+
const options = (0, discard_1.Discard)(type, [symbols_1.TransformKind, '$id', 'required', 'properties']);
|
|
47
|
+
const mappedProperties = FromProperties(properties, propertyKeys);
|
|
48
|
+
return (0, index_6.Object)(mappedProperties, options);
|
|
49
49
|
}
|
|
50
50
|
// prettier-ignore
|
|
51
51
|
function UnionFromPropertyKeys(propertyKeys) {
|
|
@@ -53,10 +53,10 @@ function UnionFromPropertyKeys(propertyKeys) {
|
|
|
53
53
|
return (0, index_5.Union)(result);
|
|
54
54
|
}
|
|
55
55
|
// prettier-ignore
|
|
56
|
-
function OmitResolve(
|
|
57
|
-
return ((0, kind_1.IsIntersect)(
|
|
58
|
-
(0, kind_1.IsUnion)(
|
|
59
|
-
(0, kind_1.IsObject)(
|
|
56
|
+
function OmitResolve(type, propertyKeys) {
|
|
57
|
+
return ((0, kind_1.IsIntersect)(type) ? (0, index_4.Intersect)(FromIntersect(type.allOf, propertyKeys)) :
|
|
58
|
+
(0, kind_1.IsUnion)(type) ? (0, index_5.Union)(FromUnion(type.anyOf, propertyKeys)) :
|
|
59
|
+
(0, kind_1.IsObject)(type) ? FromObject(type, propertyKeys, type.properties) :
|
|
60
60
|
(0, index_6.Object)({}));
|
|
61
61
|
}
|
|
62
62
|
/** `[Json]` Constructs a type whose keys are picked from the given type */
|
|
@@ -1,10 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
3
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
37
|
exports.Parameters = Parameters;
|
|
5
38
|
const index_1 = require("../tuple/index");
|
|
6
39
|
const index_2 = require("../never/index");
|
|
7
|
-
const KindGuard = require("../guard/kind");
|
|
40
|
+
const KindGuard = __importStar(require("../guard/kind"));
|
|
8
41
|
/** `[JavaScript]` Extracts the Parameters from the given Function type */
|
|
9
42
|
function Parameters(schema, options) {
|
|
10
43
|
return (KindGuard.IsFunction(schema) ? (0, index_1.Tuple)(schema.parameters, options) : (0, index_2.Never)());
|
|
@@ -25,9 +25,9 @@ type TFromRef<Ref extends string> = Ensure<TComputed<'Partial', [TRef<Ref>]>>;
|
|
|
25
25
|
type TFromProperties<Properties extends TProperties> = Evaluate<{
|
|
26
26
|
[K in keyof Properties]: Properties[K] extends (TReadonlyOptional<infer S>) ? TReadonlyOptional<S> : Properties[K] extends (TReadonly<infer S>) ? TReadonlyOptional<S> : Properties[K] extends (TOptional<infer S>) ? TOptional<S> : TOptional<Properties[K]>;
|
|
27
27
|
}>;
|
|
28
|
-
type TFromObject<
|
|
28
|
+
type TFromObject<_Type extends TObject, Properties extends TProperties, MappedProperties extends TProperties = TFromProperties<Properties>, Result extends TSchema = TObject<MappedProperties>> = Result;
|
|
29
29
|
type TFromRest<Types extends TSchema[], Result extends TSchema[] = []> = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest<R, [...Result, TPartial<L>]> : Result);
|
|
30
|
-
export type TPartial<Type extends TSchema> = (Type extends TRecursive<infer Type extends TSchema> ? TRecursive<TPartial<Type>> : Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed<Target, Parameters> : Type extends TRef<infer Ref extends string> ? TFromRef<Ref> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromRest<Types>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromRest<Types>> : Type extends TObject<infer Properties extends TProperties> ? TFromObject<TObject
|
|
30
|
+
export type TPartial<Type extends TSchema> = (Type extends TRecursive<infer Type extends TSchema> ? TRecursive<TPartial<Type>> : Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed<Target, Parameters> : Type extends TRef<infer Ref extends string> ? TFromRef<Ref> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromRest<Types>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromRest<Types>> : Type extends TObject<infer Properties extends TProperties> ? TFromObject<TObject, Properties> : Type extends TBigInt ? Type : Type extends TBoolean ? Type : Type extends TInteger ? Type : Type extends TLiteral ? Type : Type extends TNull ? Type : Type extends TNumber ? Type : Type extends TString ? Type : Type extends TSymbol ? Type : Type extends TUndefined ? Type : TObject<{}>);
|
|
31
31
|
/** `[Json]` Constructs a type where all properties are optional */
|
|
32
32
|
export declare function Partial<MappedResult extends TMappedResult>(type: MappedResult, options?: SchemaOptions): TPartialFromMappedResult<MappedResult>;
|
|
33
33
|
/** `[Json]` Constructs a type where all properties are optional */
|
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
3
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
37
|
exports.Partial = Partial;
|
|
5
38
|
const type_1 = require("../create/type");
|
|
@@ -15,7 +48,7 @@ const partial_from_mapped_result_1 = require("./partial-from-mapped-result");
|
|
|
15
48
|
// ------------------------------------------------------------------
|
|
16
49
|
// KindGuard
|
|
17
50
|
// ------------------------------------------------------------------
|
|
18
|
-
const KindGuard = require("../guard/kind");
|
|
51
|
+
const KindGuard = __importStar(require("../guard/kind"));
|
|
19
52
|
// prettier-ignore
|
|
20
53
|
function FromComputed(target, parameters) {
|
|
21
54
|
return (0, index_1.Computed)('Partial', [(0, index_1.Computed)(target, parameters)]);
|
|
@@ -32,10 +65,10 @@ function FromProperties(properties) {
|
|
|
32
65
|
return partialProperties;
|
|
33
66
|
}
|
|
34
67
|
// prettier-ignore
|
|
35
|
-
function FromObject(type) {
|
|
68
|
+
function FromObject(type, properties) {
|
|
36
69
|
const options = (0, index_7.Discard)(type, [index_8.TransformKind, '$id', 'required', 'properties']);
|
|
37
|
-
const
|
|
38
|
-
return (0, index_3.Object)(
|
|
70
|
+
const mappedProperties = FromProperties(properties);
|
|
71
|
+
return (0, index_3.Object)(mappedProperties, options);
|
|
39
72
|
}
|
|
40
73
|
// prettier-ignore
|
|
41
74
|
function FromRest(types) {
|
|
@@ -52,7 +85,7 @@ function PartialResolve(type) {
|
|
|
52
85
|
KindGuard.IsRef(type) ? FromRef(type.$ref) :
|
|
53
86
|
KindGuard.IsIntersect(type) ? (0, index_4.Intersect)(FromRest(type.allOf)) :
|
|
54
87
|
KindGuard.IsUnion(type) ? (0, index_5.Union)(FromRest(type.anyOf)) :
|
|
55
|
-
KindGuard.IsObject(type) ? FromObject(type) :
|
|
88
|
+
KindGuard.IsObject(type) ? FromObject(type, type.properties) :
|
|
56
89
|
// Intrinsic
|
|
57
90
|
KindGuard.IsBigInt(type) ? type :
|
|
58
91
|
KindGuard.IsBoolean(type) ? type :
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TSchema, SchemaOptions } from '../schema/index';
|
|
2
|
-
import type { TupleToUnion, Evaluate
|
|
2
|
+
import type { TupleToUnion, Evaluate } from '../helpers/index';
|
|
3
3
|
import { type TRecursive } from '../recursive/index';
|
|
4
4
|
import { type TComputed } from '../computed/index';
|
|
5
5
|
import { type TIntersect } from '../intersect/index';
|
|
@@ -14,9 +14,9 @@ import { type TPickFromMappedResult } from './pick-from-mapped-result';
|
|
|
14
14
|
type TFromIntersect<Types extends TSchema[], PropertyKeys extends PropertyKey[], Result extends TSchema[] = []> = Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromIntersect<R, PropertyKeys, [...Result, TPick<L, PropertyKeys>]> : Result;
|
|
15
15
|
type TFromUnion<Types extends TSchema[], PropertyKeys extends PropertyKey[], Result extends TSchema[] = []> = Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromUnion<R, PropertyKeys, [...Result, TPick<L, PropertyKeys>]> : Result;
|
|
16
16
|
type TFromProperties<Properties extends TProperties, PropertyKeys extends PropertyKey[], UnionKeys extends PropertyKey = TupleToUnion<PropertyKeys>> = (Evaluate<Pick<Properties, UnionKeys & keyof Properties>>);
|
|
17
|
-
type TFromObject<
|
|
17
|
+
type TFromObject<_Type extends TObject, Keys extends PropertyKey[], Properties extends TProperties, MappedProperties extends TProperties = TFromProperties<Properties, Keys>, Result extends TSchema = TObject<MappedProperties>> = Result;
|
|
18
18
|
type TUnionFromPropertyKeys<PropertyKeys extends PropertyKey[], Result extends TLiteral[] = []> = (PropertyKeys extends [infer Key extends PropertyKey, ...infer Rest extends PropertyKey[]] ? Key extends TLiteralValue ? TUnionFromPropertyKeys<Rest, [...Result, TLiteral<Key>]> : TUnionFromPropertyKeys<Rest, [...Result]> : TUnion<Result>);
|
|
19
|
-
export type TPickResolve<
|
|
19
|
+
export type TPickResolve<Type extends TProperties, PropertyKeys extends PropertyKey[]> = (Type extends TRecursive<infer Types extends TSchema> ? TRecursive<TPickResolve<Types, PropertyKeys>> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromIntersect<Types, PropertyKeys>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromUnion<Types, PropertyKeys>> : Type extends TObject<infer Properties extends TProperties> ? TFromObject<TObject, PropertyKeys, Properties> : TObject<{}>);
|
|
20
20
|
type TResolvePropertyKeys<Key extends TSchema | PropertyKey[]> = Key extends TSchema ? TIndexPropertyKeys<Key> : Key;
|
|
21
21
|
type TResolveTypeKey<Key extends TSchema | PropertyKey[]> = Key extends PropertyKey[] ? TUnionFromPropertyKeys<Key> : Key;
|
|
22
22
|
export type TPick<Type extends TSchema, Key extends TSchema | PropertyKey[], IsTypeRef extends boolean = Type extends TRef ? true : false, IsKeyRef extends boolean = Key extends TRef ? true : false> = (Type extends TMappedResult ? TPickFromMappedResult<Type, TResolvePropertyKeys<Key>> : Key extends TMappedKey ? TPickFromMappedKey<Type, Key> : [
|
|
@@ -37,10 +37,10 @@ function FromProperties(properties, propertyKeys) {
|
|
|
37
37
|
return result;
|
|
38
38
|
}
|
|
39
39
|
// prettier-ignore
|
|
40
|
-
function FromObject(
|
|
41
|
-
const options = (0, discard_1.Discard)(
|
|
42
|
-
const
|
|
43
|
-
return (0, index_4.Object)(
|
|
40
|
+
function FromObject(Type, keys, properties) {
|
|
41
|
+
const options = (0, discard_1.Discard)(Type, [symbols_1.TransformKind, '$id', 'required', 'properties']);
|
|
42
|
+
const mappedProperties = FromProperties(properties, keys);
|
|
43
|
+
return (0, index_4.Object)(mappedProperties, options);
|
|
44
44
|
}
|
|
45
45
|
// prettier-ignore
|
|
46
46
|
function UnionFromPropertyKeys(propertyKeys) {
|
|
@@ -48,10 +48,10 @@ function UnionFromPropertyKeys(propertyKeys) {
|
|
|
48
48
|
return (0, index_5.Union)(result);
|
|
49
49
|
}
|
|
50
50
|
// prettier-ignore
|
|
51
|
-
function PickResolve(
|
|
52
|
-
return ((0, kind_1.IsIntersect)(
|
|
53
|
-
(0, kind_1.IsUnion)(
|
|
54
|
-
(0, kind_1.IsObject)(
|
|
51
|
+
function PickResolve(type, propertyKeys) {
|
|
52
|
+
return ((0, kind_1.IsIntersect)(type) ? (0, index_2.Intersect)(FromIntersect(type.allOf, propertyKeys)) :
|
|
53
|
+
(0, kind_1.IsUnion)(type) ? (0, index_5.Union)(FromUnion(type.anyOf, propertyKeys)) :
|
|
54
|
+
(0, kind_1.IsObject)(type) ? FromObject(type, propertyKeys, type.properties) :
|
|
55
55
|
(0, index_4.Object)({}));
|
|
56
56
|
}
|
|
57
57
|
/** `[Json]` Constructs a type whose keys are picked from the given type */
|
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
3
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
37
|
exports.TypeRegistry = exports.FormatRegistry = void 0;
|
|
5
|
-
exports.FormatRegistry = require("./format");
|
|
6
|
-
exports.TypeRegistry = require("./type");
|
|
38
|
+
exports.FormatRegistry = __importStar(require("./format"));
|
|
39
|
+
exports.TypeRegistry = __importStar(require("./type"));
|
|
@@ -25,9 +25,9 @@ type TFromRef<Ref extends string> = Ensure<TComputed<'Required', [TRef<Ref>]>>;
|
|
|
25
25
|
type TFromProperties<Properties extends TProperties> = Evaluate<{
|
|
26
26
|
[K in keyof Properties]: Properties[K] extends (TReadonlyOptional<infer S>) ? TReadonly<S> : Properties[K] extends (TReadonly<infer S>) ? TReadonly<S> : Properties[K] extends (TOptional<infer S>) ? S : Properties[K];
|
|
27
27
|
}>;
|
|
28
|
-
type TFromObject<
|
|
28
|
+
type TFromObject<_Type extends TObject, Properties extends TProperties, MappedProperties extends TProperties = TFromProperties<Properties>, Result extends TSchema = TObject<MappedProperties>> = Result;
|
|
29
29
|
type TFromRest<Types extends TSchema[], Result extends TSchema[] = []> = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest<R, [...Result, TRequired<L>]> : Result);
|
|
30
|
-
export type TRequired<Type extends TSchema> = (Type extends TRecursive<infer Type extends TSchema> ? TRecursive<TRequired<Type>> : Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed<Target, Parameters> : Type extends TRef<infer Ref extends string> ? TFromRef<Ref> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromRest<Types>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromRest<Types>> : Type extends TObject<infer Properties extends TProperties> ? TFromObject<TObject
|
|
30
|
+
export type TRequired<Type extends TSchema> = (Type extends TRecursive<infer Type extends TSchema> ? TRecursive<TRequired<Type>> : Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed<Target, Parameters> : Type extends TRef<infer Ref extends string> ? TFromRef<Ref> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromRest<Types>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromRest<Types>> : Type extends TObject<infer Properties extends TProperties> ? TFromObject<TObject, Properties> : Type extends TBigInt ? Type : Type extends TBoolean ? Type : Type extends TInteger ? Type : Type extends TLiteral ? Type : Type extends TNull ? Type : Type extends TNumber ? Type : Type extends TString ? Type : Type extends TSymbol ? Type : Type extends TUndefined ? Type : TObject<{}>);
|
|
31
31
|
/** `[Json]` Constructs a type where all properties are required */
|
|
32
32
|
export declare function Required<MappedResult extends TMappedResult>(type: MappedResult, options?: SchemaOptions): TRequiredFromMappedResult<MappedResult>;
|
|
33
33
|
/** `[Json]` Constructs a type where all properties are required */
|
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
3
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
37
|
exports.Required = Required;
|
|
5
38
|
const type_1 = require("../create/type");
|
|
@@ -14,7 +47,7 @@ const required_from_mapped_result_1 = require("./required-from-mapped-result");
|
|
|
14
47
|
// ------------------------------------------------------------------
|
|
15
48
|
// TypeGuard
|
|
16
49
|
// ------------------------------------------------------------------
|
|
17
|
-
const KindGuard = require("../guard/kind");
|
|
50
|
+
const KindGuard = __importStar(require("../guard/kind"));
|
|
18
51
|
// prettier-ignore
|
|
19
52
|
function FromComputed(target, parameters) {
|
|
20
53
|
return (0, index_1.Computed)('Required', [(0, index_1.Computed)(target, parameters)]);
|
|
@@ -31,10 +64,10 @@ function FromProperties(properties) {
|
|
|
31
64
|
return requiredProperties;
|
|
32
65
|
}
|
|
33
66
|
// prettier-ignore
|
|
34
|
-
function FromObject(type) {
|
|
67
|
+
function FromObject(type, properties) {
|
|
35
68
|
const options = (0, index_7.Discard)(type, [index_6.TransformKind, '$id', 'required', 'properties']);
|
|
36
|
-
const
|
|
37
|
-
return (0, index_2.Object)(
|
|
69
|
+
const mappedProperties = FromProperties(properties);
|
|
70
|
+
return (0, index_2.Object)(mappedProperties, options);
|
|
38
71
|
}
|
|
39
72
|
// prettier-ignore
|
|
40
73
|
function FromRest(types) {
|
|
@@ -51,7 +84,7 @@ function RequiredResolve(type) {
|
|
|
51
84
|
KindGuard.IsRef(type) ? FromRef(type.$ref) :
|
|
52
85
|
KindGuard.IsIntersect(type) ? (0, index_3.Intersect)(FromRest(type.allOf)) :
|
|
53
86
|
KindGuard.IsUnion(type) ? (0, index_4.Union)(FromRest(type.anyOf)) :
|
|
54
|
-
KindGuard.IsObject(type) ? FromObject(type) :
|
|
87
|
+
KindGuard.IsObject(type) ? FromObject(type, type.properties) :
|
|
55
88
|
// Intrinsic
|
|
56
89
|
KindGuard.IsBigInt(type) ? type :
|
|
57
90
|
KindGuard.IsBoolean(type) ? type :
|
|
@@ -1,10 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
3
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
37
|
exports.ReturnType = ReturnType;
|
|
5
38
|
const type_1 = require("../create/type");
|
|
6
39
|
const index_1 = require("../never/index");
|
|
7
|
-
const KindGuard = require("../guard/kind");
|
|
40
|
+
const KindGuard = __importStar(require("../guard/kind"));
|
|
8
41
|
/** `[JavaScript]` Extracts the ReturnType from the given Function type */
|
|
9
42
|
function ReturnType(schema, options) {
|
|
10
43
|
return (KindGuard.IsFunction(schema) ? (0, type_1.CreateType)(schema.returns, options) : (0, index_1.Never)(options));
|
|
@@ -6,10 +6,10 @@ export interface TTuple<T extends TSchema[] = TSchema[]> extends TSchema {
|
|
|
6
6
|
[Kind]: 'Tuple';
|
|
7
7
|
static: TupleStatic<T, this['params']>;
|
|
8
8
|
type: 'array';
|
|
9
|
-
items
|
|
9
|
+
items: T;
|
|
10
10
|
additionalItems?: false;
|
|
11
|
-
minItems:
|
|
12
|
-
maxItems:
|
|
11
|
+
minItems: T['length'];
|
|
12
|
+
maxItems: T['length'];
|
|
13
13
|
}
|
|
14
14
|
/** `[Json]` Creates a Tuple type */
|
|
15
15
|
export declare function Tuple<Types extends TSchema[]>(types: [...Types], options?: SchemaOptions): TTuple<Types>;
|
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
3
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
37
|
exports.Type = exports.JavaScriptTypeBuilder = exports.JsonTypeBuilder = void 0;
|
|
5
38
|
// ------------------------------------------------------------------
|
|
@@ -10,7 +43,7 @@ Object.defineProperty(exports, "JsonTypeBuilder", { enumerable: true, get: funct
|
|
|
10
43
|
// ------------------------------------------------------------------
|
|
11
44
|
// JavaScriptTypeBuilder
|
|
12
45
|
// ------------------------------------------------------------------
|
|
13
|
-
const TypeBuilder = require("./type");
|
|
46
|
+
const TypeBuilder = __importStar(require("./type"));
|
|
14
47
|
const javascript_1 = require("./javascript");
|
|
15
48
|
Object.defineProperty(exports, "JavaScriptTypeBuilder", { enumerable: true, get: function () { return javascript_1.JavaScriptTypeBuilder; } });
|
|
16
49
|
/** JavaScript Type Builder with Static Resolution for TypeScript */
|