Socket
Socket
Sign inDemoInstall

@sinclair/typebox

Package Overview
Dependencies
Maintainers
1
Versions
326
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sinclair/typebox - npm Package Compare versions

Comparing version 0.32.4 to 0.32.9

19

build/require/index.d.ts

@@ -7,2 +7,4 @@ export { Kind, Hint, ReadonlyKind, OptionalKind, TransformKind } from './type/symbols/index';

export { TypeBoxError } from './type/error/index';
export { SetComplement, SetDistinct, SetIncludes, SetIntersect, SetIntersectMany, SetIsSubset, SetUnion, SetUnionMany, type TSetComplement, type TSetDistinct, type TSetIncludes, type TSetIntersect, type TSetIntersectMany, type TSetIsSubset, type TSetUnion, type TSetUnionMany, } from './type/sets/index';
export { Increment, type TIncrement, type Assert, type AssertType, type AssertRest, type AssertProperties, type Ensure, type Evaluate, type TupleToIntersect, type TupleToUnion, type UnionToTuple } from './type/helpers/index';
export { Any, type TAny } from './type/any/index';

@@ -22,7 +24,6 @@ export { Array, type TArray, type ArrayOptions } from './type/array/index';

export { Exclude, type TExclude, type TExcludeFromMappedResult } from './type/exclude/index';
export { Extends, type TExtends, type ExtendsFromMappedResult, type ExtendsFromMappedKey, ExtendsCheck, ExtendsResult, ExtendsUndefinedCheck } from './type/extends/index';
export { Extends, ExtendsCheck, ExtendsResult, ExtendsUndefinedCheck, type TExtends, type ExtendsFromMappedResult, type ExtendsFromMappedKey } from './type/extends/index';
export { Extract, type TExtract, type TExtractFromMappedResult } from './type/extract/index';
export { Function, type TFunction } from './type/function/index';
export { Increment, type Assert, type AssertType, type AssertRest, type AssertProperties, type Ensure, type Evaluate, type TupleToIntersect, type TupleToUnion, type UnionToTuple } from './type/helpers/index';
export { Index, IndexPropertyKeys, IndexFromMappedKey, IndexFromMappedResult, type TIndex, type TIndexPropertyKeys, type TIndexFromMappedKey, type TIndexFromMappedResult } from './type/indexed/index';
export { Index, IndexPropertyKeys, IndexFromPropertyKeys, IndexFromPropertyKey, IndexFromMappedKey, IndexFromMappedResult, type TIndex, type TIndexPropertyKeys, type TIndexFromPropertyKeys, type TIndexFromPropertyKey, type TIndexFromMappedKey, type TIndexFromMappedResult, } from './type/indexed/index';
export { InstanceType, type TInstanceType } from './type/instance-type/index';

@@ -33,5 +34,5 @@ export { Integer, type TInteger, type IntegerOptions } from './type/integer/index';

export { Intrinsic, IntrinsicFromMappedKey, type TIntrinsic, Capitalize, type TCapitalize, Lowercase, type TLowercase, Uncapitalize, type TUncapitalize, Uppercase, type TUppercase } from './type/intrinsic/index';
export { KeyOf, type TKeyOf, type KeyOfFromMappedResult, KeyOfPropertyKeys, KeyOfPattern } from './type/keyof/index';
export { KeyOf, KeyOfPropertyKeys, KeyOfPropertyKeysToRest, KeyOfFromMappedResult, KeyOfPattern, type TKeyOf, type TKeyOfPropertyKeys, type TKeyOfPropertyKeysToRest, type TKeyOfFromMappedResult } from './type/keyof/index';
export { Literal, type TLiteral, type TLiteralValue } from './type/literal/index';
export { Mapped, MappedKey, MappedResult, type TMapped, type TMappedKey, type TMappedResult, type TMappedFunction } from './type/mapped/index';
export { Mapped, MappedKey, MappedResult, MappedFunctionReturnType, type TMapped, type TMappedKey, type TMappedResult, type TMappedFunction, type TMappedFunctionReturnType } from './type/mapped/index';
export { Never, type TNever } from './type/never/index';

@@ -50,3 +51,3 @@ export { Not, type TNot } from './type/not/index';

export { ReadonlyOptional, type TReadonlyOptional } from './type/readonly-optional/index';
export { Record, type TRecord } from './type/record/index';
export { Record, type TRecord, type TRecordOrObject } from './type/record/index';
export { Recursive, type TRecursive, type TThis } from './type/recursive/index';

@@ -59,7 +60,7 @@ export { Ref, type TRef } from './type/ref/index';

export { type TSchema, type TKind, type SchemaOptions, type TAnySchema } from './type/schema/index';
export { type Static, type StaticDecode, type StaticEncode } from './type/static/index';
export { type Static, type StaticDecode, type StaticEncode, type TDecodeType, type TDecodeRest, type TDecodeProperties } from './type/static/index';
export { Strict } from './type/strict/index';
export { String, type TString, type StringOptions, type StringFormatOption, type StringContentEncodingOption } from './type/string/index';
export { Symbol, type TSymbol, type TSymbolValue as SymbolValue } from './type/symbol/index';
export { TemplateLiteral, IsTemplateLiteralFinite, IsTemplateLiteralExpressionFinite, TemplateLiteralParse, TemplateLiteralParseExact, TemplateLiteralGenerate, TemplateLiteralExpressionGenerate, type TTemplateLiteral, type TIsTemplateLiteralFinite, type TTemplateLiteralGenerate, type TTemplateLiteralKind, } from './type/template-literal/index';
export { Symbol, type TSymbol, type TSymbolValue } from './type/symbol/index';
export { TemplateLiteral, TemplateLiteralSyntax, TemplateLiteralGenerate, TemplateLiteralParse, TemplateLiteralParseExact, IsTemplateLiteralFinite, TemplateLiteralExpressionGenerate, IsTemplateLiteralExpressionFinite, type TTemplateLiteral, type TTemplateLiteralSyntax, type TTemplateLiteralGenerate, type TTemplateLiteralKind, type TIsTemplateLiteralFinite, } from './type/template-literal/index';
export { Transform, TransformDecodeBuilder, TransformEncodeBuilder, type TTransform, type TransformOptions, type TransformFunction } from './type/transform/index';

@@ -66,0 +67,0 @@ export { Tuple, type TTuple } from './type/tuple/index';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IntrinsicFromMappedKey = exports.Intrinsic = exports.Iterator = exports.IntersectEvaluated = exports.Intersect = exports.Integer = exports.InstanceType = exports.IndexFromMappedResult = exports.IndexFromMappedKey = exports.IndexPropertyKeys = exports.Index = exports.Increment = exports.Function = exports.Extract = exports.ExtendsUndefinedCheck = exports.ExtendsResult = exports.ExtendsCheck = exports.Extends = exports.Exclude = exports.Enum = exports.Deref = exports.Date = exports.ConstructorParameters = exports.Constructor = exports.Const = exports.Composite = exports.Boolean = exports.BigInt = exports.Awaited = exports.AsyncIterator = exports.Array = exports.Any = exports.TypeBoxError = exports.CloneRest = exports.CloneType = exports.ValueGuard = exports.TypeGuard = exports.FormatRegistry = exports.TypeRegistry = exports.PatternStringExact = exports.PatternString = exports.PatternNumberExact = exports.PatternNumber = exports.PatternBooleanExact = exports.PatternBoolean = exports.TransformKind = exports.OptionalKind = exports.ReadonlyKind = exports.Hint = exports.Kind = void 0;
exports.Undefined = exports.Uint8Array = exports.Tuple = exports.TransformEncodeBuilder = exports.TransformDecodeBuilder = exports.Transform = exports.TemplateLiteralExpressionGenerate = exports.TemplateLiteralGenerate = exports.TemplateLiteralParseExact = exports.TemplateLiteralParse = exports.IsTemplateLiteralExpressionFinite = exports.IsTemplateLiteralFinite = exports.TemplateLiteral = exports.Symbol = exports.String = exports.Strict = exports.ReturnType = exports.Rest = exports.Required = exports.RegExp = exports.Ref = exports.Recursive = exports.Record = exports.ReadonlyOptional = exports.ReadonlyFromMappedResult = exports.Readonly = exports.Promise = exports.Pick = exports.PartialFromMappedResult = exports.Partial = exports.Parameters = exports.OptionalFromMappedResult = exports.Optional = exports.Omit = exports.Object = exports.Number = exports.Null = exports.Not = exports.Never = exports.MappedResult = exports.MappedKey = exports.Mapped = exports.Literal = exports.KeyOfPattern = exports.KeyOfPropertyKeys = exports.KeyOf = exports.Uppercase = exports.Uncapitalize = exports.Lowercase = exports.Capitalize = void 0;
exports.JavaScriptTypeBuilder = exports.JsonTypeBuilder = exports.Type = exports.Void = exports.Unsafe = exports.Unknown = exports.UnionEvaluated = exports.Union = void 0;
exports.IndexFromPropertyKeys = exports.IndexPropertyKeys = exports.Index = exports.Function = exports.Extract = exports.ExtendsUndefinedCheck = exports.ExtendsResult = exports.ExtendsCheck = exports.Extends = exports.Exclude = exports.Enum = exports.Deref = exports.Date = exports.ConstructorParameters = exports.Constructor = exports.Const = exports.Composite = exports.Boolean = exports.BigInt = exports.Awaited = exports.AsyncIterator = exports.Array = exports.Any = exports.Increment = exports.SetUnionMany = exports.SetUnion = exports.SetIsSubset = exports.SetIntersectMany = exports.SetIntersect = exports.SetIncludes = exports.SetDistinct = exports.SetComplement = exports.TypeBoxError = exports.CloneRest = exports.CloneType = exports.ValueGuard = exports.TypeGuard = exports.FormatRegistry = exports.TypeRegistry = exports.PatternStringExact = exports.PatternString = exports.PatternNumberExact = exports.PatternNumber = exports.PatternBooleanExact = exports.PatternBoolean = exports.TransformKind = exports.OptionalKind = exports.ReadonlyKind = exports.Hint = exports.Kind = void 0;
exports.Symbol = exports.String = exports.Strict = exports.ReturnType = exports.Rest = exports.Required = exports.RegExp = exports.Ref = exports.Recursive = exports.Record = exports.ReadonlyOptional = exports.ReadonlyFromMappedResult = exports.Readonly = exports.Promise = exports.Pick = exports.PartialFromMappedResult = exports.Partial = exports.Parameters = exports.OptionalFromMappedResult = exports.Optional = exports.Omit = exports.Object = exports.Number = exports.Null = exports.Not = exports.Never = exports.MappedFunctionReturnType = exports.MappedResult = exports.MappedKey = exports.Mapped = exports.Literal = exports.KeyOfPattern = exports.KeyOfFromMappedResult = exports.KeyOfPropertyKeysToRest = exports.KeyOfPropertyKeys = exports.KeyOf = exports.Uppercase = exports.Uncapitalize = exports.Lowercase = exports.Capitalize = exports.IntrinsicFromMappedKey = exports.Intrinsic = exports.Iterator = exports.IntersectEvaluated = exports.Intersect = exports.Integer = exports.InstanceType = exports.IndexFromMappedResult = exports.IndexFromMappedKey = exports.IndexFromPropertyKey = void 0;
exports.JavaScriptTypeBuilder = exports.JsonTypeBuilder = exports.Type = exports.Void = exports.Unsafe = exports.Unknown = exports.UnionEvaluated = exports.Union = exports.Undefined = exports.Uint8Array = exports.Tuple = exports.TransformEncodeBuilder = exports.TransformDecodeBuilder = exports.Transform = exports.IsTemplateLiteralExpressionFinite = exports.TemplateLiteralExpressionGenerate = exports.IsTemplateLiteralFinite = exports.TemplateLiteralParseExact = exports.TemplateLiteralParse = exports.TemplateLiteralGenerate = exports.TemplateLiteralSyntax = exports.TemplateLiteral = void 0;
// ------------------------------------------------------------------

@@ -32,159 +32,183 @@ // Infrastructure

Object.defineProperty(exports, "CloneRest", { enumerable: true, get: function () { return type_1.CloneRest; } });
// ------------------------------------------------------------------
// Error
// ------------------------------------------------------------------
var index_5 = require("./type/error/index");
Object.defineProperty(exports, "TypeBoxError", { enumerable: true, get: function () { return index_5.TypeBoxError; } });
// ------------------------------------------------------------------
// Type
// Sets
// ------------------------------------------------------------------
var index_6 = require("./type/any/index");
Object.defineProperty(exports, "Any", { enumerable: true, get: function () { return index_6.Any; } });
var index_7 = require("./type/array/index");
Object.defineProperty(exports, "Array", { enumerable: true, get: function () { return index_7.Array; } });
var index_8 = require("./type/async-iterator/index");
Object.defineProperty(exports, "AsyncIterator", { enumerable: true, get: function () { return index_8.AsyncIterator; } });
var index_9 = require("./type/awaited/index");
Object.defineProperty(exports, "Awaited", { enumerable: true, get: function () { return index_9.Awaited; } });
var index_10 = require("./type/bigint/index");
Object.defineProperty(exports, "BigInt", { enumerable: true, get: function () { return index_10.BigInt; } });
var index_11 = require("./type/boolean/index");
Object.defineProperty(exports, "Boolean", { enumerable: true, get: function () { return index_11.Boolean; } });
var index_12 = require("./type/composite/index");
Object.defineProperty(exports, "Composite", { enumerable: true, get: function () { return index_12.Composite; } });
var index_13 = require("./type/const/index");
Object.defineProperty(exports, "Const", { enumerable: true, get: function () { return index_13.Const; } });
var index_14 = require("./type/constructor/index");
Object.defineProperty(exports, "Constructor", { enumerable: true, get: function () { return index_14.Constructor; } });
var index_15 = require("./type/constructor-parameters/index");
Object.defineProperty(exports, "ConstructorParameters", { enumerable: true, get: function () { return index_15.ConstructorParameters; } });
var index_16 = require("./type/date/index");
Object.defineProperty(exports, "Date", { enumerable: true, get: function () { return index_16.Date; } });
var index_17 = require("./type/deref/index");
Object.defineProperty(exports, "Deref", { enumerable: true, get: function () { return index_17.Deref; } });
var index_18 = require("./type/enum/index");
Object.defineProperty(exports, "Enum", { enumerable: true, get: function () { return index_18.Enum; } });
var index_19 = require("./type/exclude/index");
Object.defineProperty(exports, "Exclude", { enumerable: true, get: function () { return index_19.Exclude; } });
var index_20 = require("./type/extends/index");
Object.defineProperty(exports, "Extends", { enumerable: true, get: function () { return index_20.Extends; } });
Object.defineProperty(exports, "ExtendsCheck", { enumerable: true, get: function () { return index_20.ExtendsCheck; } });
Object.defineProperty(exports, "ExtendsResult", { enumerable: true, get: function () { return index_20.ExtendsResult; } });
Object.defineProperty(exports, "ExtendsUndefinedCheck", { enumerable: true, get: function () { return index_20.ExtendsUndefinedCheck; } });
var index_21 = require("./type/extract/index");
Object.defineProperty(exports, "Extract", { enumerable: true, get: function () { return index_21.Extract; } });
var index_22 = require("./type/function/index");
Object.defineProperty(exports, "Function", { enumerable: true, get: function () { return index_22.Function; } });
var index_23 = require("./type/helpers/index");
Object.defineProperty(exports, "Increment", { enumerable: true, get: function () { return index_23.Increment; } });
var index_24 = require("./type/indexed/index");
Object.defineProperty(exports, "Index", { enumerable: true, get: function () { return index_24.Index; } });
Object.defineProperty(exports, "IndexPropertyKeys", { enumerable: true, get: function () { return index_24.IndexPropertyKeys; } });
Object.defineProperty(exports, "IndexFromMappedKey", { enumerable: true, get: function () { return index_24.IndexFromMappedKey; } });
Object.defineProperty(exports, "IndexFromMappedResult", { enumerable: true, get: function () { return index_24.IndexFromMappedResult; } });
var index_25 = require("./type/instance-type/index");
Object.defineProperty(exports, "InstanceType", { enumerable: true, get: function () { return index_25.InstanceType; } });
var index_26 = require("./type/integer/index");
Object.defineProperty(exports, "Integer", { enumerable: true, get: function () { return index_26.Integer; } });
var index_27 = require("./type/intersect/index");
Object.defineProperty(exports, "Intersect", { enumerable: true, get: function () { return index_27.Intersect; } });
Object.defineProperty(exports, "IntersectEvaluated", { enumerable: true, get: function () { return index_27.IntersectEvaluated; } });
var index_28 = require("./type/iterator/index");
Object.defineProperty(exports, "Iterator", { enumerable: true, get: function () { return index_28.Iterator; } });
var index_29 = require("./type/intrinsic/index");
Object.defineProperty(exports, "Intrinsic", { enumerable: true, get: function () { return index_29.Intrinsic; } });
Object.defineProperty(exports, "IntrinsicFromMappedKey", { enumerable: true, get: function () { return index_29.IntrinsicFromMappedKey; } });
Object.defineProperty(exports, "Capitalize", { enumerable: true, get: function () { return index_29.Capitalize; } });
Object.defineProperty(exports, "Lowercase", { enumerable: true, get: function () { return index_29.Lowercase; } });
Object.defineProperty(exports, "Uncapitalize", { enumerable: true, get: function () { return index_29.Uncapitalize; } });
Object.defineProperty(exports, "Uppercase", { enumerable: true, get: function () { return index_29.Uppercase; } });
var index_30 = require("./type/keyof/index");
Object.defineProperty(exports, "KeyOf", { enumerable: true, get: function () { return index_30.KeyOf; } });
Object.defineProperty(exports, "KeyOfPropertyKeys", { enumerable: true, get: function () { return index_30.KeyOfPropertyKeys; } });
Object.defineProperty(exports, "KeyOfPattern", { enumerable: true, get: function () { return index_30.KeyOfPattern; } });
var index_31 = require("./type/literal/index");
Object.defineProperty(exports, "Literal", { enumerable: true, get: function () { return index_31.Literal; } });
var index_32 = require("./type/mapped/index");
Object.defineProperty(exports, "Mapped", { enumerable: true, get: function () { return index_32.Mapped; } });
Object.defineProperty(exports, "MappedKey", { enumerable: true, get: function () { return index_32.MappedKey; } });
Object.defineProperty(exports, "MappedResult", { enumerable: true, get: function () { return index_32.MappedResult; } });
var index_33 = require("./type/never/index");
Object.defineProperty(exports, "Never", { enumerable: true, get: function () { return index_33.Never; } });
var index_34 = require("./type/not/index");
Object.defineProperty(exports, "Not", { enumerable: true, get: function () { return index_34.Not; } });
var index_35 = require("./type/null/index");
Object.defineProperty(exports, "Null", { enumerable: true, get: function () { return index_35.Null; } });
var index_36 = require("./type/number/index");
Object.defineProperty(exports, "Number", { enumerable: true, get: function () { return index_36.Number; } });
var index_37 = require("./type/object/index");
Object.defineProperty(exports, "Object", { enumerable: true, get: function () { return index_37.Object; } });
var index_38 = require("./type/omit/index");
Object.defineProperty(exports, "Omit", { enumerable: true, get: function () { return index_38.Omit; } });
var index_39 = require("./type/optional/index");
Object.defineProperty(exports, "Optional", { enumerable: true, get: function () { return index_39.Optional; } });
Object.defineProperty(exports, "OptionalFromMappedResult", { enumerable: true, get: function () { return index_39.OptionalFromMappedResult; } });
var index_40 = require("./type/parameters/index");
Object.defineProperty(exports, "Parameters", { enumerable: true, get: function () { return index_40.Parameters; } });
var index_41 = require("./type/partial/index");
Object.defineProperty(exports, "Partial", { enumerable: true, get: function () { return index_41.Partial; } });
Object.defineProperty(exports, "PartialFromMappedResult", { enumerable: true, get: function () { return index_41.PartialFromMappedResult; } });
var index_42 = require("./type/pick/index");
Object.defineProperty(exports, "Pick", { enumerable: true, get: function () { return index_42.Pick; } });
var index_43 = require("./type/promise/index");
Object.defineProperty(exports, "Promise", { enumerable: true, get: function () { return index_43.Promise; } });
var index_44 = require("./type/readonly/index");
Object.defineProperty(exports, "Readonly", { enumerable: true, get: function () { return index_44.Readonly; } });
Object.defineProperty(exports, "ReadonlyFromMappedResult", { enumerable: true, get: function () { return index_44.ReadonlyFromMappedResult; } });
var index_45 = require("./type/readonly-optional/index");
Object.defineProperty(exports, "ReadonlyOptional", { enumerable: true, get: function () { return index_45.ReadonlyOptional; } });
var index_46 = require("./type/record/index");
Object.defineProperty(exports, "Record", { enumerable: true, get: function () { return index_46.Record; } });
var index_47 = require("./type/recursive/index");
Object.defineProperty(exports, "Recursive", { enumerable: true, get: function () { return index_47.Recursive; } });
var index_48 = require("./type/ref/index");
Object.defineProperty(exports, "Ref", { enumerable: true, get: function () { return index_48.Ref; } });
var index_49 = require("./type/regexp/index");
Object.defineProperty(exports, "RegExp", { enumerable: true, get: function () { return index_49.RegExp; } });
var index_50 = require("./type/required/index");
Object.defineProperty(exports, "Required", { enumerable: true, get: function () { return index_50.Required; } });
var index_51 = require("./type/rest/index");
Object.defineProperty(exports, "Rest", { enumerable: true, get: function () { return index_51.Rest; } });
var index_52 = require("./type/return-type/index");
Object.defineProperty(exports, "ReturnType", { enumerable: true, get: function () { return index_52.ReturnType; } });
var index_53 = require("./type/strict/index");
Object.defineProperty(exports, "Strict", { enumerable: true, get: function () { return index_53.Strict; } });
var index_54 = require("./type/string/index");
Object.defineProperty(exports, "String", { enumerable: true, get: function () { return index_54.String; } });
var index_55 = require("./type/symbol/index");
Object.defineProperty(exports, "Symbol", { enumerable: true, get: function () { return index_55.Symbol; } });
var index_56 = require("./type/template-literal/index");
Object.defineProperty(exports, "TemplateLiteral", { enumerable: true, get: function () { return index_56.TemplateLiteral; } });
Object.defineProperty(exports, "IsTemplateLiteralFinite", { enumerable: true, get: function () { return index_56.IsTemplateLiteralFinite; } });
Object.defineProperty(exports, "IsTemplateLiteralExpressionFinite", { enumerable: true, get: function () { return index_56.IsTemplateLiteralExpressionFinite; } });
Object.defineProperty(exports, "TemplateLiteralParse", { enumerable: true, get: function () { return index_56.TemplateLiteralParse; } });
Object.defineProperty(exports, "TemplateLiteralParseExact", { enumerable: true, get: function () { return index_56.TemplateLiteralParseExact; } });
Object.defineProperty(exports, "TemplateLiteralGenerate", { enumerable: true, get: function () { return index_56.TemplateLiteralGenerate; } });
Object.defineProperty(exports, "TemplateLiteralExpressionGenerate", { enumerable: true, get: function () { return index_56.TemplateLiteralExpressionGenerate; } });
var index_57 = require("./type/transform/index");
Object.defineProperty(exports, "Transform", { enumerable: true, get: function () { return index_57.Transform; } });
Object.defineProperty(exports, "TransformDecodeBuilder", { enumerable: true, get: function () { return index_57.TransformDecodeBuilder; } });
Object.defineProperty(exports, "TransformEncodeBuilder", { enumerable: true, get: function () { return index_57.TransformEncodeBuilder; } });
var index_58 = require("./type/tuple/index");
Object.defineProperty(exports, "Tuple", { enumerable: true, get: function () { return index_58.Tuple; } });
var index_59 = require("./type/uint8array/index");
Object.defineProperty(exports, "Uint8Array", { enumerable: true, get: function () { return index_59.Uint8Array; } });
var index_60 = require("./type/undefined/index");
Object.defineProperty(exports, "Undefined", { enumerable: true, get: function () { return index_60.Undefined; } });
var index_61 = require("./type/union/index");
Object.defineProperty(exports, "Union", { enumerable: true, get: function () { return index_61.Union; } });
Object.defineProperty(exports, "UnionEvaluated", { enumerable: true, get: function () { return index_61.UnionEvaluated; } });
var index_62 = require("./type/unknown/index");
Object.defineProperty(exports, "Unknown", { enumerable: true, get: function () { return index_62.Unknown; } });
var index_63 = require("./type/unsafe/index");
Object.defineProperty(exports, "Unsafe", { enumerable: true, get: function () { return index_63.Unsafe; } });
var index_64 = require("./type/void/index");
Object.defineProperty(exports, "Void", { enumerable: true, get: function () { return index_64.Void; } });
var index_6 = require("./type/sets/index");
Object.defineProperty(exports, "SetComplement", { enumerable: true, get: function () { return index_6.SetComplement; } });
Object.defineProperty(exports, "SetDistinct", { enumerable: true, get: function () { return index_6.SetDistinct; } });
Object.defineProperty(exports, "SetIncludes", { enumerable: true, get: function () { return index_6.SetIncludes; } });
Object.defineProperty(exports, "SetIntersect", { enumerable: true, get: function () { return index_6.SetIntersect; } });
Object.defineProperty(exports, "SetIntersectMany", { enumerable: true, get: function () { return index_6.SetIntersectMany; } });
Object.defineProperty(exports, "SetIsSubset", { enumerable: true, get: function () { return index_6.SetIsSubset; } });
Object.defineProperty(exports, "SetUnion", { enumerable: true, get: function () { return index_6.SetUnion; } });
Object.defineProperty(exports, "SetUnionMany", { enumerable: true, get: function () { return index_6.SetUnionMany; } });
// ------------------------------------------------------------------
// Helpers
// ------------------------------------------------------------------
var index_7 = require("./type/helpers/index");
Object.defineProperty(exports, "Increment", { enumerable: true, get: function () { return index_7.Increment; } });
// ------------------------------------------------------------------
// Types
// ------------------------------------------------------------------
var index_8 = require("./type/any/index");
Object.defineProperty(exports, "Any", { enumerable: true, get: function () { return index_8.Any; } });
var index_9 = require("./type/array/index");
Object.defineProperty(exports, "Array", { enumerable: true, get: function () { return index_9.Array; } });
var index_10 = require("./type/async-iterator/index");
Object.defineProperty(exports, "AsyncIterator", { enumerable: true, get: function () { return index_10.AsyncIterator; } });
var index_11 = require("./type/awaited/index");
Object.defineProperty(exports, "Awaited", { enumerable: true, get: function () { return index_11.Awaited; } });
var index_12 = require("./type/bigint/index");
Object.defineProperty(exports, "BigInt", { enumerable: true, get: function () { return index_12.BigInt; } });
var index_13 = require("./type/boolean/index");
Object.defineProperty(exports, "Boolean", { enumerable: true, get: function () { return index_13.Boolean; } });
var index_14 = require("./type/composite/index");
Object.defineProperty(exports, "Composite", { enumerable: true, get: function () { return index_14.Composite; } });
var index_15 = require("./type/const/index");
Object.defineProperty(exports, "Const", { enumerable: true, get: function () { return index_15.Const; } });
var index_16 = require("./type/constructor/index");
Object.defineProperty(exports, "Constructor", { enumerable: true, get: function () { return index_16.Constructor; } });
var index_17 = require("./type/constructor-parameters/index");
Object.defineProperty(exports, "ConstructorParameters", { enumerable: true, get: function () { return index_17.ConstructorParameters; } });
var index_18 = require("./type/date/index");
Object.defineProperty(exports, "Date", { enumerable: true, get: function () { return index_18.Date; } });
var index_19 = require("./type/deref/index");
Object.defineProperty(exports, "Deref", { enumerable: true, get: function () { return index_19.Deref; } });
var index_20 = require("./type/enum/index");
Object.defineProperty(exports, "Enum", { enumerable: true, get: function () { return index_20.Enum; } });
var index_21 = require("./type/exclude/index");
Object.defineProperty(exports, "Exclude", { enumerable: true, get: function () { return index_21.Exclude; } });
var index_22 = require("./type/extends/index");
Object.defineProperty(exports, "Extends", { enumerable: true, get: function () { return index_22.Extends; } });
Object.defineProperty(exports, "ExtendsCheck", { enumerable: true, get: function () { return index_22.ExtendsCheck; } });
Object.defineProperty(exports, "ExtendsResult", { enumerable: true, get: function () { return index_22.ExtendsResult; } });
Object.defineProperty(exports, "ExtendsUndefinedCheck", { enumerable: true, get: function () { return index_22.ExtendsUndefinedCheck; } });
var index_23 = require("./type/extract/index");
Object.defineProperty(exports, "Extract", { enumerable: true, get: function () { return index_23.Extract; } });
var index_24 = require("./type/function/index");
Object.defineProperty(exports, "Function", { enumerable: true, get: function () { return index_24.Function; } });
var index_25 = require("./type/indexed/index");
Object.defineProperty(exports, "Index", { enumerable: true, get: function () { return index_25.Index; } });
Object.defineProperty(exports, "IndexPropertyKeys", { enumerable: true, get: function () { return index_25.IndexPropertyKeys; } });
Object.defineProperty(exports, "IndexFromPropertyKeys", { enumerable: true, get: function () { return index_25.IndexFromPropertyKeys; } });
Object.defineProperty(exports, "IndexFromPropertyKey", { enumerable: true, get: function () { return index_25.IndexFromPropertyKey; } });
Object.defineProperty(exports, "IndexFromMappedKey", { enumerable: true, get: function () { return index_25.IndexFromMappedKey; } });
Object.defineProperty(exports, "IndexFromMappedResult", { enumerable: true, get: function () { return index_25.IndexFromMappedResult; } });
var index_26 = require("./type/instance-type/index");
Object.defineProperty(exports, "InstanceType", { enumerable: true, get: function () { return index_26.InstanceType; } });
var index_27 = require("./type/integer/index");
Object.defineProperty(exports, "Integer", { enumerable: true, get: function () { return index_27.Integer; } });
var index_28 = require("./type/intersect/index");
Object.defineProperty(exports, "Intersect", { enumerable: true, get: function () { return index_28.Intersect; } });
Object.defineProperty(exports, "IntersectEvaluated", { enumerable: true, get: function () { return index_28.IntersectEvaluated; } });
var index_29 = require("./type/iterator/index");
Object.defineProperty(exports, "Iterator", { enumerable: true, get: function () { return index_29.Iterator; } });
var index_30 = require("./type/intrinsic/index");
Object.defineProperty(exports, "Intrinsic", { enumerable: true, get: function () { return index_30.Intrinsic; } });
Object.defineProperty(exports, "IntrinsicFromMappedKey", { enumerable: true, get: function () { return index_30.IntrinsicFromMappedKey; } });
Object.defineProperty(exports, "Capitalize", { enumerable: true, get: function () { return index_30.Capitalize; } });
Object.defineProperty(exports, "Lowercase", { enumerable: true, get: function () { return index_30.Lowercase; } });
Object.defineProperty(exports, "Uncapitalize", { enumerable: true, get: function () { return index_30.Uncapitalize; } });
Object.defineProperty(exports, "Uppercase", { enumerable: true, get: function () { return index_30.Uppercase; } });
var index_31 = require("./type/keyof/index");
Object.defineProperty(exports, "KeyOf", { enumerable: true, get: function () { return index_31.KeyOf; } });
Object.defineProperty(exports, "KeyOfPropertyKeys", { enumerable: true, get: function () { return index_31.KeyOfPropertyKeys; } });
Object.defineProperty(exports, "KeyOfPropertyKeysToRest", { enumerable: true, get: function () { return index_31.KeyOfPropertyKeysToRest; } });
Object.defineProperty(exports, "KeyOfFromMappedResult", { enumerable: true, get: function () { return index_31.KeyOfFromMappedResult; } });
Object.defineProperty(exports, "KeyOfPattern", { enumerable: true, get: function () { return index_31.KeyOfPattern; } });
var index_32 = require("./type/literal/index");
Object.defineProperty(exports, "Literal", { enumerable: true, get: function () { return index_32.Literal; } });
var index_33 = require("./type/mapped/index");
Object.defineProperty(exports, "Mapped", { enumerable: true, get: function () { return index_33.Mapped; } });
Object.defineProperty(exports, "MappedKey", { enumerable: true, get: function () { return index_33.MappedKey; } });
Object.defineProperty(exports, "MappedResult", { enumerable: true, get: function () { return index_33.MappedResult; } });
Object.defineProperty(exports, "MappedFunctionReturnType", { enumerable: true, get: function () { return index_33.MappedFunctionReturnType; } });
var index_34 = require("./type/never/index");
Object.defineProperty(exports, "Never", { enumerable: true, get: function () { return index_34.Never; } });
var index_35 = require("./type/not/index");
Object.defineProperty(exports, "Not", { enumerable: true, get: function () { return index_35.Not; } });
var index_36 = require("./type/null/index");
Object.defineProperty(exports, "Null", { enumerable: true, get: function () { return index_36.Null; } });
var index_37 = require("./type/number/index");
Object.defineProperty(exports, "Number", { enumerable: true, get: function () { return index_37.Number; } });
var index_38 = require("./type/object/index");
Object.defineProperty(exports, "Object", { enumerable: true, get: function () { return index_38.Object; } });
var index_39 = require("./type/omit/index");
Object.defineProperty(exports, "Omit", { enumerable: true, get: function () { return index_39.Omit; } });
var index_40 = require("./type/optional/index");
Object.defineProperty(exports, "Optional", { enumerable: true, get: function () { return index_40.Optional; } });
Object.defineProperty(exports, "OptionalFromMappedResult", { enumerable: true, get: function () { return index_40.OptionalFromMappedResult; } });
var index_41 = require("./type/parameters/index");
Object.defineProperty(exports, "Parameters", { enumerable: true, get: function () { return index_41.Parameters; } });
var index_42 = require("./type/partial/index");
Object.defineProperty(exports, "Partial", { enumerable: true, get: function () { return index_42.Partial; } });
Object.defineProperty(exports, "PartialFromMappedResult", { enumerable: true, get: function () { return index_42.PartialFromMappedResult; } });
var index_43 = require("./type/pick/index");
Object.defineProperty(exports, "Pick", { enumerable: true, get: function () { return index_43.Pick; } });
var index_44 = require("./type/promise/index");
Object.defineProperty(exports, "Promise", { enumerable: true, get: function () { return index_44.Promise; } });
var index_45 = require("./type/readonly/index");
Object.defineProperty(exports, "Readonly", { enumerable: true, get: function () { return index_45.Readonly; } });
Object.defineProperty(exports, "ReadonlyFromMappedResult", { enumerable: true, get: function () { return index_45.ReadonlyFromMappedResult; } });
var index_46 = require("./type/readonly-optional/index");
Object.defineProperty(exports, "ReadonlyOptional", { enumerable: true, get: function () { return index_46.ReadonlyOptional; } });
var index_47 = require("./type/record/index");
Object.defineProperty(exports, "Record", { enumerable: true, get: function () { return index_47.Record; } });
var index_48 = require("./type/recursive/index");
Object.defineProperty(exports, "Recursive", { enumerable: true, get: function () { return index_48.Recursive; } });
var index_49 = require("./type/ref/index");
Object.defineProperty(exports, "Ref", { enumerable: true, get: function () { return index_49.Ref; } });
var index_50 = require("./type/regexp/index");
Object.defineProperty(exports, "RegExp", { enumerable: true, get: function () { return index_50.RegExp; } });
var index_51 = require("./type/required/index");
Object.defineProperty(exports, "Required", { enumerable: true, get: function () { return index_51.Required; } });
var index_52 = require("./type/rest/index");
Object.defineProperty(exports, "Rest", { enumerable: true, get: function () { return index_52.Rest; } });
var index_53 = require("./type/return-type/index");
Object.defineProperty(exports, "ReturnType", { enumerable: true, get: function () { return index_53.ReturnType; } });
var index_54 = require("./type/strict/index");
Object.defineProperty(exports, "Strict", { enumerable: true, get: function () { return index_54.Strict; } });
var index_55 = require("./type/string/index");
Object.defineProperty(exports, "String", { enumerable: true, get: function () { return index_55.String; } });
var index_56 = require("./type/symbol/index");
Object.defineProperty(exports, "Symbol", { enumerable: true, get: function () { return index_56.Symbol; } });
var index_57 = require("./type/template-literal/index");
Object.defineProperty(exports, "TemplateLiteral", { enumerable: true, get: function () { return index_57.TemplateLiteral; } });
Object.defineProperty(exports, "TemplateLiteralSyntax", { enumerable: true, get: function () { return index_57.TemplateLiteralSyntax; } });
Object.defineProperty(exports, "TemplateLiteralGenerate", { enumerable: true, get: function () { return index_57.TemplateLiteralGenerate; } });
Object.defineProperty(exports, "TemplateLiteralParse", { enumerable: true, get: function () { return index_57.TemplateLiteralParse; } });
Object.defineProperty(exports, "TemplateLiteralParseExact", { enumerable: true, get: function () { return index_57.TemplateLiteralParseExact; } });
Object.defineProperty(exports, "IsTemplateLiteralFinite", { enumerable: true, get: function () { return index_57.IsTemplateLiteralFinite; } });
Object.defineProperty(exports, "TemplateLiteralExpressionGenerate", { enumerable: true, get: function () { return index_57.TemplateLiteralExpressionGenerate; } });
Object.defineProperty(exports, "IsTemplateLiteralExpressionFinite", { enumerable: true, get: function () { return index_57.IsTemplateLiteralExpressionFinite; } });
var index_58 = require("./type/transform/index");
Object.defineProperty(exports, "Transform", { enumerable: true, get: function () { return index_58.Transform; } });
Object.defineProperty(exports, "TransformDecodeBuilder", { enumerable: true, get: function () { return index_58.TransformDecodeBuilder; } });
Object.defineProperty(exports, "TransformEncodeBuilder", { enumerable: true, get: function () { return index_58.TransformEncodeBuilder; } });
var index_59 = require("./type/tuple/index");
Object.defineProperty(exports, "Tuple", { enumerable: true, get: function () { return index_59.Tuple; } });
var index_60 = require("./type/uint8array/index");
Object.defineProperty(exports, "Uint8Array", { enumerable: true, get: function () { return index_60.Uint8Array; } });
var index_61 = require("./type/undefined/index");
Object.defineProperty(exports, "Undefined", { enumerable: true, get: function () { return index_61.Undefined; } });
var index_62 = require("./type/union/index");
Object.defineProperty(exports, "Union", { enumerable: true, get: function () { return index_62.Union; } });
Object.defineProperty(exports, "UnionEvaluated", { enumerable: true, get: function () { return index_62.UnionEvaluated; } });
var index_63 = require("./type/unknown/index");
Object.defineProperty(exports, "Unknown", { enumerable: true, get: function () { return index_63.Unknown; } });
var index_64 = require("./type/unsafe/index");
Object.defineProperty(exports, "Unsafe", { enumerable: true, get: function () { return index_64.Unsafe; } });
var index_65 = require("./type/void/index");
Object.defineProperty(exports, "Void", { enumerable: true, get: function () { return index_65.Void; } });
// ------------------------------------------------------------------
// Namespace
// ------------------------------------------------------------------
var index_65 = require("./type/type/index");
Object.defineProperty(exports, "Type", { enumerable: true, get: function () { return index_65.Type; } });
Object.defineProperty(exports, "JsonTypeBuilder", { enumerable: true, get: function () { return index_65.JsonTypeBuilder; } });
Object.defineProperty(exports, "JavaScriptTypeBuilder", { enumerable: true, get: function () { return index_65.JavaScriptTypeBuilder; } });
var index_66 = require("./type/type/index");
Object.defineProperty(exports, "Type", { enumerable: true, get: function () { return index_66.Type; } });
Object.defineProperty(exports, "JsonTypeBuilder", { enumerable: true, get: function () { return index_66.JsonTypeBuilder; } });
Object.defineProperty(exports, "JavaScriptTypeBuilder", { enumerable: true, get: function () { return index_66.JavaScriptTypeBuilder; } });

@@ -5,7 +5,6 @@ import type { TSchema, SchemaOptions } from '../schema/index';

import { type TPromise } from '../promise/index';
type TFromRest<T extends TSchema[], Acc extends TSchema[] = []> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest<R, [...Acc, TFromSchema<L>]> : Acc;
type TFromSchema<T extends TSchema> = T extends TIntersect<infer S> ? TIntersect<TFromRest<S>> : T extends TUnion<infer S> ? TUnion<TFromRest<S>> : T extends TPromise<infer S> ? TFromSchema<S> : T;
export type TAwaited<T extends TSchema> = (TFromSchema<T>);
type TFromRest<T extends TSchema[], Acc extends TSchema[] = []> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest<R, [...Acc, TAwaited<L>]> : Acc;
export type TAwaited<T extends TSchema> = T extends TIntersect<infer S> ? TIntersect<TFromRest<S>> : T extends TUnion<infer S> ? TUnion<TFromRest<S>> : T extends TPromise<infer S> ? TAwaited<S> : T;
/** `[JavaScript]` Constructs a type by recursively unwrapping Promise types */
export declare function Awaited<T extends TSchema>(T: T, options?: SchemaOptions): TFromSchema<T>;
export declare function Awaited<T extends TSchema>(T: T, options?: SchemaOptions): TAwaited<T>;
export {};

@@ -14,3 +14,3 @@ "use strict";

function FromRest(T) {
return T.map(L => FromSchema(L));
return T.map(L => AwaitedResolve(L));
}

@@ -27,6 +27,9 @@ // prettier-ignore

function FromPromise(T) {
return FromSchema(T);
return AwaitedResolve(T);
}
// ----------------------------------------------------------------
// AwaitedResolve
// ----------------------------------------------------------------
// prettier-ignore
function FromSchema(T) {
function AwaitedResolve(T) {
return ((0, type_2.IsIntersect)(T) ? FromIntersect(T.allOf) :

@@ -39,4 +42,4 @@ (0, type_2.IsUnion)(T) ? FromUnion(T.anyOf) :

function Awaited(T, options = {}) {
return (0, type_1.CloneType)(FromSchema(T), options);
return (0, type_1.CloneType)(AwaitedResolve(T), options);
}
exports.Awaited = Awaited;

@@ -1,14 +0,18 @@

import type { UnionToTuple, Assert, Evaluate } from '../helpers/index';
import type { TSchema } from '../schema/index';
import type { Evaluate } from '../helpers/index';
import { type TIntersectEvaluated } from '../intersect/index';
import { type TIndexFromPropertyKeys } from '../indexed/index';
import { type TKeyOfPropertyKeys } from '../keyof/index';
import { type TNever } from '../never/index';
import { type TObject, type TProperties, type ObjectOptions } from '../object/index';
import { type TIntersect } from '../intersect/index';
import { type TIndex } from '../indexed/index';
type TCompositeKeys<T extends TObject[], Acc extends PropertyKey = never> = T extends [infer L extends TObject, ...infer R extends TObject[]] ? TCompositeKeys<R, Acc | keyof L['properties']> : Acc;
type TCompositeIndex<T extends TIntersect<TObject[]>, K extends string[], Acc extends TProperties = {}> = K extends [infer L extends string, ...infer R extends string[]] ? TCompositeIndex<T, R, Acc & {
[_ in L]: TIndex<T, [L]>;
}> : Acc;
type TCompositeReduce<T extends TObject[]> = UnionToTuple<TCompositeKeys<T>> extends infer K ? Evaluate<TCompositeIndex<TIntersect<T>, Assert<K, string[]>>> : {};
type TCompositeResolve<T extends TObject[]> = TIntersect<T> extends TIntersect ? TObject<TCompositeReduce<T>> : TObject<{}>;
export type TComposite<T extends TObject[]> = TCompositeResolve<T>;
/** `[Json]` Creates a Composite object type */
export declare function Composite<T extends TObject[]>(T: [...T], options?: ObjectOptions): TComposite<T>;
import { TSetDistinct } from '../sets/index';
type TCompositeKeys<T extends TSchema[], Acc extends PropertyKey[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TCompositeKeys<R, TSetDistinct<[...Acc, ...TKeyOfPropertyKeys<L>]>> : Acc);
type TFilterNever<T extends TSchema[], Acc extends TSchema[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? L extends TNever ? Acc : TFilterNever<R, [...Acc, L]> : Acc);
type TCompositeProperty<T extends TSchema[], K extends PropertyKey, Acc extends TSchema[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TCompositeProperty<R, K, TFilterNever<[...Acc, ...TIndexFromPropertyKeys<L, [K]>]>> : Acc);
type TCompositeProperties<T extends TSchema[], K extends PropertyKey[], Acc = {}> = (K extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TCompositeProperties<T, R, Acc & {
[_ in L]: TIntersectEvaluated<TCompositeProperty<T, L>>;
}> : Acc);
type TCompositeEvaluate<T extends TSchema[], K extends PropertyKey[] = TCompositeKeys<T>, P extends TProperties = Evaluate<TCompositeProperties<T, K>>, R extends TObject = TObject<P>> = R;
export type TComposite<T extends TSchema[]> = TCompositeEvaluate<T>;
export declare function Composite<T extends TSchema[]>(T: [...T], options?: ObjectOptions): TComposite<T>;
export {};

@@ -5,17 +5,40 @@ "use strict";

exports.Composite = void 0;
const index_1 = require("../object/index");
const index_2 = require("../intersect/index");
const index_3 = require("../indexed/index");
const index_4 = require("../keyof/index");
const type_1 = require("../clone/type");
function CompositeResolve(T) {
const intersect = (0, index_2.Intersect)(T, {});
const keys = (0, index_4.KeyOfPropertyKeys)(intersect);
const properties = keys.reduce((acc, key) => ({ ...acc, [key]: (0, index_3.Index)(intersect, [key]) }), {});
return (0, index_1.Object)(properties);
const index_1 = require("../intersect/index");
const index_2 = require("../indexed/index");
const index_3 = require("../keyof/index");
const index_4 = require("../object/index");
const index_5 = require("../sets/index");
// ------------------------------------------------------------------
// TypeGuard
// ------------------------------------------------------------------
const type_1 = require("../guard/type");
// prettier-ignore
function CompositeKeys(T) {
return T.reduce((Acc, L) => {
return (0, index_5.SetDistinct)([...Acc, ...(0, index_3.KeyOfPropertyKeys)(L)]);
}, []);
}
/** `[Json]` Creates a Composite object type */
function Composite(T, options) {
return (0, type_1.CloneType)(CompositeResolve(T), options);
// prettier-ignore
function FilterNever(T) {
return T.filter(L => !(0, type_1.IsNever)(L));
}
// prettier-ignore
function CompositeProperty(T, K) {
return T.reduce((Acc, L) => {
return FilterNever([...Acc, ...(0, index_2.IndexFromPropertyKeys)(L, [K])]);
}, []);
}
// prettier-ignore
function CompositeProperties(T, K) {
return K.reduce((Acc, L) => {
return { ...Acc, [L]: (0, index_1.IntersectEvaluated)(CompositeProperty(T, L)) };
}, {});
}
// prettier-ignore
function Composite(T, options = {}) {
const K = CompositeKeys(T);
const P = CompositeProperties(T, K);
const R = (0, index_4.Object)(P, options);
return R;
}
exports.Composite = Composite;

@@ -14,12 +14,10 @@ import type { TSchema } from '../schema/index';

import type { TObject, TProperties } from '../object/index';
export type TFromRest<T extends TSchema[], Acc extends TSchema[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest<R, [...Acc, DerefResolve<L>]> : Acc);
export type TFromRest<T extends TSchema[], Acc extends TSchema[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest<R, [...Acc, TDeref<L>]> : Acc);
type FromProperties<T extends TProperties> = Evaluate<{
[K in keyof T]: DerefResolve<T[K]>;
[K in keyof T]: TDeref<T[K]>;
}>;
declare function FromProperties(properties: TProperties, references: TSchema[]): TProperties;
export type DerefResolve<T extends TSchema> = T extends TConstructor<infer S extends TSchema[], infer R extends TSchema> ? TConstructor<TFromRest<S>, DerefResolve<R>> : T extends TFunction<infer S extends TSchema[], infer R extends TSchema> ? TFunction<TFromRest<S>, DerefResolve<R>> : T extends TIntersect<infer S extends TSchema[]> ? TIntersect<TFromRest<S>> : T extends TUnion<infer S extends TSchema[]> ? TUnion<TFromRest<S>> : T extends TTuple<infer S extends TSchema[]> ? TTuple<TFromRest<S>> : T extends TObject<infer S extends TProperties> ? TObject<FromProperties<S>> : T extends TArray<infer S extends TSchema> ? TArray<DerefResolve<S>> : T extends TPromise<infer S extends TSchema> ? TPromise<DerefResolve<S>> : T extends TAsyncIterator<infer S extends TSchema> ? TAsyncIterator<DerefResolve<S>> : T extends TIterator<infer S extends TSchema> ? TIterator<DerefResolve<S>> : T extends TRef<infer S extends TSchema> ? DerefResolve<S> : T;
export declare function DerefResolve<T extends TSchema>(schema: T, references: TSchema[]): TDeref<T>;
export type TDeref<T extends TSchema> = DerefResolve<T>;
export type TDeref<T extends TSchema> = T extends TConstructor<infer S extends TSchema[], infer R extends TSchema> ? TConstructor<TFromRest<S>, TDeref<R>> : T extends TFunction<infer S extends TSchema[], infer R extends TSchema> ? TFunction<TFromRest<S>, TDeref<R>> : T extends TIntersect<infer S extends TSchema[]> ? TIntersect<TFromRest<S>> : T extends TUnion<infer S extends TSchema[]> ? TUnion<TFromRest<S>> : T extends TTuple<infer S extends TSchema[]> ? TTuple<TFromRest<S>> : T extends TObject<infer S extends TProperties> ? TObject<FromProperties<S>> : T extends TArray<infer S extends TSchema> ? TArray<TDeref<S>> : T extends TPromise<infer S extends TSchema> ? TPromise<TDeref<S>> : T extends TAsyncIterator<infer S extends TSchema> ? TAsyncIterator<TDeref<S>> : T extends TIterator<infer S extends TSchema> ? TIterator<TDeref<S>> : T extends TRef<infer S extends TSchema> ? TDeref<S> : T;
/** `[Json]` Creates a dereferenced type */
export declare function Deref<T extends TSchema>(schema: T, references: TSchema[]): TDeref<T>;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Deref = exports.DerefResolve = void 0;
exports.Deref = void 0;
const type_1 = require("../clone/type");

@@ -98,3 +98,5 @@ const index_1 = require("../discard/index");

}
exports.DerefResolve = DerefResolve;
// ------------------------------------------------------------------
// TDeref
// ------------------------------------------------------------------
/** `[Json]` Creates a dereferenced type */

@@ -101,0 +103,0 @@ function Deref(schema, references) {

@@ -14,12 +14,9 @@ import type { TSchema, SchemaOptions } from '../schema/index';

}[T]>>>;
type TExcludeTemplateLiteral<T extends TTemplateLiteral, U extends TSchema> = (Exclude<Static<T>, Static<U>> extends infer S ? TExcludeTemplateLiteralResult<Assert<S, string>> : never);
type TExcludeArray<T extends TSchema[], U extends TSchema> = AssertRest<UnionToTuple<{
[K in keyof T]: Static<AssertType<T[K]>> extends Static<U> ? never : T[K];
type TExcludeTemplateLiteral<L extends TTemplateLiteral, R extends TSchema> = (Exclude<Static<L>, Static<R>> extends infer S ? TExcludeTemplateLiteralResult<Assert<S, string>> : never);
type TExcludeRest<L extends TSchema[], R extends TSchema> = AssertRest<UnionToTuple<{
[K in keyof L]: Static<AssertType<L[K]>> extends Static<R> ? never : L[K];
}[number]>> extends infer R extends TSchema[] ? TUnionEvaluated<R> : never;
type TExcludeResolve<T extends TSchema, U extends TSchema> = T extends TTemplateLiteral ? TExcludeTemplateLiteral<T, U> : T extends TUnion<infer S> ? TExcludeArray<S, U> : T extends U ? TNever : T;
export type TExclude<T extends TSchema, U extends TSchema> = TExcludeResolve<T, U>;
export type TExclude<L extends TSchema, R extends TSchema> = (L extends TMappedResult<L> ? TExcludeFromMappedResult<L, R> : L extends TTemplateLiteral ? TExcludeTemplateLiteral<L, R> : L extends TUnion<infer S> ? TExcludeRest<S, R> : L extends R ? TNever : L);
/** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */
export declare function Exclude<L extends TMappedResult, R extends TSchema>(unionType: L, excludedMembers: R, options?: SchemaOptions): TExcludeFromMappedResult<L, R>;
/** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */
export declare function Exclude<L extends TSchema, R extends TSchema>(unionType: L, excludedMembers: R, options?: SchemaOptions): TExclude<L, R>;
export declare function Exclude<L extends TSchema, R extends TSchema>(L: L, R: R, options?: SchemaOptions): TExclude<L, R>;
export {};

@@ -15,23 +15,15 @@ "use strict";

const type_2 = require("../guard/type");
// prettier-ignore
function ExcludeResolve(L, R) {
return ((0, type_2.IsTemplateLiteral)(L) ? ExcludeResolve((0, index_1.TemplateLiteralToUnion)(L), R) :
(0, type_2.IsTemplateLiteral)(R) ? ExcludeResolve(L, (0, index_1.TemplateLiteralToUnion)(R)) :
(0, type_2.IsUnion)(L) ? (() => {
const narrowed = L.anyOf.filter((inner) => (0, index_4.ExtendsCheck)(inner, R) === index_4.ExtendsResult.False);
return (narrowed.length === 1 ? narrowed[0] : (0, index_2.Union)(narrowed));
})() :
(0, index_4.ExtendsCheck)(L, R) !== index_4.ExtendsResult.False ? (0, index_3.Never)() :
L);
function ExcludeRest(L, R) {
const excluded = L.filter((inner) => (0, index_4.ExtendsCheck)(inner, R) === index_4.ExtendsResult.False);
return excluded.length === 1 ? excluded[0] : (0, index_2.Union)(excluded);
}
/** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */
function Exclude(unionType, excludedMembers, options = {}) {
if ((0, type_2.IsMappedResult)(unionType)) {
return (0, exclude_from_mapped_result_1.ExcludeFromMappedResult)(unionType, excludedMembers, options);
}
else {
const E = ExcludeResolve(unionType, excludedMembers);
return (0, type_1.CloneType)(E, options);
}
function Exclude(L, R, options = {}) {
// prettier-ignore
return (0, type_1.CloneType)(((0, type_2.IsMappedResult)(L) ? (0, exclude_from_mapped_result_1.ExcludeFromMappedResult)(L, R, options) :
(0, type_2.IsTemplateLiteral)(L) ? Exclude((0, index_1.TemplateLiteralToUnion)(L), R) :
(0, type_2.IsTemplateLiteral)(R) ? Exclude(L, (0, index_1.TemplateLiteralToUnion)(R)) :
(0, type_2.IsUnion)(L) ? ExcludeRest(L.anyOf, R) :
(0, index_4.ExtendsCheck)(L, R) !== index_4.ExtendsResult.False ? (0, index_3.Never)() : L), options);
}
exports.Exclude = Exclude;

@@ -8,17 +8,15 @@ import type { TSchema, SchemaOptions } from '../schema/index';

import { type Static } from '../static/index';
import { type TNever } from '../never/index';
import { type TUnionEvaluated } from '../union/index';
import { type TExtractFromMappedResult } from './extract-from-mapped-result';
type TFromTemplateLiteralResult<T extends string> = TUnionEvaluated<AssertRest<UnionToTuple<{
type TExtractTemplateLiteralResult<T extends string> = TUnionEvaluated<AssertRest<UnionToTuple<{
[K in T]: TLiteral<K>;
}[T]>>>;
type TFromTemplateLiteral<T extends TTemplateLiteral, U extends TSchema> = Extract<Static<T>, Static<U>> extends infer S ? TFromTemplateLiteralResult<Assert<S, string>> : never;
type TFromArray<T extends TSchema[], U extends TSchema> = AssertRest<UnionToTuple<{
[K in keyof T]: Static<AssertType<T[K]>> extends Static<U> ? T[K] : never;
type TExtractTemplateLiteral<L extends TTemplateLiteral, R extends TSchema> = Extract<Static<L>, Static<R>> extends infer S ? TExtractTemplateLiteralResult<Assert<S, string>> : never;
type TExtractRest<L extends TSchema[], R extends TSchema> = AssertRest<UnionToTuple<{
[K in keyof L]: Static<AssertType<L[K]>> extends Static<R> ? L[K] : never;
}[number]>> extends infer R extends TSchema[] ? TUnionEvaluated<R> : never;
type TExtractResolve<T extends TSchema, U extends TSchema> = (T extends TTemplateLiteral ? TFromTemplateLiteral<T, U> : T extends TUnion<infer S> ? TFromArray<S, U> : T);
export type TExtract<T extends TSchema, U extends TSchema> = TExtractResolve<T, U>;
export type TExtract<L extends TSchema, U extends TSchema> = (L extends TMappedResult ? TExtractFromMappedResult<L, U> : L extends TTemplateLiteral ? TExtractTemplateLiteral<L, U> : L extends TUnion<infer S> ? TExtractRest<S, U> : L extends U ? L : TNever);
/** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */
export declare function Extract<L extends TMappedResult, R extends TSchema>(type: L, union: R, options?: SchemaOptions): TExtractFromMappedResult<L, R>;
/** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */
export declare function Extract<L extends TSchema, R extends TSchema>(type: L, union: R, options?: SchemaOptions): TExtract<L, R>;
export declare function Extract<L extends TSchema, R extends TSchema>(L: L, R: R, options?: SchemaOptions): TExtract<L, R>;
export {};

@@ -15,23 +15,15 @@ "use strict";

const type_2 = require("../guard/type");
// prettier-ignore
function ExtractResolve(L, R) {
return ((0, type_2.IsTemplateLiteral)(L) ? ExtractResolve((0, index_1.TemplateLiteralToUnion)(L), R) :
(0, type_2.IsTemplateLiteral)(R) ? ExtractResolve(L, (0, index_1.TemplateLiteralToUnion)(R)) :
(0, type_2.IsUnion)(L) ? (() => {
const narrowed = L.anyOf.filter((inner) => (0, index_4.ExtendsCheck)(inner, R) !== index_4.ExtendsResult.False);
return (narrowed.length === 1 ? narrowed[0] : (0, index_2.Union)(narrowed));
})() :
(0, index_4.ExtendsCheck)(L, R) !== index_4.ExtendsResult.False ? L :
(0, index_3.Never)());
function ExtractRest(L, R) {
const extracted = L.filter((inner) => (0, index_4.ExtendsCheck)(inner, R) !== index_4.ExtendsResult.False);
return extracted.length === 1 ? extracted[0] : (0, index_2.Union)(extracted);
}
/** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */
function Extract(type, union, options = {}) {
if ((0, type_2.IsMappedResult)(type)) {
return (0, extract_from_mapped_result_1.ExtractFromMappedResult)(type, union, options);
}
else {
const E = ExtractResolve(type, union);
return (0, type_1.CloneType)(E, options);
}
function Extract(L, R, options = {}) {
// prettier-ignore
return (0, type_1.CloneType)(((0, type_2.IsMappedResult)(L) ? (0, extract_from_mapped_result_1.ExtractFromMappedResult)(L, R, options) :
(0, type_2.IsTemplateLiteral)(L) ? Extract((0, index_1.TemplateLiteralToUnion)(L), R) :
(0, type_2.IsTemplateLiteral)(R) ? Extract(L, (0, index_1.TemplateLiteralToUnion)(R)) :
(0, type_2.IsUnion)(L) ? ExtractRest(L.anyOf, R) :
(0, index_4.ExtendsCheck)(L, R) !== index_4.ExtendsResult.False ? L : (0, index_3.Never)()), options);
}
exports.Extract = Extract;

@@ -36,5 +36,5 @@ import type { TSchema } from '../schema/index';

type IncrementReverse<T extends string> = T extends `${infer L}${infer R}` ? `${IncrementReverse<R>}${L}` : T;
export type Increment<T extends string> = IncrementReverse<IncrementStep<IncrementReverse<T>>>;
export type TIncrement<T extends string> = IncrementReverse<IncrementStep<IncrementReverse<T>>>;
/** Increments the given string value + 1 */
export declare function Increment<T extends string>(T: T): Increment<T>;
export declare function Increment<T extends string>(T: T): TIncrement<T>;
export type AssertProperties<T> = T extends TProperties ? T : TProperties;

@@ -41,0 +41,0 @@ export type AssertRest<T, E extends TSchema[] = TSchema[]> = T extends E ? T : [];

import type { TSchema, SchemaOptions } from '../schema/index';
import type { Evaluate } from '../helpers/index';
import type { Ensure, Evaluate } from '../helpers/index';
import type { TProperties } from '../object/index';

@@ -11,4 +11,4 @@ import { type TIndex } from './indexed';

type TMappedIndexProperties<T extends TSchema, K extends TMappedKey> = Evaluate<TMappedIndexPropertyKeys<T, K['keys']>>;
export type TIndexFromMappedKey<T extends TSchema, K extends TMappedKey, P extends TProperties = TMappedIndexProperties<T, K>> = (TMappedResult<P>);
export type TIndexFromMappedKey<T extends TSchema, K extends TMappedKey, P extends TProperties = TMappedIndexProperties<T, K>> = (Ensure<TMappedResult<P>>);
export declare function IndexFromMappedKey<T extends TSchema, K extends TMappedKey, P extends TProperties = TMappedIndexProperties<T, K>>(T: T, K: K, options: SchemaOptions): TMappedResult<P>;
export {};

@@ -16,3 +16,3 @@ import { type TSchema, SchemaOptions } from '../schema/index';

import { type TIndexFromMappedResult } from './indexed-from-mapped-result';
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);
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<TIndexFromPropertyKey<L, K>, TSchema>]> : Acc);
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);

@@ -26,5 +26,7 @@ type TFromIntersect<T extends TSchema[], K extends PropertyKey> = (TIntersectEvaluated<TFromIntersectRest<TFromRest<T, K>>>);

type TFromProperty<T extends TProperties, K extends PropertyKey> = (K extends keyof T ? T[K] : `${AssertPropertyKey<K>}` extends `${AssertPropertyKey<keyof T>}` ? T[AssertPropertyKey<K>] : TNever);
type TFromKey<T extends TSchema, K extends PropertyKey> = (T extends TRecursive<infer S> ? TFromKey<S, K> : T extends TIntersect<infer S> ? TFromIntersect<S, K> : T extends TUnion<infer S> ? TFromUnion<S, K> : T extends TTuple<infer S> ? TFromTuple<S, K> : T extends TArray<infer S> ? TFromArray<S, K> : T extends TObject<infer S> ? TFromProperty<S, K> : TNever);
type TFromKeys<T extends TSchema, K extends PropertyKey[], Acc extends TSchema[] = []> = (K extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TFromKeys<T, R, [...Acc, Assert<TFromKey<T, L>, TSchema>]> : Acc);
type FromSchema<T extends TSchema, K extends PropertyKey[]> = (TUnionEvaluated<TFromKeys<T, K>>);
export type TIndexFromPropertyKey<T extends TSchema, K extends PropertyKey> = (T extends TRecursive<infer S> ? TIndexFromPropertyKey<S, K> : T extends TIntersect<infer S> ? TFromIntersect<S, K> : T extends TUnion<infer S> ? TFromUnion<S, K> : T extends TTuple<infer S> ? TFromTuple<S, K> : T extends TArray<infer S> ? TFromArray<S, K> : T extends TObject<infer S> ? TFromProperty<S, K> : TNever);
export declare function IndexFromPropertyKey<T extends TSchema, K extends PropertyKey>(T: T, K: K): TIndexFromPropertyKey<T, K>;
export type TIndexFromPropertyKeys<T extends TSchema, K extends PropertyKey[], Acc extends TSchema[] = []> = (K extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TIndexFromPropertyKeys<T, R, [...Acc, Assert<TIndexFromPropertyKey<T, L>, TSchema>]> : Acc);
export declare function IndexFromPropertyKeys<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K]): TIndexFromPropertyKeys<T, K>;
type FromSchema<T extends TSchema, K extends PropertyKey[]> = (TUnionEvaluated<TIndexFromPropertyKeys<T, K>>);
declare function FromSchema<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K]): FromSchema<T, K>;

@@ -31,0 +33,0 @@ export type TIndex<T extends TSchema, K extends PropertyKey[]> = (FromSchema<T, K>);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Index = void 0;
exports.Index = exports.IndexFromPropertyKeys = exports.IndexFromPropertyKey = void 0;
const index_1 = require("../never/index");

@@ -18,3 +18,3 @@ const index_2 = require("../intersect/index");

function FromRest(T, K) {
return T.map(L => FromKey(L, K));
return T.map(L => IndexFromPropertyKey(L, K));
}

@@ -54,3 +54,3 @@ // prettier-ignore

// prettier-ignore
function FromKey(T, K) {
function IndexFromPropertyKey(T, K) {
return ((0, type_2.IsIntersect)(T) ? FromIntersect(T.allOf, K) :

@@ -63,9 +63,11 @@ (0, type_2.IsUnion)(T) ? FromUnion(T.anyOf, K) :

}
exports.IndexFromPropertyKey = IndexFromPropertyKey;
// prettier-ignore
function FromKeys(T, K) {
return K.map(L => FromKey(T, L));
function IndexFromPropertyKeys(T, K) {
return K.map(L => IndexFromPropertyKey(T, L));
}
exports.IndexFromPropertyKeys = IndexFromPropertyKeys;
// prettier-ignore
function FromSchema(T, K) {
return ((0, index_3.UnionEvaluated)(FromKeys(T, K)));
return ((0, index_3.UnionEvaluated)(IndexFromPropertyKeys(T, K)));
}

@@ -72,0 +74,0 @@ /** `[Json]` Returns an Indexed property type for the given keys */

import type { SchemaOptions } from '../schema/index';
import type { Ensure, Evaluate } from '../helpers/index';
import type { TProperties } from '../object/index';

@@ -8,5 +9,5 @@ import { type TMappedResult } from '../mapped/index';

});
type TFromMappedResult<R extends TMappedResult> = (TFromProperties<R['properties']>);
export type TKeyOfFromMappedResult<R extends TMappedResult, P extends TProperties = TFromMappedResult<R>> = (TMappedResult<P>);
type TFromMappedResult<R extends TMappedResult> = (Evaluate<TFromProperties<R['properties']>>);
export type TKeyOfFromMappedResult<R extends TMappedResult, P extends TProperties = TFromMappedResult<R>> = (Ensure<TMappedResult<P>>);
export declare function KeyOfFromMappedResult<R extends TMappedResult, P extends TProperties = TFromMappedResult<R>>(R: R, options: SchemaOptions): TMappedResult<P>;
export {};
import type { TSchema } from '../schema/index';
import { type ZeroString, type UnionToTuple, Increment } from '../helpers/index';
import { type ZeroString, type UnionToTuple, type TIncrement } from '../helpers/index';
import type { TRecursive } from '../recursive/index';

@@ -11,7 +11,5 @@ import type { TIntersect } from '../intersect/index';

type TFromRest<T extends TSchema[], Acc extends PropertyKey[][] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest<R, [...Acc, TKeyOfPropertyKeys<L>]> : Acc);
type FromIntersect<T extends TSchema[], C extends PropertyKey[][] = TFromRest<T>, R extends PropertyKey[] = TSetUnionMany<C>> = R;
declare function FromIntersect<T extends TSchema[]>(T: [...T]): FromIntersect<T>;
type FromUnion<T extends TSchema[], C extends PropertyKey[][] = TFromRest<T>, R extends PropertyKey[] = TSetIntersectMany<C>> = R;
declare function FromUnion<T extends TSchema[]>(T: [...T]): FromUnion<T>;
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;
type TFromIntersect<T extends TSchema[], C extends PropertyKey[][] = TFromRest<T>, R extends PropertyKey[] = TSetUnionMany<C>> = R;
type TFromUnion<T extends TSchema[], C extends PropertyKey[][] = TFromRest<T>, R extends PropertyKey[] = TSetIntersectMany<C>> = R;
type TFromTuple<T extends TSchema[], I extends string = ZeroString, Acc extends PropertyKey[] = []> = T extends [infer _ extends TSchema, ...infer R extends TSchema[]] ? TFromTuple<R, TIncrement<I>, [...Acc, I]> : Acc;
type TFromArray<_ extends TSchema> = ([

@@ -21,3 +19,3 @@ '[number]'

type TFromProperties<T extends TProperties> = (UnionToTuple<keyof T>);
export type TKeyOfPropertyKeys<T extends TSchema> = (T extends TRecursive<infer S> ? TKeyOfPropertyKeys<S> : T extends TIntersect<infer S> ? FromIntersect<S> : T extends TUnion<infer S> ? FromUnion<S> : T extends TTuple<infer S> ? TFromTuple<S> : T extends TArray<infer S> ? TFromArray<S> : T extends TObject<infer S> ? TFromProperties<S> : [
export type TKeyOfPropertyKeys<T extends TSchema> = (T extends TRecursive<infer S> ? TKeyOfPropertyKeys<S> : T extends TIntersect<infer S> ? TFromIntersect<S> : T extends TUnion<infer S> ? TFromUnion<S> : T extends TTuple<infer S> ? TFromTuple<S> : T extends TArray<infer S> ? TFromArray<S> : T extends TObject<infer S> ? TFromProperties<S> : [
]);

@@ -24,0 +22,0 @@ /** Returns a tuple of PropertyKeys derived from the given TSchema. */

@@ -10,4 +10,5 @@ import type { TSchema } from '../schema/index';

import { type TKeyOfFromMappedResult } from './keyof-from-mapped-result';
type TFromPropertyKeys<T extends PropertyKey[], Acc extends TSchema[] = []> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? L extends '[number]' ? TFromPropertyKeys<R, [...Acc, TNumber]> : TFromPropertyKeys<R, [...Acc, TLiteral<Assert<L, TLiteralValue>>]> : Acc);
export type TKeyOf<T extends TSchema, K extends PropertyKey[] = TKeyOfPropertyKeys<T>, S extends TSchema[] = TFromPropertyKeys<K>, U = TUnionEvaluated<S>> = (Ensure<U>);
export type TKeyOfPropertyKeysToRest<T extends PropertyKey[], Acc extends TSchema[] = []> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? L extends '[number]' ? TKeyOfPropertyKeysToRest<R, [...Acc, TNumber]> : TKeyOfPropertyKeysToRest<R, [...Acc, TLiteral<Assert<L, TLiteralValue>>]> : Acc);
export declare function KeyOfPropertyKeysToRest<T extends PropertyKey[]>(T: [...T]): TKeyOfPropertyKeysToRest<T>;
export type TKeyOf<T extends TSchema, K extends PropertyKey[] = TKeyOfPropertyKeys<T>, S extends TSchema[] = TKeyOfPropertyKeysToRest<K>, U = TUnionEvaluated<S>> = (Ensure<U>);
/** `[Json]` Creates a KeyOf type */

@@ -17,2 +18,1 @@ export declare function KeyOf<T extends TMappedResult>(T: T, options?: SchemaOptions): TKeyOfFromMappedResult<T>;

export declare function KeyOf<T extends TSchema>(T: T, options?: SchemaOptions): TKeyOf<T>;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.KeyOf = void 0;
exports.KeyOf = exports.KeyOfPropertyKeysToRest = void 0;
const index_1 = require("../literal/index");

@@ -16,5 +16,6 @@ const index_2 = require("../number/index");

// prettier-ignore
function FromPropertyKeys(T) {
function KeyOfPropertyKeysToRest(T) {
return T.map(L => L === '[number]' ? (0, index_2.Number)() : (0, index_1.Literal)(L));
}
exports.KeyOfPropertyKeysToRest = KeyOfPropertyKeysToRest;
/** `[Json]` Creates a KeyOf type */

@@ -27,3 +28,3 @@ function KeyOf(T, options = {}) {

const K = (0, keyof_property_keys_1.KeyOfPropertyKeys)(T);
const S = FromPropertyKeys(K);
const S = KeyOfPropertyKeysToRest(K);
const U = (0, index_3.UnionEvaluated)(S);

@@ -30,0 +31,0 @@ return (0, type_1.CloneType)(U, options);

@@ -36,8 +36,8 @@ import type { TSchema } from '../schema/index';

declare function FromSchemaType<K extends PropertyKey, T extends TSchema>(K: K, T: T): FromSchemaType<K, T>;
type FromMappedFunctionReturnType<K extends PropertyKey[], T extends TSchema, Acc extends TProperties = {}> = (K extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? FromMappedFunctionReturnType<R, T, Acc & {
export type TMappedFunctionReturnType<K extends PropertyKey[], T extends TSchema, Acc extends TProperties = {}> = (K extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TMappedFunctionReturnType<R, T, Acc & {
[_ in L]: FromSchemaType<L, T>;
}> : Acc);
declare function FromMappedFunctionReturnType<K extends PropertyKey[], T extends TSchema>(K: [...K], T: T, Acc?: TProperties): FromMappedFunctionReturnType<K, T>;
export declare function MappedFunctionReturnType<K extends PropertyKey[], T extends TSchema>(K: [...K], T: T, Acc?: TProperties): TMappedFunctionReturnType<K, T>;
export type TMappedFunction<K extends PropertyKey[], I = TMappedKey<K>> = (T: I) => TSchema;
export type TMapped<K extends PropertyKey[], F extends TMappedFunction<K>, R extends TProperties = Evaluate<FromMappedFunctionReturnType<K, ReturnType<F>>>> = Ensure<TObject<R>>;
export type TMapped<K extends PropertyKey[], F extends TMappedFunction<K>, R extends TProperties = Evaluate<TMappedFunctionReturnType<K, ReturnType<F>>>> = Ensure<TObject<R>>;
/** `[Json]` Creates a Mapped object type */

@@ -44,0 +44,0 @@ export declare function Mapped<K extends TSchema, I extends PropertyKey[] = TIndexPropertyKeys<K>, F extends TMappedFunction<I> = TMappedFunction<I>, R extends TMapped<I, F> = TMapped<I, F>>(key: K, map: F, options?: ObjectOptions): R;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Mapped = void 0;
exports.Mapped = exports.MappedFunctionReturnType = void 0;
const index_1 = require("../symbols/index");

@@ -92,3 +92,3 @@ const type_1 = require("../clone/type");

// prettier-ignore
function FromMappedFunctionReturnType(K, T, Acc = {}) {
function MappedFunctionReturnType(K, T, Acc = {}) {
return K.reduce((Acc, L) => {

@@ -98,2 +98,3 @@ return { ...Acc, [L]: FromSchemaType(L, T) };

}
exports.MappedFunctionReturnType = MappedFunctionReturnType;
/** `[Json]` Creates a Mapped object type */

@@ -103,5 +104,5 @@ function Mapped(key, map, options = {}) {

const RT = map({ [index_1.Kind]: 'MappedKey', keys: K });
const R = FromMappedFunctionReturnType(K, RT);
const R = MappedFunctionReturnType(K, RT);
return (0, type_1.CloneType)((0, index_11.Object)(R), options);
}
exports.Mapped = Mapped;
import type { SchemaOptions } from '../schema/index';
import type { Ensure, Evaluate } from '../helpers/index';
import type { TProperties } from '../object/index';

@@ -8,5 +9,5 @@ import { type TMappedResult } from '../mapped/index';

});
type TFromMappedResult<R extends TMappedResult, K extends PropertyKey[]> = (TFromProperties<R['properties'], K>);
export type TOmitFromMappedResult<T extends TMappedResult, K extends PropertyKey[], P extends TProperties = TFromMappedResult<T, K>> = (TMappedResult<P>);
type TFromMappedResult<R extends TMappedResult, K extends PropertyKey[]> = (Evaluate<TFromProperties<R['properties'], K>>);
export type TOmitFromMappedResult<T extends TMappedResult, K extends PropertyKey[], P extends TProperties = TFromMappedResult<T, K>> = (Ensure<TMappedResult<P>>);
export declare function OmitFromMappedResult<R extends TMappedResult, K extends PropertyKey[], P extends TProperties = TFromMappedResult<R, K>>(R: R, K: [...K], options: SchemaOptions): TMappedResult<P>;
export {};

@@ -11,8 +11,6 @@ import type { TSchema, SchemaOptions } from '../schema/index';

import { type TOmitFromMappedResult } from './omit-from-mapped-result';
type TFromIntersect<T extends TSchema[], K extends PropertyKey[], Acc extends TSchema[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromIntersect<R, K, [...Acc, TOmitResolve<L, K>]> : Acc);
type TFromUnion<T extends TSchema[], K extends PropertyKey[], Acc extends TSchema[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromUnion<R, K, [...Acc, TOmitResolve<L, K>]> : Acc);
type TFromIntersect<T extends TSchema[], K extends PropertyKey[], Acc extends TSchema[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromIntersect<R, K, [...Acc, TOmit<L, K>]> : Acc);
type TFromUnion<T extends TSchema[], K extends PropertyKey[], Acc extends TSchema[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromUnion<R, K, [...Acc, TOmit<L, K>]> : Acc);
type TFromProperties<T extends TProperties, K extends PropertyKey[], I extends PropertyKey = TupleToUnion<K>> = Evaluate<Omit<T, I>>;
export type TOmitResolve<T extends TProperties, K extends PropertyKey[]> = T extends TRecursive<infer S> ? TRecursive<TOmitResolve<S, K>> : T extends TIntersect<infer S> ? TIntersect<TFromIntersect<S, K>> : T extends TUnion<infer S> ? TUnion<TFromUnion<S, K>> : T extends TObject<infer S> ? TObject<TFromProperties<S, K>> : TObject<{}>;
export declare function OmitResolve<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K]): TOmitResolve<T, K>;
export type TOmit<T extends TSchema, K extends PropertyKey[]> = TOmitResolve<T, K>;
export type TOmit<T extends TProperties, K extends PropertyKey[]> = T extends TRecursive<infer S> ? TRecursive<TOmit<S, K>> : T extends TIntersect<infer S> ? TIntersect<TFromIntersect<S, K>> : T extends TUnion<infer S> ? TUnion<TFromUnion<S, K>> : T extends TObject<infer S> ? TObject<TFromProperties<S, K>> : TObject<{}>;
/** `[Json]` Constructs a type whose keys are omitted from the given type */

@@ -19,0 +17,0 @@ export declare function Omit<T extends TMappedResult, K extends PropertyKey[]>(T: T, K: [...K], options?: SchemaOptions): TOmitFromMappedResult<T, K>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Omit = exports.OmitResolve = void 0;
exports.Omit = void 0;
const index_1 = require("../intersect/index");

@@ -40,2 +40,5 @@ const index_2 = require("../union/index");

}
// ------------------------------------------------------------------
// OmitResolve
// ------------------------------------------------------------------
// prettier-ignore

@@ -48,3 +51,2 @@ function OmitResolve(T, K) {

}
exports.OmitResolve = OmitResolve;
function Omit(T, K, options = {}) {

@@ -51,0 +53,0 @@ // mapped

import type { SchemaOptions } from '../schema/index';
import type { Ensure, Evaluate } from '../helpers/index';
import type { TProperties } from '../object/index';

@@ -8,5 +9,5 @@ import { type TMappedResult } from '../mapped/index';

});
type TFromMappedResult<R extends TMappedResult> = (TFromProperties<R['properties']>);
export type TPartialFromMappedResult<R extends TMappedResult, P extends TProperties = TFromMappedResult<R>> = (TMappedResult<P>);
type TFromMappedResult<R extends TMappedResult> = (Evaluate<TFromProperties<R['properties']>>);
export type TPartialFromMappedResult<R extends TMappedResult, P extends TProperties = TFromMappedResult<R>> = (Ensure<TMappedResult<P>>);
export declare function PartialFromMappedResult<R extends TMappedResult, P extends TProperties = TFromMappedResult<R>>(R: R, options: SchemaOptions): TMappedResult<P>;
export {};
import type { SchemaOptions } from '../schema/index';
import type { Ensure, Evaluate } from '../helpers/index';
import type { TProperties } from '../object/index';

@@ -8,5 +9,5 @@ import { type TMappedResult } from '../mapped/index';

});
type TFromMappedResult<R extends TMappedResult, K extends PropertyKey[]> = (TFromProperties<R['properties'], K>);
export type TPickFromMappedResult<T extends TMappedResult, K extends PropertyKey[], P extends TProperties = TFromMappedResult<T, K>> = (TMappedResult<P>);
type TFromMappedResult<R extends TMappedResult, K extends PropertyKey[]> = (Evaluate<TFromProperties<R['properties'], K>>);
export type TPickFromMappedResult<T extends TMappedResult, K extends PropertyKey[], P extends TProperties = TFromMappedResult<T, K>> = (Ensure<TMappedResult<P>>);
export declare function PickFromMappedResult<R extends TMappedResult, K extends PropertyKey[], P extends TProperties = TFromMappedResult<R, K>>(R: R, K: [...K], options: SchemaOptions): TMappedResult<P>;
export {};

@@ -11,11 +11,9 @@ import type { TSchema, SchemaOptions } from '../schema/index';

import { type TPickFromMappedResult } from './pick-from-mapped-result';
type FromIntersect<T extends TSchema[], K extends PropertyKey[], Acc extends TSchema[] = []> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? FromIntersect<R, K, [...Acc, PickResolve<L, K>]> : Acc;
type FromIntersect<T extends TSchema[], K extends PropertyKey[], Acc extends TSchema[] = []> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? FromIntersect<R, K, [...Acc, TPick<L, K>]> : Acc;
declare function FromIntersect<T extends TSchema[], K extends PropertyKey[]>(T: T, K: K): FromIntersect<T, K, []>;
type FromUnion<T extends TSchema[], K extends PropertyKey[], Acc extends TSchema[] = []> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? FromUnion<R, K, [...Acc, PickResolve<L, K>]> : Acc;
type FromUnion<T extends TSchema[], K extends PropertyKey[], Acc extends TSchema[] = []> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? FromUnion<R, K, [...Acc, TPick<L, K>]> : Acc;
declare function FromUnion<T extends TSchema[], K extends PropertyKey[]>(T: T, K: K): FromUnion<T, K, []>;
type FromProperties<T extends TProperties, K extends PropertyKey[], I extends PropertyKey = TupleToUnion<K>> = Evaluate<Pick<T, I & keyof T>>;
declare function FromProperties<T extends TProperties, K extends PropertyKey[]>(T: T, K: K): {};
export type PickResolve<T extends TProperties, K extends PropertyKey[]> = T extends TRecursive<infer S> ? TRecursive<PickResolve<S, K>> : T extends TIntersect<infer S> ? TIntersect<FromIntersect<S, K>> : T extends TUnion<infer S> ? TUnion<FromUnion<S, K>> : T extends TObject<infer S> ? TObject<FromProperties<S, K>> : TObject<{}>;
export declare function PickResolve<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K]): PickResolve<T, K>;
export type TPick<T extends TSchema, K extends PropertyKey[]> = PickResolve<T, K>;
export type TPick<T extends TProperties, K extends PropertyKey[]> = T extends TRecursive<infer S> ? TRecursive<TPick<S, K>> : T extends TIntersect<infer S> ? TIntersect<FromIntersect<S, K>> : T extends TUnion<infer S> ? TUnion<FromUnion<S, K>> : T extends TObject<infer S> ? TObject<FromProperties<S, K>> : TObject<{}>;
/** `[Json]` Constructs a type whose keys are picked from the given type */

@@ -22,0 +20,0 @@ export declare function Pick<T extends TMappedResult, K extends PropertyKey[]>(T: T, K: [...K], options?: SchemaOptions): TPickFromMappedResult<T, K>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Pick = exports.PickResolve = void 0;
exports.Pick = void 0;
const index_1 = require("../intersect/index");

@@ -31,2 +31,5 @@ const index_2 = require("../union/index");

}
// ------------------------------------------------------------------
// PickResolve
// ------------------------------------------------------------------
// prettier-ignore

@@ -39,3 +42,2 @@ function PickResolve(T, K) {

}
exports.PickResolve = PickResolve;
function Pick(T, K, options = {}) {

@@ -42,0 +44,0 @@ // mapped

import type { SchemaOptions } from '../schema/index';
import type { Ensure, Evaluate } from '../helpers/index';
import type { TProperties } from '../object/index';

@@ -8,5 +9,5 @@ import { type TMappedResult } from '../mapped/index';

});
type TFromMappedResult<R extends TMappedResult> = (TFromProperties<R['properties']>);
export type TRequiredFromMappedResult<R extends TMappedResult, P extends TProperties = TFromMappedResult<R>> = (TMappedResult<P>);
type TFromMappedResult<R extends TMappedResult> = (Evaluate<TFromProperties<R['properties']>>);
export type TRequiredFromMappedResult<R extends TMappedResult, P extends TProperties = TFromMappedResult<R>> = (Ensure<TMappedResult<P>>);
export declare function RequiredFromMappedResult<R extends TMappedResult, P extends TProperties = TFromMappedResult<R>>(R: R, options: SchemaOptions): TMappedResult<P>;
export {};
export type TSetIncludes<T extends PropertyKey[], S extends PropertyKey> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? S extends L ? true : TSetIncludes<R, S> : false);
/** Returns true if element S is in the set of T */
/** Returns true if element right is in the set of left */
export declare function SetIncludes<T extends PropertyKey[], S extends PropertyKey>(T: [...T], S: S): TSetIncludes<T, S>;
export type SetIsSubset<T extends PropertyKey[], S extends PropertyKey[]> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TSetIncludes<S, L> extends true ? SetIsSubset<R, S> : false : true);
/** Returns true if T is a subset of S */
export declare function SetIsSubset<T extends PropertyKey[], S extends PropertyKey[]>(T: [...T], S: [...S]): SetIsSubset<T, S>;
export type TSetIsSubset<T extends PropertyKey[], S extends PropertyKey[]> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TSetIncludes<S, L> extends true ? TSetIsSubset<R, S> : false : true);
/** Returns true if left is a subset of right */
export declare function SetIsSubset<T extends PropertyKey[], S extends PropertyKey[]>(T: [...T], S: [...S]): TSetIsSubset<T, S>;
export type TSetDistinct<T extends PropertyKey[], Acc extends PropertyKey[] = []> = T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TSetIncludes<Acc, L> extends false ? TSetDistinct<R, [...Acc, L]> : TSetDistinct<R, [...Acc]> : Acc;
/** Returns a distinct set of elements */
export declare function SetDistinct<T extends PropertyKey[]>(T: [...T]): TSetDistinct<T>;
export type TSetIntersect<T extends PropertyKey[], S extends PropertyKey[], Acc extends PropertyKey[] = []> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TSetIncludes<S, L> extends true ? TSetIntersect<R, S, [L, ...Acc]> : TSetIntersect<R, S, [...Acc]> : Acc);
export type TSetIntersect<T extends PropertyKey[], S extends PropertyKey[], Acc extends PropertyKey[] = []> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TSetIncludes<S, L> extends true ? TSetIntersect<R, S, [...Acc, L]> : TSetIntersect<R, S, [...Acc]> : Acc);
/** Returns the Intersect of the given sets */
export declare function SetIntersect<T extends PropertyKey[], S extends PropertyKey[]>(T: [...T], S: [...S]): TSetIntersect<T, S>;
export type TSetUnion<T extends PropertyKey[], S extends PropertyKey[], Acc extends PropertyKey[] = S> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TSetUnion<R, S, [...Acc, L]> : Acc);
export type TSetUnion<T extends PropertyKey[], S extends PropertyKey[]> = ([
...T,
...S
]);
/** Returns the Union of the given sets */

@@ -19,4 +22,4 @@ export declare function SetUnion<T extends PropertyKey[], S extends PropertyKey[]>(T: [...T], S: [...S]): TSetUnion<T, S>;

export declare function SetComplement<T extends PropertyKey[], S extends PropertyKey[]>(T: [...T], S: [...S]): TSetComplement<T, S>;
export type TSetIntersectMany<T extends PropertyKey[][], Acc extends PropertyKey[] = []> = (T extends [infer L extends PropertyKey[]] ? L : T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? TSetIntersectMany<R, TSetIntersect<Acc, L>> : Acc);
/** Returns the Intersect of multiple sets */
type TSetIntersectManyResolve<T extends PropertyKey[][], Acc extends PropertyKey[]> = (T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? TSetIntersectManyResolve<R, TSetIntersect<Acc, L>> : Acc);
export type TSetIntersectMany<T extends PropertyKey[][]> = (T extends [infer L extends PropertyKey[]] ? L : T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? TSetIntersectManyResolve<R, L> : []);
export declare function SetIntersectMany<T extends PropertyKey[][]>(T: [...T]): TSetIntersectMany<T>;

@@ -26,1 +29,2 @@ export type TSetUnionMany<T extends PropertyKey[][], Acc extends PropertyKey[] = []> = (T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? TSetUnionMany<R, TSetUnion<Acc, L>> : Acc);

export declare function SetUnionMany<T extends PropertyKey[][]>(T: [...T]): TSetUnionMany<T>;
export {};

@@ -5,3 +5,3 @@ "use strict";

exports.SetUnionMany = exports.SetIntersectMany = exports.SetComplement = exports.SetUnion = exports.SetIntersect = exports.SetDistinct = exports.SetIsSubset = exports.SetIncludes = void 0;
/** Returns true if element S is in the set of T */
/** Returns true if element right is in the set of left */
// prettier-ignore

@@ -12,3 +12,3 @@ function SetIncludes(T, S) {

exports.SetIncludes = SetIncludes;
/** Returns true if T is a subset of S */
/** Returns true if left is a subset of right */
function SetIsSubset(T, S) {

@@ -39,6 +39,16 @@ return T.every((L) => SetIncludes(S, L));

exports.SetComplement = SetComplement;
/** Returns the Intersect of multiple sets */
// prettier-ignore
function SetIntersectManyResolve(T, Init) {
return T.reduce((Acc, L) => {
return SetIntersect(Acc, L);
}, Init);
}
// prettier-ignore
function SetIntersectMany(T) {
return (T.length === 1 ? T[0] : T.reduce((Acc, L) => [...SetIntersect(Acc, L)], []));
return (T.length === 1
? T[0]
// Use left to initialize the accumulator for resolve
: T.length > 1
? SetIntersectManyResolve(T.slice(1), T[0])
: []);
}

@@ -45,0 +55,0 @@ exports.SetIntersectMany = SetIntersectMany;

@@ -22,9 +22,9 @@ import type { Evaluate } from '../helpers/index';

import type { TTransform } from '../transform/index';
export type DecodeProperties<T extends TProperties> = {
[K in keyof T]: DecodeType<T[K]>;
export type TDecodeProperties<T extends TProperties> = {
[K in keyof T]: TDecodeType<T[K]>;
};
export type DecodeRest<T extends TSchema[], Acc extends TSchema[] = []> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? DecodeRest<R, [...Acc, DecodeType<L>]> : Acc;
export type DecodeType<T extends TSchema> = (T extends TOptional<infer S extends TSchema> ? TOptional<DecodeType<S>> : T extends TReadonly<infer S extends TSchema> ? TReadonly<DecodeType<S>> : T extends TTransform<infer _, infer R> ? TUnsafe<R> : T extends TArray<infer S extends TSchema> ? TArray<DecodeType<S>> : T extends TAsyncIterator<infer S extends TSchema> ? TAsyncIterator<DecodeType<S>> : T extends TConstructor<infer P extends TSchema[], infer R extends TSchema> ? TConstructor<DecodeRest<P>, DecodeType<R>> : T extends TEnum<infer S> ? TEnum<S> : T extends TFunction<infer P extends TSchema[], infer R extends TSchema> ? TFunction<DecodeRest<P>, DecodeType<R>> : T extends TIntersect<infer S extends TSchema[]> ? TIntersect<DecodeRest<S>> : T extends TIterator<infer S extends TSchema> ? TIterator<DecodeType<S>> : T extends TNot<infer S extends TSchema> ? TNot<DecodeType<S>> : T extends TObject<infer S> ? TObject<Evaluate<DecodeProperties<S>>> : T extends TPromise<infer S extends TSchema> ? TPromise<DecodeType<S>> : T extends TRecord<infer K, infer S> ? TRecord<K, DecodeType<S>> : T extends TRecursive<infer S extends TSchema> ? TRecursive<DecodeType<S>> : T extends TRef<infer S extends TSchema> ? TRef<DecodeType<S>> : T extends TTuple<infer S extends TSchema[]> ? TTuple<DecodeRest<S>> : T extends TUnion<infer S extends TSchema[]> ? TUnion<DecodeRest<S>> : T);
export type TDecodeRest<T extends TSchema[], Acc extends TSchema[] = []> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TDecodeRest<R, [...Acc, TDecodeType<L>]> : Acc;
export type TDecodeType<T extends TSchema> = (T extends TOptional<infer S extends TSchema> ? TOptional<TDecodeType<S>> : T extends TReadonly<infer S extends TSchema> ? TReadonly<TDecodeType<S>> : T extends TTransform<infer _, infer R> ? TUnsafe<R> : T extends TArray<infer S extends TSchema> ? TArray<TDecodeType<S>> : T extends TAsyncIterator<infer S extends TSchema> ? TAsyncIterator<TDecodeType<S>> : T extends TConstructor<infer P extends TSchema[], infer R extends TSchema> ? TConstructor<TDecodeRest<P>, TDecodeType<R>> : T extends TEnum<infer S> ? TEnum<S> : T extends TFunction<infer P extends TSchema[], infer R extends TSchema> ? TFunction<TDecodeRest<P>, TDecodeType<R>> : T extends TIntersect<infer S extends TSchema[]> ? TIntersect<TDecodeRest<S>> : T extends TIterator<infer S extends TSchema> ? TIterator<TDecodeType<S>> : T extends TNot<infer S extends TSchema> ? TNot<TDecodeType<S>> : T extends TObject<infer S> ? TObject<Evaluate<TDecodeProperties<S>>> : T extends TPromise<infer S extends TSchema> ? TPromise<TDecodeType<S>> : T extends TRecord<infer K, infer S> ? TRecord<K, TDecodeType<S>> : T extends TRecursive<infer S extends TSchema> ? TRecursive<TDecodeType<S>> : T extends TRef<infer S extends TSchema> ? TRef<TDecodeType<S>> : T extends TTuple<infer S extends TSchema[]> ? TTuple<TDecodeRest<S>> : T extends TUnion<infer S extends TSchema[]> ? TUnion<TDecodeRest<S>> : T);
/** Creates an decoded static type from a TypeBox type */
export type StaticDecode<T extends TSchema, P extends unknown[] = []> = Static<DecodeType<T>, P>;
export type StaticDecode<T extends TSchema, P extends unknown[] = []> = Static<TDecodeType<T>, P>;
/** Creates an encoded static type from a TypeBox type */

@@ -31,0 +31,0 @@ export type StaticEncode<T extends TSchema, P extends unknown[] = []> = Static<T, P>;

@@ -74,3 +74,3 @@ import { type TAny } from '../any/index';

/** `[Json]` Creates a Composite object type */
Composite<T extends TObject[]>(objects: [...T], options?: ObjectOptions): TComposite<T>;
Composite<T extends TSchema[]>(schemas: [...T], options?: ObjectOptions): TComposite<T>;
/** `[JavaScript]` Creates a readonly const type from the given value. */

@@ -77,0 +77,0 @@ Const</* const (not supported in 4.0) */ T>(value: T, options?: SchemaOptions): TConst<T>;

@@ -90,4 +90,4 @@ "use strict";

/** `[Json]` Creates a Composite object type */
Composite(objects, options) {
return (0, index_4.Composite)(objects, options); // (error) TS 5.4.0-dev - review TComposite implementation
Composite(schemas, options) {
return (0, index_4.Composite)(schemas, options); // (error) TS 5.4.0-dev - review TComposite implementation
}

@@ -94,0 +94,0 @@ /** `[JavaScript]` Creates a readonly const type from the given value. */

@@ -60,3 +60,3 @@ "use strict";

if ('default' in union) {
return union.default;
return typeof value === 'function' ? union.default : (0, index_6.Clone)(union.default);
}

@@ -63,0 +63,0 @@ else {

import type { TSchema } from '../../type/schema/index';
/** `[Mutable]` Removes excess properties from a value and returns the result. This function does not check the value and returns an unknown type. You should Check the result before use. Clean is a mutable operation. To avoid mutation, Clone the value first. */
export declare function Clean<T extends TSchema>(schema: T, references: TSchema[], value: unknown): unknown;
export declare function Clean(schema: TSchema, references: TSchema[], value: unknown): unknown;
/** `[Mutable]` Removes excess properties from a value and returns the result. This function does not check the value and returns an unknown type. You should Check the result before use. Clean is a mutable operation. To avoid mutation, Clone the value first. */
export declare function Clean<T extends TSchema>(schema: T): unknown;
export declare function Clean(schema: TSchema, value: unknown): unknown;
import type { TSchema } from '../../type/schema/index';
/** Converts any type mismatched values to their target type if a reasonable conversion is possible. */
export declare function Convert<T extends TSchema>(schema: T, references: TSchema[], value: unknown): unknown;
export declare function Convert(schema: TSchema, references: TSchema[], value: unknown): unknown;
/** Converts any type mismatched values to their target type if a reasonable conversion is possible. */
export declare function Convert<T extends TSchema>(schema: T, value: unknown): unknown;
export declare function Convert(schema: TSchema, value: unknown): unknown;

@@ -7,12 +7,13 @@ "use strict";

const index_2 = require("../check/index");
const index_3 = require("../deref/index");
const index_4 = require("../../type/template-literal/index");
const index_5 = require("../../type/patterns/index");
const index_6 = require("../../type/registry/index");
const index_7 = require("../../type/symbols/index");
const index_8 = require("../../type/error/index");
const index_3 = require("../clone/index");
const index_4 = require("../deref/index");
const index_5 = require("../../type/template-literal/index");
const index_6 = require("../../type/patterns/index");
const index_7 = require("../../type/registry/index");
const index_8 = require("../../type/symbols/index");
const index_9 = require("../../type/error/index");
// ------------------------------------------------------------------
// Errors
// ------------------------------------------------------------------
class ValueCreateError extends index_8.TypeBoxError {
class ValueCreateError extends index_9.TypeBoxError {
constructor(schema, message) {

@@ -25,2 +26,8 @@ super(message);

// ------------------------------------------------------------------
// Default
// ------------------------------------------------------------------
function FromDefault(value) {
return typeof value === 'function' ? value : (0, index_3.Clone)(value);
}
// ------------------------------------------------------------------
// Create

@@ -30,3 +37,3 @@ // ------------------------------------------------------------------

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -45,3 +52,3 @@ else {

else if ('default' in schema) {
return schema.default;
return FromDefault(schema.default);
}

@@ -59,3 +66,3 @@ else if (schema.minItems !== undefined) {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -68,3 +75,3 @@ else {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -77,3 +84,3 @@ else {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -86,3 +93,3 @@ else {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -109,3 +116,3 @@ else {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -121,3 +128,3 @@ else if (schema.minimumTimestamp !== undefined) {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -130,3 +137,3 @@ else {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -142,3 +149,3 @@ else if (schema.minimum !== undefined) {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -164,3 +171,3 @@ else {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -173,3 +180,3 @@ else {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -182,3 +189,3 @@ else {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -191,3 +198,3 @@ else {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -200,3 +207,3 @@ else {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -209,3 +216,3 @@ else {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -221,7 +228,7 @@ else if (schema.minimum !== undefined) {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}
else {
const required = new Set(schema.required);
return (schema.default ||
return (FromDefault(schema.default) ||
Object.entries(schema.properties).reduce((acc, [key, schema]) => {

@@ -234,3 +241,3 @@ return required.has(key) ? { ...acc, [key]: Visit(schema, references) } : { ...acc };

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -244,5 +251,5 @@ else {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}
else if (!(keyPattern === index_5.PatternStringExact || keyPattern === index_5.PatternNumberExact)) {
else if (!(keyPattern === index_6.PatternStringExact || keyPattern === index_6.PatternNumberExact)) {
const propertyKeys = keyPattern.slice(1, keyPattern.length - 1).split('|');

@@ -259,6 +266,6 @@ return propertyKeys.reduce((acc, key) => {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}
else {
return Visit((0, index_3.Deref)(schema, references), references);
return Visit((0, index_4.Deref)(schema, references), references);
}

@@ -268,3 +275,3 @@ }

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -281,3 +288,3 @@ else {

else {
return schema.default;
return FromDefault(schema.default);
}

@@ -290,3 +297,3 @@ }

else {
return schema.default;
return FromDefault(schema.default);
}

@@ -296,3 +303,3 @@ }

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -310,3 +317,3 @@ else if (schema.minLength !== undefined) {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -322,7 +329,7 @@ else if ('value' in schema) {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}
if (!(0, index_4.IsTemplateLiteralFinite)(schema))
if (!(0, index_5.IsTemplateLiteralFinite)(schema))
throw new ValueCreateError(schema, 'Can only create template literals that produce a finite variants. Consider using a default value.');
const generated = (0, index_4.TemplateLiteralGenerate)(schema);
const generated = (0, index_5.TemplateLiteralGenerate)(schema);
return generated[0];

@@ -334,6 +341,6 @@ }

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}
else {
return Visit((0, index_3.Deref)(schema, references), references);
return Visit((0, index_4.Deref)(schema, references), references);
}

@@ -343,3 +350,3 @@ }

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -355,3 +362,3 @@ if (schema.items === undefined) {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -364,3 +371,3 @@ else {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -376,3 +383,3 @@ else if (schema.anyOf.length === 0) {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -388,3 +395,3 @@ else if (schema.minByteLength !== undefined) {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -397,3 +404,3 @@ else {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -406,3 +413,3 @@ else {

if ((0, index_1.HasPropertyKey)(schema, 'default')) {
return schema.default;
return FromDefault(schema.default);
}

@@ -416,3 +423,3 @@ else {

const schema_ = schema;
switch (schema_[index_7.Kind]) {
switch (schema_[index_8.Kind]) {
case 'Any':

@@ -481,3 +488,3 @@ return FromAny(schema_, references_);

default:
if (!index_6.TypeRegistry.Has(schema_[index_7.Kind]))
if (!index_7.TypeRegistry.Has(schema_[index_8.Kind]))
throw new ValueCreateError(schema_, 'Unknown type');

@@ -484,0 +491,0 @@ return FromKind(schema_, references_);

import type { TSchema } from '../../type/schema/index';
/** `[Mutable]` Generates missing properties on a value using default schema annotations if available. This function does not check the value and returns an unknown type. You should Check the result before use. Default is a mutable operation. To avoid mutation, Clone the value first. */
export declare function Default<T extends TSchema>(schema: T, references: TSchema[], value: unknown): unknown;
export declare function Default(schema: TSchema, references: TSchema[], value: unknown): unknown;
/** `[Mutable]` Generates missing properties on a value using default schema annotations if available. This function does not check the value and returns an unknown type. You should Check the result before use. Default is a mutable operation. To avoid mutation, Clone the value first. */
export declare function Default<T extends TSchema>(schema: T, value: unknown): unknown;
export declare function Default(schema: TSchema, value: unknown): unknown;

@@ -6,8 +6,9 @@ "use strict";

const index_1 = require("../check/index");
const index_2 = require("../deref/index");
const index_3 = require("../../type/symbols/index");
const index_2 = require("../clone/index");
const index_3 = require("../deref/index");
const index_4 = require("../../type/symbols/index");
// ------------------------------------------------------------------
// ValueGuard
// ------------------------------------------------------------------
const index_4 = require("../guard/index");
const index_5 = require("../guard/index");
// ------------------------------------------------------------------

@@ -21,3 +22,3 @@ // TypeGuard

function ValueOrDefault(schema, value) {
return !(value === undefined) || !('default' in schema) ? value : schema.default;
return value === undefined && 'default' in schema ? (0, index_2.Clone)(schema.default) : value;
}

@@ -28,3 +29,3 @@ // ------------------------------------------------------------------

function IsCheckable(schema) {
return (0, type_1.IsSchema)(schema) && schema[index_3.Kind] !== 'Unsafe';
return (0, type_1.IsSchema)(schema) && schema[index_4.Kind] !== 'Unsafe';
}

@@ -42,3 +43,3 @@ // ------------------------------------------------------------------

const defaulted = ValueOrDefault(schema, value);
if (!(0, index_4.IsArray)(defaulted))
if (!(0, index_5.IsArray)(defaulted))
return defaulted;

@@ -54,3 +55,3 @@ for (let i = 0; i < defaulted.length; i++) {

const next = Visit(schema, references, defaulted);
return (0, index_4.IsObject)(next) ? { ...acc, ...next } : next;
return (0, index_5.IsObject)(next) ? { ...acc, ...next } : next;
}, {});

@@ -60,3 +61,3 @@ }

const defaulted = ValueOrDefault(schema, value);
if (!(0, index_4.IsObject)(defaulted))
if (!(0, index_5.IsObject)(defaulted))
return defaulted;

@@ -84,3 +85,3 @@ const additionalPropertiesSchema = schema.additionalProperties;

const defaulted = ValueOrDefault(schema, value);
if (!(0, index_4.IsObject)(defaulted))
if (!(0, index_5.IsObject)(defaulted))
return defaulted;

@@ -108,10 +109,10 @@ const additionalPropertiesSchema = schema.additionalProperties;

function FromRef(schema, references, value) {
return Visit((0, index_2.Deref)(schema, references), references, ValueOrDefault(schema, value));
return Visit((0, index_3.Deref)(schema, references), references, ValueOrDefault(schema, value));
}
function FromThis(schema, references, value) {
return Visit((0, index_2.Deref)(schema, references), references, value);
return Visit((0, index_3.Deref)(schema, references), references, value);
}
function FromTuple(schema, references, value) {
const defaulted = ValueOrDefault(schema, value);
if (!(0, index_4.IsArray)(defaulted) || (0, index_4.IsUndefined)(schema.items))
if (!(0, index_5.IsArray)(defaulted) || (0, index_5.IsUndefined)(schema.items))
return defaulted;

@@ -136,5 +137,5 @@ const [items, max] = [schema.items, Math.max(schema.items.length, defaulted.length)];

function Visit(schema, references, value) {
const references_ = (0, index_4.IsString)(schema.$id) ? [...references, schema] : references;
const references_ = (0, index_5.IsString)(schema.$id) ? [...references, schema] : references;
const schema_ = schema;
switch (schema_[index_3.Kind]) {
switch (schema_[index_4.Kind]) {
case 'Array':

@@ -141,0 +142,0 @@ return FromArray(schema_, references_, value);

@@ -19,9 +19,9 @@ import { type Mutable } from '../mutate/index';

/** `[Mutable]` Removes excess properties from a value and returns the result. This function does not check the value and returns an unknown type. You should Check the result before use. Clean is a mutable operation. To avoid mutation, Clone the value first. */
export declare function Clean<T extends TSchema>(schema: T, references: TSchema[], value: unknown): unknown;
export declare function Clean(schema: TSchema, references: TSchema[], value: unknown): unknown;
/** `[Mutable]` Removes excess properties from a value and returns the result. This function does not check the value and returns an unknown type. You should Check the result before use. Clean is a mutable operation. To avoid mutation, Clone the value first. */
export declare function Clean<T extends TSchema>(schema: T, value: unknown): unknown;
export declare function Clean(schema: TSchema, value: unknown): unknown;
/** Converts any type mismatched values to their target type if a reasonable conversion is possible */
export declare function Convert<T extends TSchema>(schema: T, references: TSchema[], value: unknown): unknown;
export declare function Convert(schema: TSchema, references: TSchema[], value: unknown): unknown;
/** Converts any type mismatched values to their target type if a reasonable conversion is possibl. */
export declare function Convert<T extends TSchema>(schema: T, value: unknown): unknown;
export declare function Convert(schema: TSchema, value: unknown): unknown;
/** Returns a structural clone of the given value */

@@ -34,5 +34,5 @@ export declare function Clone<T>(value: T): T;

/** `[Mutable]` Generates missing properties on a value using default schema annotations if available. This function does not check the value and returns an unknown type. You should Check the result before use. Default is a mutable operation. To avoid mutation, Clone the value first. */
export declare function Default<T extends TSchema>(schema: T, references: TSchema[], value: unknown): unknown;
export declare function Default(schema: TSchema, references: TSchema[], value: unknown): unknown;
/** `[Mutable]` Generates missing properties on a value using default schema annotations if available. This function does not check the value and returns an unknown type. You should Check the result before use. Default is a mutable operation. To avoid mutation, Clone the value first. */
export declare function Default<T extends TSchema>(schema: T, value: unknown): unknown;
export declare function Default(schema: TSchema, value: unknown): unknown;
/** Encodes a value or throws if error */

@@ -39,0 +39,0 @@ export declare function Encode<T extends TSchema, R = StaticEncode<T>>(schema: T, references: TSchema[], value: unknown): R;

{
"name": "@sinclair/typebox",
"version": "0.32.4",
"version": "0.32.9",
"description": "Json Schema Type Builder with Static Type Resolution for TypeScript",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc