@sinclair/typebox 0.32.0-dev-16 → 0.32.0-dev-18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/import/compiler/compiler.d.mts +9 -0
- package/build/import/compiler/compiler.mjs +60 -6
- package/build/import/errors/errors.d.mts +3 -0
- package/build/import/errors/errors.mjs +28 -3
- package/build/import/errors/function.d.mts +3 -0
- package/build/import/errors/function.mjs +4 -0
- package/build/import/index.mjs +9 -0
- package/build/import/system/policy.d.mts +10 -0
- package/build/import/system/policy.mjs +13 -0
- package/build/import/system/system.d.mts +3 -0
- package/build/import/system/system.mjs +9 -0
- package/build/import/type/any/any.d.mts +1 -0
- package/build/import/type/any/any.mjs +1 -0
- package/build/import/type/array/array.d.mts +7 -0
- package/build/import/type/array/array.mjs +1 -0
- package/build/import/type/async-iterator/async-iterator.d.mts +1 -0
- package/build/import/type/async-iterator/async-iterator.mjs +1 -0
- package/build/import/type/awaited/awaited.d.mts +7 -6
- package/build/import/type/awaited/awaited.mjs +23 -13
- package/build/import/type/bigint/bigint.d.mts +1 -0
- package/build/import/type/bigint/bigint.mjs +1 -0
- package/build/import/type/boolean/boolean.d.mts +1 -0
- package/build/import/type/boolean/boolean.mjs +1 -0
- package/build/import/type/clone/type.d.mts +2 -0
- package/build/import/type/clone/type.mjs +2 -0
- package/build/import/type/clone/value.d.mts +1 -0
- package/build/import/type/clone/value.mjs +2 -0
- package/build/import/type/composite/composite.d.mts +1 -0
- package/build/import/type/composite/composite.mjs +1 -0
- package/build/import/type/const/const.d.mts +2 -1
- package/build/import/type/const/const.mjs +5 -1
- package/build/import/type/constructor/constructor.d.mts +1 -0
- package/build/import/type/constructor/constructor.mjs +1 -0
- package/build/import/type/constructor-parameters/constructor-parameters.d.mts +1 -0
- package/build/import/type/constructor-parameters/constructor-parameters.mjs +1 -0
- package/build/import/type/date/date.d.mts +6 -0
- package/build/import/type/date/date.mjs +1 -0
- package/build/import/type/deref/deref.d.mts +1 -0
- package/build/import/type/deref/deref.mjs +18 -0
- package/build/import/type/enum/enum.d.mts +1 -0
- package/build/import/type/enum/enum.mjs +1 -0
- package/build/import/type/exclude/exclude-from-mapped-result.mjs +3 -0
- package/build/import/type/exclude/exclude.d.mts +2 -0
- package/build/import/type/exclude/exclude.mjs +3 -0
- package/build/import/type/extends/extends-check.mjs +173 -1
- package/build/import/type/extends/extends-from-mapped-key.mjs +4 -0
- package/build/import/type/extends/extends-from-mapped-result.mjs +3 -0
- package/build/import/type/extends/extends-undefined.d.mts +1 -0
- package/build/import/type/extends/extends-undefined.mjs +3 -0
- package/build/import/type/extends/extends.d.mts +3 -0
- package/build/import/type/extends/extends.mjs +7 -0
- package/build/import/type/extract/extract-from-mapped-result.mjs +3 -0
- package/build/import/type/extract/extract.d.mts +2 -0
- package/build/import/type/extract/extract.mjs +3 -0
- package/build/import/type/function/function.d.mts +1 -0
- package/build/import/type/function/function.mjs +1 -0
- package/build/import/type/guard/type.d.mts +46 -0
- package/build/import/type/guard/type.mjs +84 -1
- package/build/import/type/guard/value.d.mts +14 -0
- package/build/import/type/guard/value.mjs +14 -0
- package/build/import/type/helpers/helpers.d.mts +1 -0
- package/build/import/type/helpers/helpers.mjs +1 -0
- package/build/import/type/indexed/index.d.mts +0 -1
- package/build/import/type/indexed/index.mjs +0 -1
- package/build/import/type/indexed/indexed-from-mapped-key.d.mts +2 -2
- package/build/import/type/indexed/indexed-from-mapped-key.mjs +10 -3
- package/build/import/type/indexed/indexed-property-keys.d.mts +1 -0
- package/build/import/type/indexed/indexed-property-keys.mjs +9 -0
- package/build/import/type/indexed/indexed.d.mts +40 -4
- package/build/import/type/indexed/indexed.mjs +84 -5
- package/build/import/type/instance-type/instance-type.d.mts +1 -0
- package/build/import/type/instance-type/instance-type.mjs +1 -0
- package/build/import/type/integer/integer.d.mts +1 -0
- package/build/import/type/integer/integer.mjs +1 -0
- package/build/import/type/intersect/intersect-create.mjs +8 -0
- package/build/import/type/intersect/intersect-evaluated.d.mts +1 -0
- package/build/import/type/intersect/intersect-evaluated.mjs +9 -0
- package/build/import/type/intersect/intersect.d.mts +1 -0
- package/build/import/type/intersect/intersect.mjs +5 -0
- package/build/import/type/intrinsic/capitalize.d.mts +1 -0
- package/build/import/type/intrinsic/capitalize.mjs +1 -0
- package/build/import/type/intrinsic/intrinsic-from-mapped-key.mjs +4 -0
- package/build/import/type/intrinsic/intrinsic.d.mts +2 -0
- package/build/import/type/intrinsic/intrinsic.mjs +16 -1
- package/build/import/type/intrinsic/lowercase.d.mts +1 -0
- package/build/import/type/intrinsic/lowercase.mjs +1 -0
- package/build/import/type/intrinsic/uncapitalize.d.mts +1 -0
- package/build/import/type/intrinsic/uncapitalize.mjs +1 -0
- package/build/import/type/intrinsic/uppercase.d.mts +1 -0
- package/build/import/type/intrinsic/uppercase.mjs +1 -0
- package/build/import/type/iterator/iterator.d.mts +1 -0
- package/build/import/type/iterator/iterator.mjs +1 -0
- package/build/import/type/keyof/keyof-from-mapped-result.mjs +3 -0
- package/build/import/type/keyof/keyof-property-keys.d.mts +2 -0
- package/build/import/type/keyof/keyof-property-keys.mjs +20 -0
- package/build/import/type/keyof/keyof.d.mts +2 -0
- package/build/import/type/keyof/keyof.mjs +6 -0
- package/build/import/type/literal/literal.d.mts +1 -0
- package/build/import/type/literal/literal.mjs +1 -0
- package/build/import/type/mapped/mapped-key.mjs +1 -0
- package/build/import/type/mapped/mapped-result.mjs +1 -0
- package/build/import/type/mapped/mapped.d.mts +2 -0
- package/build/import/type/mapped/mapped.mjs +19 -1
- package/build/import/type/modifiers/modifiers.mjs +10 -0
- package/build/import/type/never/never.d.mts +1 -0
- package/build/import/type/never/never.mjs +1 -0
- package/build/import/type/not/not.d.mts +1 -0
- package/build/import/type/not/not.mjs +1 -0
- package/build/import/type/null/null.d.mts +1 -0
- package/build/import/type/null/null.mjs +1 -0
- package/build/import/type/number/number.d.mts +1 -0
- package/build/import/type/number/number.mjs +1 -0
- package/build/import/type/object/object.d.mts +5 -0
- package/build/import/type/object/object.mjs +6 -0
- package/build/import/type/omit/omit-from-mapped-key.mjs +4 -0
- package/build/import/type/omit/omit.d.mts +3 -0
- package/build/import/type/omit/omit.mjs +12 -0
- package/build/import/type/operators/operators.d.mts +8 -0
- package/build/import/type/operators/operators.mjs +15 -0
- package/build/import/type/optional/optional.d.mts +1 -0
- package/build/import/type/optional/optional.mjs +1 -0
- package/build/import/type/parameters/parameters.d.mts +1 -0
- package/build/import/type/parameters/parameters.mjs +1 -0
- package/build/import/type/partial/partial-from-mapped-result.mjs +3 -0
- package/build/import/type/partial/partial.d.mts +2 -0
- package/build/import/type/partial/partial.mjs +9 -0
- package/build/import/type/pick/pick-from-mapped-key.mjs +4 -0
- package/build/import/type/pick/pick.d.mts +3 -0
- package/build/import/type/pick/pick.mjs +7 -0
- package/build/import/type/promise/promise.d.mts +1 -0
- package/build/import/type/promise/promise.mjs +1 -0
- package/build/import/type/readonly/readonly.d.mts +1 -0
- package/build/import/type/readonly/readonly.mjs +1 -0
- package/build/import/type/readonly-optional/readonly-optional.d.mts +1 -0
- package/build/import/type/readonly-optional/readonly-optional.mjs +1 -0
- package/build/import/type/record/record.d.mts +11 -9
- package/build/import/type/record/record.mjs +53 -28
- package/build/import/type/recursive/recursive.d.mts +1 -0
- package/build/import/type/recursive/recursive.mjs +3 -0
- package/build/import/type/ref/ref.d.mts +2 -0
- package/build/import/type/ref/ref.mjs +1 -0
- package/build/import/type/regexp/regexp.d.mts +2 -0
- package/build/import/type/regexp/regexp.mjs +1 -0
- package/build/import/type/registry/format.d.mts +6 -0
- package/build/import/type/registry/format.mjs +7 -0
- package/build/import/type/registry/type.d.mts +6 -0
- package/build/import/type/registry/type.mjs +7 -0
- package/build/import/type/required/required-from-mapped-result.mjs +3 -0
- package/build/import/type/required/required.d.mts +2 -0
- package/build/import/type/required/required.mjs +9 -0
- package/build/import/type/rest/rest.d.mts +1 -0
- package/build/import/type/rest/rest.mjs +5 -0
- package/build/import/type/return-type/return-type.d.mts +1 -0
- package/build/import/type/return-type/return-type.mjs +1 -0
- package/build/import/type/schema/schema.d.mts +7 -0
- package/build/import/type/static/static.d.mts +3 -0
- package/build/import/type/strict/strict.d.mts +1 -0
- package/build/import/type/strict/strict.mjs +1 -0
- package/build/import/type/string/string.d.mts +7 -0
- package/build/import/type/string/string.mjs +1 -0
- package/build/import/type/symbol/symbol.d.mts +1 -0
- package/build/import/type/symbol/symbol.mjs +1 -0
- package/build/import/type/symbols/symbols.d.mts +5 -0
- package/build/import/type/symbols/symbols.mjs +5 -0
- package/build/import/type/template-literal/finite.mjs +10 -0
- package/build/import/type/template-literal/generate.mjs +10 -0
- package/build/import/type/template-literal/parser.d.mts +2 -0
- package/build/import/type/template-literal/parser.mjs +17 -0
- package/build/import/type/template-literal/pattern.mjs +11 -0
- package/build/import/type/template-literal/syntax.d.mts +1 -0
- package/build/import/type/template-literal/syntax.mjs +8 -0
- package/build/import/type/template-literal/template-literal.d.mts +2 -0
- package/build/import/type/template-literal/template-literal.mjs +2 -0
- package/build/import/type/template-literal/union.d.mts +1 -0
- package/build/import/type/template-literal/union.mjs +4 -0
- package/build/import/type/transform/transform.d.mts +1 -0
- package/build/import/type/transform/transform.mjs +9 -0
- package/build/import/type/tuple/tuple.d.mts +1 -0
- package/build/import/type/tuple/tuple.mjs +3 -0
- package/build/import/type/type/index.d.mts +1 -0
- package/build/import/type/type/index.mjs +7 -0
- package/build/import/type/type/javascript.d.mts +19 -0
- package/build/import/type/type/javascript.mjs +18 -0
- package/build/import/type/type/json.d.mts +64 -3
- package/build/import/type/type/json.mjs +55 -1
- package/build/import/type/type/type.mjs +3 -0
- package/build/import/type/uint8array/uint8array.d.mts +1 -0
- package/build/import/type/uint8array/uint8array.mjs +1 -0
- package/build/import/type/undefined/undefined.d.mts +1 -0
- package/build/import/type/undefined/undefined.mjs +1 -0
- package/build/import/type/union/union-evaluated.d.mts +1 -0
- package/build/import/type/union/union-evaluated.mjs +10 -0
- package/build/import/type/union/union.d.mts +1 -0
- package/build/import/type/union/union.mjs +2 -0
- package/build/import/type/unknown/unknown.d.mts +1 -0
- package/build/import/type/unknown/unknown.mjs +1 -0
- package/build/import/type/unsafe/unsafe.d.mts +1 -0
- package/build/import/type/unsafe/unsafe.mjs +1 -0
- package/build/import/type/void/void.d.mts +1 -0
- package/build/import/type/void/void.mjs +1 -0
- package/build/import/value/cast/cast.d.mts +2 -0
- package/build/import/value/cast/cast.mjs +28 -0
- package/build/import/value/check/check.d.mts +2 -0
- package/build/import/value/check/check.mjs +19 -1
- package/build/import/value/clean/clean.d.mts +2 -0
- package/build/import/value/clean/clean.mjs +12 -1
- package/build/import/value/clone/clone.d.mts +1 -0
- package/build/import/value/clone/clone.mjs +7 -0
- package/build/import/value/convert/convert.d.mts +2 -0
- package/build/import/value/convert/convert.mjs +30 -1
- package/build/import/value/create/create.d.mts +2 -0
- package/build/import/value/create/create.mjs +17 -0
- package/build/import/value/default/default.d.mts +2 -0
- package/build/import/value/default/default.mjs +19 -0
- package/build/import/value/delta/delta.mjs +15 -0
- package/build/import/value/deref/deref.d.mts +1 -0
- package/build/import/value/deref/deref.mjs +1 -0
- package/build/import/value/equal/equal.d.mts +1 -0
- package/build/import/value/equal/equal.mjs +7 -0
- package/build/import/value/guard/guard.d.mts +20 -0
- package/build/import/value/guard/guard.mjs +30 -0
- package/build/import/value/hash/hash.d.mts +1 -0
- package/build/import/value/hash/hash.mjs +19 -0
- package/build/import/value/index.mjs +12 -0
- package/build/import/value/mutate/mutate.d.mts +1 -0
- package/build/import/value/mutate/mutate.mjs +11 -0
- package/build/import/value/pointer/pointer.d.mts +5 -0
- package/build/import/value/pointer/pointer.mjs +18 -0
- package/build/import/value/transform/decode.d.mts +5 -0
- package/build/import/value/transform/decode.mjs +23 -0
- package/build/import/value/transform/encode.d.mts +6 -0
- package/build/import/value/transform/encode.mjs +25 -0
- package/build/import/value/transform/has.d.mts +1 -0
- package/build/import/value/transform/has.mjs +16 -0
- package/build/import/value/value/value.d.mts +24 -0
- package/build/import/value/value/value.mjs +15 -0
- package/build/require/compiler/compiler.d.ts +9 -0
- package/build/require/compiler/compiler.js +61 -6
- package/build/require/compiler/index.js +1 -0
- package/build/require/errors/errors.d.ts +3 -0
- package/build/require/errors/errors.js +29 -3
- package/build/require/errors/function.d.ts +3 -0
- package/build/require/errors/function.js +5 -0
- package/build/require/errors/index.js +1 -0
- package/build/require/index.js +10 -0
- package/build/require/system/index.js +1 -0
- package/build/require/system/policy.d.ts +10 -0
- package/build/require/system/policy.js +14 -0
- package/build/require/system/system.d.ts +3 -0
- package/build/require/system/system.js +10 -0
- package/build/require/type/any/any.d.ts +1 -0
- package/build/require/type/any/any.js +2 -0
- package/build/require/type/any/index.js +1 -0
- package/build/require/type/array/array.d.ts +7 -0
- package/build/require/type/array/array.js +2 -0
- package/build/require/type/array/index.js +1 -0
- package/build/require/type/async-iterator/async-iterator.d.ts +1 -0
- package/build/require/type/async-iterator/async-iterator.js +2 -0
- package/build/require/type/async-iterator/index.js +1 -0
- package/build/require/type/awaited/awaited.d.ts +7 -6
- package/build/require/type/awaited/awaited.js +25 -15
- package/build/require/type/awaited/index.js +1 -0
- package/build/require/type/bigint/bigint.d.ts +1 -0
- package/build/require/type/bigint/bigint.js +2 -0
- package/build/require/type/bigint/index.js +1 -0
- package/build/require/type/boolean/boolean.d.ts +1 -0
- package/build/require/type/boolean/boolean.js +2 -0
- package/build/require/type/boolean/index.js +1 -0
- package/build/require/type/clone/index.js +1 -0
- package/build/require/type/clone/type.d.ts +2 -0
- package/build/require/type/clone/type.js +3 -0
- package/build/require/type/clone/value.d.ts +1 -0
- package/build/require/type/clone/value.js +3 -0
- package/build/require/type/composite/composite.d.ts +1 -0
- package/build/require/type/composite/composite.js +2 -0
- package/build/require/type/composite/index.js +1 -0
- package/build/require/type/const/const.d.ts +2 -1
- package/build/require/type/const/const.js +6 -1
- package/build/require/type/const/index.js +1 -0
- package/build/require/type/constructor/constructor.d.ts +1 -0
- package/build/require/type/constructor/constructor.js +2 -0
- package/build/require/type/constructor/index.js +1 -0
- package/build/require/type/constructor-parameters/constructor-parameters.d.ts +1 -0
- package/build/require/type/constructor-parameters/constructor-parameters.js +2 -0
- package/build/require/type/constructor-parameters/index.js +1 -0
- package/build/require/type/date/date.d.ts +6 -0
- package/build/require/type/date/date.js +2 -0
- package/build/require/type/date/index.js +1 -0
- package/build/require/type/deref/deref.d.ts +1 -0
- package/build/require/type/deref/deref.js +19 -0
- package/build/require/type/deref/index.js +1 -0
- package/build/require/type/discard/discard.js +1 -0
- package/build/require/type/discard/index.js +1 -0
- package/build/require/type/enum/enum.d.ts +1 -0
- package/build/require/type/enum/enum.js +2 -0
- package/build/require/type/enum/index.js +1 -0
- package/build/require/type/exclude/exclude-from-mapped-result.js +4 -0
- package/build/require/type/exclude/exclude.d.ts +2 -0
- package/build/require/type/exclude/exclude.js +4 -0
- package/build/require/type/exclude/index.js +1 -0
- package/build/require/type/extends/extends-check.js +174 -1
- package/build/require/type/extends/extends-from-mapped-key.js +5 -0
- package/build/require/type/extends/extends-from-mapped-result.js +4 -0
- package/build/require/type/extends/extends-undefined.d.ts +1 -0
- package/build/require/type/extends/extends-undefined.js +4 -0
- package/build/require/type/extends/extends.d.ts +3 -0
- package/build/require/type/extends/extends.js +8 -0
- package/build/require/type/extends/index.js +1 -0
- package/build/require/type/extract/extract-from-mapped-result.js +4 -0
- package/build/require/type/extract/extract.d.ts +2 -0
- package/build/require/type/extract/extract.js +4 -0
- package/build/require/type/extract/index.js +1 -0
- package/build/require/type/function/function.d.ts +1 -0
- package/build/require/type/function/function.js +2 -0
- package/build/require/type/function/index.js +1 -0
- package/build/require/type/guard/index.js +1 -0
- package/build/require/type/guard/type.d.ts +46 -0
- package/build/require/type/guard/type.js +85 -1
- package/build/require/type/guard/value.d.ts +14 -0
- package/build/require/type/guard/value.js +15 -0
- package/build/require/type/helpers/helpers.d.ts +1 -0
- package/build/require/type/helpers/helpers.js +2 -0
- package/build/require/type/helpers/index.js +1 -0
- package/build/require/type/index.js +1 -0
- package/build/require/type/indexed/index.d.ts +0 -1
- package/build/require/type/indexed/index.js +1 -1
- package/build/require/type/indexed/indexed-from-mapped-key.d.ts +2 -2
- package/build/require/type/indexed/indexed-from-mapped-key.js +11 -3
- package/build/require/type/indexed/indexed-property-keys.d.ts +1 -0
- package/build/require/type/indexed/indexed-property-keys.js +10 -0
- package/build/require/type/indexed/indexed.d.ts +40 -4
- package/build/require/type/indexed/indexed.js +84 -4
- package/build/require/type/instance-type/index.js +1 -0
- package/build/require/type/instance-type/instance-type.d.ts +1 -0
- package/build/require/type/instance-type/instance-type.js +2 -0
- package/build/require/type/integer/index.js +1 -0
- package/build/require/type/integer/integer.d.ts +1 -0
- package/build/require/type/integer/integer.js +2 -0
- package/build/require/type/intersect/index.js +1 -0
- package/build/require/type/intersect/intersect-create.js +9 -0
- package/build/require/type/intersect/intersect-evaluated.d.ts +1 -0
- package/build/require/type/intersect/intersect-evaluated.js +10 -0
- package/build/require/type/intersect/intersect-type.js +1 -0
- package/build/require/type/intersect/intersect.d.ts +1 -0
- package/build/require/type/intersect/intersect.js +6 -0
- package/build/require/type/intrinsic/capitalize.d.ts +1 -0
- package/build/require/type/intrinsic/capitalize.js +2 -0
- package/build/require/type/intrinsic/index.js +1 -0
- package/build/require/type/intrinsic/intrinsic-from-mapped-key.js +5 -0
- package/build/require/type/intrinsic/intrinsic.d.ts +2 -0
- package/build/require/type/intrinsic/intrinsic.js +17 -1
- package/build/require/type/intrinsic/lowercase.d.ts +1 -0
- package/build/require/type/intrinsic/lowercase.js +2 -0
- package/build/require/type/intrinsic/uncapitalize.d.ts +1 -0
- package/build/require/type/intrinsic/uncapitalize.js +2 -0
- package/build/require/type/intrinsic/uppercase.d.ts +1 -0
- package/build/require/type/intrinsic/uppercase.js +2 -0
- package/build/require/type/iterator/index.js +1 -0
- package/build/require/type/iterator/iterator.d.ts +1 -0
- package/build/require/type/iterator/iterator.js +2 -0
- package/build/require/type/keyof/index.js +1 -0
- package/build/require/type/keyof/keyof-from-mapped-result.js +4 -0
- package/build/require/type/keyof/keyof-property-keys.d.ts +2 -0
- package/build/require/type/keyof/keyof-property-keys.js +21 -0
- package/build/require/type/keyof/keyof.d.ts +2 -0
- package/build/require/type/keyof/keyof.js +7 -0
- package/build/require/type/literal/index.js +1 -0
- package/build/require/type/literal/literal.d.ts +1 -0
- package/build/require/type/literal/literal.js +2 -0
- package/build/require/type/mapped/index.js +1 -0
- package/build/require/type/mapped/mapped-key.js +2 -0
- package/build/require/type/mapped/mapped-result.js +2 -0
- package/build/require/type/mapped/mapped.d.ts +2 -0
- package/build/require/type/mapped/mapped.js +20 -1
- package/build/require/type/modifiers/index.js +1 -0
- package/build/require/type/modifiers/modifiers.js +11 -0
- package/build/require/type/never/index.js +1 -0
- package/build/require/type/never/never.d.ts +1 -0
- package/build/require/type/never/never.js +2 -0
- package/build/require/type/not/index.js +1 -0
- package/build/require/type/not/not.d.ts +1 -0
- package/build/require/type/not/not.js +2 -0
- package/build/require/type/null/index.js +1 -0
- package/build/require/type/null/null.d.ts +1 -0
- package/build/require/type/null/null.js +2 -0
- package/build/require/type/number/index.js +1 -0
- package/build/require/type/number/number.d.ts +1 -0
- package/build/require/type/number/number.js +2 -0
- package/build/require/type/object/index.js +1 -0
- package/build/require/type/object/object.d.ts +5 -0
- package/build/require/type/object/object.js +7 -0
- package/build/require/type/omit/index.js +1 -0
- package/build/require/type/omit/omit-from-mapped-key.js +5 -0
- package/build/require/type/omit/omit.d.ts +3 -0
- package/build/require/type/omit/omit.js +13 -0
- package/build/require/type/operators/index.js +1 -0
- package/build/require/type/operators/operators.d.ts +8 -0
- package/build/require/type/operators/operators.js +16 -0
- package/build/require/type/optional/index.js +1 -0
- package/build/require/type/optional/optional.d.ts +1 -0
- package/build/require/type/optional/optional.js +2 -0
- package/build/require/type/parameters/index.js +1 -0
- package/build/require/type/parameters/parameters.d.ts +1 -0
- package/build/require/type/parameters/parameters.js +2 -0
- package/build/require/type/partial/index.js +1 -0
- package/build/require/type/partial/partial-from-mapped-result.js +4 -0
- package/build/require/type/partial/partial.d.ts +2 -0
- package/build/require/type/partial/partial.js +10 -0
- package/build/require/type/patterns/index.js +1 -0
- package/build/require/type/patterns/patterns.js +1 -0
- package/build/require/type/pick/index.js +1 -0
- package/build/require/type/pick/pick-from-mapped-key.js +5 -0
- package/build/require/type/pick/pick.d.ts +3 -0
- package/build/require/type/pick/pick.js +8 -0
- package/build/require/type/promise/index.js +1 -0
- package/build/require/type/promise/promise.d.ts +1 -0
- package/build/require/type/promise/promise.js +2 -0
- package/build/require/type/readonly/index.js +1 -0
- package/build/require/type/readonly/readonly.d.ts +1 -0
- package/build/require/type/readonly/readonly.js +2 -0
- package/build/require/type/readonly-optional/index.js +1 -0
- package/build/require/type/readonly-optional/readonly-optional.d.ts +1 -0
- package/build/require/type/readonly-optional/readonly-optional.js +2 -0
- package/build/require/type/record/index.js +1 -0
- package/build/require/type/record/record.d.ts +11 -9
- package/build/require/type/record/record.js +54 -28
- package/build/require/type/recursive/index.js +1 -0
- package/build/require/type/recursive/recursive.d.ts +1 -0
- package/build/require/type/recursive/recursive.js +4 -0
- package/build/require/type/ref/index.js +1 -0
- package/build/require/type/ref/ref.d.ts +2 -0
- package/build/require/type/ref/ref.js +2 -0
- package/build/require/type/regexp/index.js +1 -0
- package/build/require/type/regexp/regexp.d.ts +2 -0
- package/build/require/type/regexp/regexp.js +2 -0
- package/build/require/type/registry/format.d.ts +6 -0
- package/build/require/type/registry/format.js +8 -0
- package/build/require/type/registry/index.js +1 -0
- package/build/require/type/registry/type.d.ts +6 -0
- package/build/require/type/registry/type.js +8 -0
- package/build/require/type/required/index.js +1 -0
- package/build/require/type/required/required-from-mapped-result.js +4 -0
- package/build/require/type/required/required.d.ts +2 -0
- package/build/require/type/required/required.js +10 -0
- package/build/require/type/rest/index.js +1 -0
- package/build/require/type/rest/rest.d.ts +1 -0
- package/build/require/type/rest/rest.js +6 -0
- package/build/require/type/return-type/index.js +1 -0
- package/build/require/type/return-type/return-type.d.ts +1 -0
- package/build/require/type/return-type/return-type.js +2 -0
- package/build/require/type/schema/anyschema.js +1 -0
- package/build/require/type/schema/index.js +1 -0
- package/build/require/type/schema/schema.d.ts +7 -0
- package/build/require/type/schema/schema.js +1 -0
- package/build/require/type/static/index.js +1 -0
- package/build/require/type/static/static.d.ts +3 -0
- package/build/require/type/static/static.js +1 -0
- package/build/require/type/strict/index.js +1 -0
- package/build/require/type/strict/strict.d.ts +1 -0
- package/build/require/type/strict/strict.js +2 -0
- package/build/require/type/string/index.js +1 -0
- package/build/require/type/string/string.d.ts +7 -0
- package/build/require/type/string/string.js +2 -0
- package/build/require/type/symbol/index.js +1 -0
- package/build/require/type/symbol/symbol.d.ts +1 -0
- package/build/require/type/symbol/symbol.js +2 -0
- package/build/require/type/symbols/index.js +1 -0
- package/build/require/type/symbols/symbols.d.ts +5 -0
- package/build/require/type/symbols/symbols.js +6 -0
- package/build/require/type/template-literal/finite.js +11 -0
- package/build/require/type/template-literal/generate.js +11 -0
- package/build/require/type/template-literal/index.js +1 -0
- package/build/require/type/template-literal/parser.d.ts +2 -0
- package/build/require/type/template-literal/parser.js +18 -0
- package/build/require/type/template-literal/pattern.js +12 -0
- package/build/require/type/template-literal/syntax.d.ts +1 -0
- package/build/require/type/template-literal/syntax.js +9 -0
- package/build/require/type/template-literal/template-literal.d.ts +2 -0
- package/build/require/type/template-literal/template-literal.js +3 -0
- package/build/require/type/template-literal/union.d.ts +1 -0
- package/build/require/type/template-literal/union.js +5 -0
- package/build/require/type/transform/index.js +1 -0
- package/build/require/type/transform/transform.d.ts +1 -0
- package/build/require/type/transform/transform.js +10 -0
- package/build/require/type/tuple/index.js +1 -0
- package/build/require/type/tuple/tuple.d.ts +1 -0
- package/build/require/type/tuple/tuple.js +4 -0
- package/build/require/type/type/index.d.ts +1 -0
- package/build/require/type/type/index.js +8 -0
- package/build/require/type/type/javascript.d.ts +19 -0
- package/build/require/type/type/javascript.js +19 -0
- package/build/require/type/type/json.d.ts +64 -3
- package/build/require/type/type/json.js +56 -1
- package/build/require/type/type/type.js +4 -0
- package/build/require/type/uint8array/index.js +1 -0
- package/build/require/type/uint8array/uint8array.d.ts +1 -0
- package/build/require/type/uint8array/uint8array.js +2 -0
- package/build/require/type/undefined/index.js +1 -0
- package/build/require/type/undefined/undefined.d.ts +1 -0
- package/build/require/type/undefined/undefined.js +2 -0
- package/build/require/type/union/index.js +1 -0
- package/build/require/type/union/union-create.js +1 -0
- package/build/require/type/union/union-evaluated.d.ts +1 -0
- package/build/require/type/union/union-evaluated.js +11 -0
- package/build/require/type/union/union-type.js +1 -0
- package/build/require/type/union/union.d.ts +1 -0
- package/build/require/type/union/union.js +3 -0
- package/build/require/type/unknown/index.js +1 -0
- package/build/require/type/unknown/unknown.d.ts +1 -0
- package/build/require/type/unknown/unknown.js +2 -0
- package/build/require/type/unsafe/index.js +1 -0
- package/build/require/type/unsafe/unsafe.d.ts +1 -0
- package/build/require/type/unsafe/unsafe.js +2 -0
- package/build/require/type/void/index.js +1 -0
- package/build/require/type/void/void.d.ts +1 -0
- package/build/require/type/void/void.js +2 -0
- package/build/require/value/cast/cast.d.ts +2 -0
- package/build/require/value/cast/cast.js +29 -0
- package/build/require/value/cast/index.js +1 -0
- package/build/require/value/check/check.d.ts +2 -0
- package/build/require/value/check/check.js +20 -1
- package/build/require/value/check/index.js +1 -0
- package/build/require/value/clean/clean.d.ts +2 -0
- package/build/require/value/clean/clean.js +13 -1
- package/build/require/value/clean/index.js +1 -0
- package/build/require/value/clone/clone.d.ts +1 -0
- package/build/require/value/clone/clone.js +8 -0
- package/build/require/value/clone/index.js +1 -0
- package/build/require/value/convert/convert.d.ts +2 -0
- package/build/require/value/convert/convert.js +31 -1
- package/build/require/value/convert/index.js +1 -0
- package/build/require/value/create/create.d.ts +2 -0
- package/build/require/value/create/create.js +18 -0
- package/build/require/value/create/index.js +1 -0
- package/build/require/value/default/default.d.ts +2 -0
- package/build/require/value/default/default.js +20 -0
- package/build/require/value/default/index.js +1 -0
- package/build/require/value/delta/delta.js +16 -0
- package/build/require/value/delta/index.js +1 -0
- package/build/require/value/deref/deref.d.ts +1 -0
- package/build/require/value/deref/deref.js +2 -0
- package/build/require/value/deref/index.js +1 -0
- package/build/require/value/equal/equal.d.ts +1 -0
- package/build/require/value/equal/equal.js +8 -0
- package/build/require/value/equal/index.js +1 -0
- package/build/require/value/guard/guard.d.ts +20 -0
- package/build/require/value/guard/guard.js +31 -0
- package/build/require/value/guard/index.js +1 -0
- package/build/require/value/hash/hash.d.ts +1 -0
- package/build/require/value/hash/hash.js +20 -0
- package/build/require/value/hash/index.js +1 -0
- package/build/require/value/index.js +13 -0
- package/build/require/value/mutate/index.js +1 -0
- package/build/require/value/mutate/mutate.d.ts +1 -0
- package/build/require/value/mutate/mutate.js +12 -0
- package/build/require/value/pointer/index.js +1 -0
- package/build/require/value/pointer/pointer.d.ts +5 -0
- package/build/require/value/pointer/pointer.js +19 -0
- package/build/require/value/transform/decode.d.ts +5 -0
- package/build/require/value/transform/decode.js +24 -0
- package/build/require/value/transform/encode.d.ts +6 -0
- package/build/require/value/transform/encode.js +26 -0
- package/build/require/value/transform/has.d.ts +1 -0
- package/build/require/value/transform/has.js +17 -0
- package/build/require/value/transform/index.js +1 -0
- package/build/require/value/value/index.js +1 -0
- package/build/require/value/value/value.d.ts +24 -0
- package/build/require/value/value/value.js +16 -0
- package/license +3 -1
- package/package.json +1 -1
- package/readme.md +4 -5
- package/build/import/type/indexed/indexed-result.d.mts +0 -33
- package/build/import/type/indexed/indexed-result.mjs +0 -65
- package/build/require/type/indexed/indexed-result.d.ts +0 -33
- package/build/require/type/indexed/indexed-result.js +0 -69
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Kind, OptionalKind, ReadonlyKind } from '../symbols/index.mjs';
|
|
2
2
|
import { CloneType } from '../clone/type.mjs';
|
|
3
3
|
import { Discard } from '../discard/index.mjs';
|
|
4
|
+
// evaluation types
|
|
4
5
|
import { Array } from '../array/index.mjs';
|
|
5
6
|
import { AsyncIterator } from '../async-iterator/index.mjs';
|
|
6
7
|
import { Constructor } from '../constructor/index.mjs';
|
|
@@ -15,39 +16,54 @@ import { Promise } from '../promise/index.mjs';
|
|
|
15
16
|
import { Readonly } from '../readonly/index.mjs';
|
|
16
17
|
import { Tuple } from '../tuple/index.mjs';
|
|
17
18
|
import { Union } from '../union/index.mjs';
|
|
19
|
+
// mapping types
|
|
18
20
|
import { MappedResult } from './mapped-result.mjs';
|
|
21
|
+
// ------------------------------------------------------------------
|
|
22
|
+
// TypeGuard
|
|
23
|
+
// ------------------------------------------------------------------
|
|
24
|
+
// prettier-ignore
|
|
19
25
|
import { TArray as IsArrayType, TAsyncIterator as IsAsyncIteratorType, TConstructor as IsConstructorType, TFunction as IsFunctionType, TIntersect as IsIntersectType, TIterator as IsIteratorType, TReadonly as IsReadonlyType, TMappedResult as IsMappedResultType, TMappedKey as IsMappedKeyType, TObject as IsObjectType, TOptional as IsOptionalType, TPromise as IsPromiseType, TSchema as IsSchemaType, TTuple as IsTupleType, TUnion as IsUnionType, } from '../guard/type.mjs';
|
|
26
|
+
// prettier-ignore
|
|
20
27
|
function FromMappedResult(K, P) {
|
|
21
28
|
return (K in P
|
|
22
29
|
? FromSchemaType(K, P[K])
|
|
23
30
|
: MappedResult(P));
|
|
24
31
|
}
|
|
32
|
+
// prettier-ignore
|
|
25
33
|
function MappedKeyToMappedResultProperties(K, P) {
|
|
26
34
|
const [L, ...R] = P;
|
|
27
35
|
return (P.length > 0
|
|
28
36
|
? { [L]: Literal(L), ...MappedKeyToMappedResultProperties(K, R) }
|
|
29
37
|
: {});
|
|
30
38
|
}
|
|
39
|
+
// prettier-ignore
|
|
31
40
|
function FromMappedKey(K, P) {
|
|
32
41
|
const R = MappedKeyToMappedResultProperties(K, P);
|
|
33
42
|
return FromMappedResult(K, R);
|
|
34
43
|
}
|
|
44
|
+
// prettier-ignore
|
|
35
45
|
function FromRest(K, T) {
|
|
36
46
|
const [L, ...R] = T;
|
|
37
47
|
return (T.length > 0
|
|
38
48
|
? [FromSchemaType(K, L), ...FromRest(K, R)]
|
|
39
49
|
: []);
|
|
40
50
|
}
|
|
51
|
+
// prettier-ignore
|
|
41
52
|
function FromProperties(K, T) {
|
|
42
53
|
return globalThis.Object.getOwnPropertyNames(T).reduce((Acc, K2) => {
|
|
43
54
|
return { ...Acc, [K2]: FromSchemaType(K, T[K2]) };
|
|
44
55
|
}, {});
|
|
45
56
|
}
|
|
57
|
+
// prettier-ignore
|
|
46
58
|
function FromSchemaType(K, T) {
|
|
47
|
-
return (
|
|
59
|
+
return (
|
|
60
|
+
// unevaluated modifier types
|
|
61
|
+
IsOptionalType(T) ? Optional(FromSchemaType(K, Discard(T, [OptionalKind]))) :
|
|
48
62
|
IsReadonlyType(T) ? Readonly(FromSchemaType(K, Discard(T, [ReadonlyKind]))) :
|
|
63
|
+
// unevaluated mapped types
|
|
49
64
|
IsMappedResultType(T) ? FromMappedResult(K, T.properties) :
|
|
50
65
|
IsMappedKeyType(T) ? FromMappedKey(K, T.keys) :
|
|
66
|
+
// unevaluated types
|
|
51
67
|
IsConstructorType(T) ? Constructor(FromRest(K, T.parameters), FromSchemaType(K, T.returns)) :
|
|
52
68
|
IsFunctionType(T) ? FunctionType(FromRest(K, T.parameters), FromSchemaType(K, T.returns)) :
|
|
53
69
|
IsAsyncIteratorType(T) ? AsyncIterator(FromSchemaType(K, T.items)) :
|
|
@@ -60,12 +76,14 @@ function FromSchemaType(K, T) {
|
|
|
60
76
|
IsPromiseType(T) ? Promise(FromSchemaType(K, T.item)) :
|
|
61
77
|
T);
|
|
62
78
|
}
|
|
79
|
+
// prettier-ignore
|
|
63
80
|
function FromMappedFunctionReturnType(K, T) {
|
|
64
81
|
const [L, ...R] = K;
|
|
65
82
|
return (K.length > 0
|
|
66
83
|
? { [L]: FromSchemaType(L, T), ...FromMappedFunctionReturnType(R, T) }
|
|
67
84
|
: {});
|
|
68
85
|
}
|
|
86
|
+
/** `[Json]` Creates a Mapped object type */
|
|
69
87
|
export function Mapped(key, map, options = {}) {
|
|
70
88
|
const K = IsSchemaType(key) ? IndexPropertyKeys(key) : key;
|
|
71
89
|
const RT = map({ [Kind]: 'MappedKey', keys: K });
|
|
@@ -3,7 +3,12 @@ import { Union } from '../union/index.mjs';
|
|
|
3
3
|
import { Optional } from '../optional/index.mjs';
|
|
4
4
|
import { Discard } from '../discard/index.mjs';
|
|
5
5
|
import { OptionalKind } from '../symbols/index.mjs';
|
|
6
|
+
// ------------------------------------------------------------------
|
|
7
|
+
// TypeGuard
|
|
8
|
+
// ------------------------------------------------------------------
|
|
9
|
+
// prettier-ignore
|
|
6
10
|
import { TOptional as IsOptionalType } from '../guard/type.mjs';
|
|
11
|
+
// prettier-ignore
|
|
7
12
|
function IsOptionalFromIntersect(T) {
|
|
8
13
|
const [L, ...R] = T;
|
|
9
14
|
return (T.length > 0
|
|
@@ -12,6 +17,7 @@ function IsOptionalFromIntersect(T) {
|
|
|
12
17
|
: false
|
|
13
18
|
: true);
|
|
14
19
|
}
|
|
20
|
+
// prettier-ignore
|
|
15
21
|
function IsOptionalFromUnion(T) {
|
|
16
22
|
const [L, ...R] = T;
|
|
17
23
|
return (T.length > 0
|
|
@@ -20,18 +26,22 @@ function IsOptionalFromUnion(T) {
|
|
|
20
26
|
: IsOptionalFromUnion(R)
|
|
21
27
|
: false);
|
|
22
28
|
}
|
|
29
|
+
// prettier-ignore
|
|
23
30
|
function RemoveOptionalFromRest(T) {
|
|
24
31
|
return (T.map(T => RemoveOptionalFromSchema(T)));
|
|
25
32
|
}
|
|
33
|
+
// prettier-ignore
|
|
26
34
|
function RemoveOptionalFromSchema(T) {
|
|
27
35
|
return (Discard(T, [OptionalKind]));
|
|
28
36
|
}
|
|
37
|
+
// prettier-ignore
|
|
29
38
|
export function OptionalFromIntersect(T) {
|
|
30
39
|
const D = RemoveOptionalFromRest(T);
|
|
31
40
|
return (IsOptionalFromIntersect(T)
|
|
32
41
|
? Optional(Intersect(D))
|
|
33
42
|
: Intersect(T));
|
|
34
43
|
}
|
|
44
|
+
// prettier-ignore
|
|
35
45
|
export function OptionalFromUnion(T) {
|
|
36
46
|
const D = RemoveOptionalFromRest(T);
|
|
37
47
|
return (IsOptionalFromUnion(T)
|
|
@@ -22,8 +22,11 @@ export type TPropertyKey = string | number;
|
|
|
22
22
|
export type TProperties = Record<TPropertyKey, TSchema>;
|
|
23
23
|
export type TAdditionalProperties = undefined | TSchema | boolean;
|
|
24
24
|
export interface ObjectOptions extends SchemaOptions {
|
|
25
|
+
/** Additional property constraints for this object */
|
|
25
26
|
additionalProperties?: TAdditionalProperties;
|
|
27
|
+
/** The minimum number of properties allowed on this object */
|
|
26
28
|
minProperties?: number;
|
|
29
|
+
/** The maximum number of properties allowed on this object */
|
|
27
30
|
maxProperties?: number;
|
|
28
31
|
}
|
|
29
32
|
export interface TObject<T extends TProperties = TProperties> extends TSchema, ObjectOptions {
|
|
@@ -34,6 +37,8 @@ export interface TObject<T extends TProperties = TProperties> extends TSchema, O
|
|
|
34
37
|
properties: T;
|
|
35
38
|
required?: string[];
|
|
36
39
|
}
|
|
40
|
+
/** `[Json]` Creates an Object type */
|
|
37
41
|
export declare function _Object<T extends TProperties>(properties: T, options?: ObjectOptions): TObject<T>;
|
|
42
|
+
/** `[Json]` Creates an Object type */
|
|
38
43
|
export declare const Object: typeof _Object;
|
|
39
44
|
export {};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { CloneType } from '../clone/type.mjs';
|
|
2
2
|
import { Kind } from '../symbols/index.mjs';
|
|
3
|
+
// ------------------------------------------------------------------
|
|
4
|
+
// TypeGuard
|
|
5
|
+
// ------------------------------------------------------------------
|
|
6
|
+
// prettier-ignore
|
|
3
7
|
import { TOptional as IsOptionalType, TSchema as IsSchemaType } from '../guard/type.mjs';
|
|
8
|
+
/** `[Json]` Creates an Object type */
|
|
4
9
|
export function _Object(properties, options = {}) {
|
|
5
10
|
const propertyKeys = globalThis.Object.getOwnPropertyNames(properties);
|
|
6
11
|
const optionalKeys = propertyKeys.filter((key) => IsOptionalType(properties[key]));
|
|
@@ -11,4 +16,5 @@ export function _Object(properties, options = {}) {
|
|
|
11
16
|
? { ...options, ...clonedAdditionalProperties, [Kind]: 'Object', type: 'object', properties: clonedProperties, required: requiredKeys }
|
|
12
17
|
: { ...options, ...clonedAdditionalProperties, [Kind]: 'Object', type: 'object', properties: clonedProperties });
|
|
13
18
|
}
|
|
19
|
+
/** `[Json]` Creates an Object type */
|
|
14
20
|
export const Object = _Object;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { MappedResult } from '../mapped/index.mjs';
|
|
2
2
|
import { Omit } from './omit.mjs';
|
|
3
|
+
// prettier-ignore
|
|
3
4
|
function FromPropertyKey(T, K, options) {
|
|
4
5
|
return {
|
|
5
6
|
[K]: Omit(T, [K], options)
|
|
6
7
|
};
|
|
7
8
|
}
|
|
9
|
+
// prettier-ignore
|
|
8
10
|
function FromPropertyKeys(T, K, options) {
|
|
9
11
|
const [LK, ...RK] = K;
|
|
10
12
|
return (K.length > 0
|
|
11
13
|
? { ...FromPropertyKey(T, LK, options), ...FromPropertyKeys(T, RK, options) }
|
|
12
14
|
: {});
|
|
13
15
|
}
|
|
16
|
+
// prettier-ignore
|
|
14
17
|
function FromMappedKey(T, K, options) {
|
|
15
18
|
return FromPropertyKeys(T, K.keys, options);
|
|
16
19
|
}
|
|
20
|
+
// prettier-ignore
|
|
17
21
|
export function OmitFromMappedKey(T, K, options) {
|
|
18
22
|
const P = FromMappedKey(T, K, options);
|
|
19
23
|
return MappedResult(P);
|
|
@@ -16,7 +16,10 @@ declare function FromProperties<T extends TProperties, K extends PropertyKey[]>(
|
|
|
16
16
|
export type OmitResolve<T extends TProperties, K extends PropertyKey[]> = T extends TRecursive<infer S> ? TRecursive<OmitResolve<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<{}>;
|
|
17
17
|
export declare function OmitResolve<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K]): OmitResolve<T, K>;
|
|
18
18
|
export type TOmit<T extends TSchema, K extends PropertyKey[]> = OmitResolve<T, K>;
|
|
19
|
+
/** `[Json]` Constructs a type whose keys are picked from the given type */
|
|
19
20
|
export declare function Omit<T extends TSchema, K extends TMappedKey>(T: T, K: K): TOmitFromMappedKey<T, K>;
|
|
21
|
+
/** `[Json]` Constructs a type whose keys are omitted from the given type */
|
|
20
22
|
export declare function Omit<T extends TSchema, K extends TSchema, I extends PropertyKey[] = TIndexPropertyKeys<K>>(T: T, K: K, options?: SchemaOptions): TOmit<T, I>;
|
|
23
|
+
/** `[Json]` Constructs a type whose keys are omitted from the given type */
|
|
21
24
|
export declare function Omit<T extends TSchema, K extends PropertyKey[]>(T: T, K: readonly [...K], options?: SchemaOptions): TOmit<T, K>;
|
|
22
25
|
export {};
|
|
@@ -6,22 +6,34 @@ import { Discard } from '../discard/index.mjs';
|
|
|
6
6
|
import { TransformKind } from '../symbols/index.mjs';
|
|
7
7
|
import { CloneType } from '../clone/type.mjs';
|
|
8
8
|
import { OmitFromMappedKey } from './omit-from-mapped-key.mjs';
|
|
9
|
+
// ------------------------------------------------------------------
|
|
10
|
+
// TypeGuard
|
|
11
|
+
// ------------------------------------------------------------------
|
|
12
|
+
// prettier-ignore
|
|
9
13
|
import { TMappedKey as IsMappedKeyType, TIntersect as IsIntersectType, TUnion as IsUnionType, TObject as IsObjectType, TSchema as IsSchemaType } from '../guard/type.mjs';
|
|
14
|
+
// prettier-ignore
|
|
10
15
|
function FromIntersect(T, K) {
|
|
11
16
|
return T.map((T) => OmitResolve(T, K));
|
|
12
17
|
}
|
|
18
|
+
// prettier-ignore
|
|
13
19
|
function FromUnion(T, K) {
|
|
14
20
|
return T.map((T) => OmitResolve(T, K));
|
|
15
21
|
}
|
|
22
|
+
// ------------------------------------------------------------------
|
|
23
|
+
// FromProperty
|
|
24
|
+
// ------------------------------------------------------------------
|
|
25
|
+
// prettier-ignore
|
|
16
26
|
function FromProperty(T, K) {
|
|
17
27
|
const { [K]: _, ...R } = T;
|
|
18
28
|
return R;
|
|
19
29
|
}
|
|
30
|
+
// prettier-ignore
|
|
20
31
|
function FromProperties(T, K) {
|
|
21
32
|
return K.reduce((T, K2) => {
|
|
22
33
|
return FromProperty(T, K2);
|
|
23
34
|
}, T);
|
|
24
35
|
}
|
|
36
|
+
// prettier-ignore
|
|
25
37
|
export function OmitResolve(T, K) {
|
|
26
38
|
return (IsIntersectType(T) ? Intersect(FromIntersect(T.allOf, K)) :
|
|
27
39
|
IsUnionType(T) ? Union(FromUnion(T.anyOf, K)) :
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
export type OperatorIncludes<T extends PropertyKey[], S extends PropertyKey> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? S extends L ? true : OperatorIncludes<R, S> : false);
|
|
2
|
+
/** Returns true if element S is in the set of T */
|
|
2
3
|
export declare function OperatorIncludes<T extends PropertyKey[], S extends PropertyKey>(T: [...T], S: S): OperatorIncludes<T, S>;
|
|
3
4
|
export type OperatorSubset<T extends PropertyKey[], S extends PropertyKey[]> = T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? OperatorIncludes<S, L> extends true ? OperatorSubset<R, S> : false : true;
|
|
5
|
+
/** Returns true if T is a subset of S */
|
|
4
6
|
export declare function OperatorSubset<T extends PropertyKey[], S extends PropertyKey[]>(T: [...T], S: [...S]): OperatorSubset<T, S>;
|
|
5
7
|
export type OperatorDistinct<T extends PropertyKey[], Acc extends PropertyKey[] = []> = T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? OperatorIncludes<Acc, L> extends false ? OperatorDistinct<R, [...Acc, L]> : OperatorDistinct<R, [...Acc]> : Acc;
|
|
8
|
+
/** Returns a distinct set of elements */
|
|
6
9
|
export declare function OperatorDistinct<T extends PropertyKey[]>(T: [...T], Acc?: PropertyKey[]): OperatorDistinct<T>;
|
|
7
10
|
export type OperatorIntersect<T extends PropertyKey[], S extends PropertyKey[]> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? OperatorIncludes<S, L> extends true ? [L, ...OperatorIntersect<R, S>] : [...OperatorIntersect<R, S>] : []);
|
|
11
|
+
/** Returns the Intersect of the given sets */
|
|
8
12
|
export declare function OperatorIntersect<T extends PropertyKey[], S extends PropertyKey[]>(T: [...T], S: [...S]): OperatorIntersect<T, S>;
|
|
9
13
|
export type OperatorUnion<T extends PropertyKey[], S extends PropertyKey[]> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? OperatorIncludes<S, L> extends true ? [...OperatorUnion<R, S>] : [L, ...OperatorUnion<R, S>] : S);
|
|
14
|
+
/** Returns the Union of the given sets */
|
|
10
15
|
export declare function OperatorUnion<T extends PropertyKey[], S extends PropertyKey[]>(T: [...T], S: [...S]): OperatorUnion<T, S>;
|
|
11
16
|
export type OperatorComplement<T extends PropertyKey[], S extends PropertyKey[]> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? OperatorIncludes<S, L> extends true ? [...OperatorComplement<R, S>] : [L, ...OperatorComplement<R, S>] : []);
|
|
17
|
+
/** Returns the Complement by omitting elements in T that are in S */
|
|
12
18
|
export declare function OperatorComplement<T extends PropertyKey[], S extends PropertyKey[]>(T: [...T], S: [...S]): OperatorComplement<T, S>;
|
|
13
19
|
export type OperatorIntersectMany<T extends PropertyKey[][]> = (T extends [infer L extends PropertyKey[]] ? L : T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? OperatorIntersect<L, OperatorIntersectMany<R>> : []);
|
|
20
|
+
/** Returns the Intersect of multiple sets */
|
|
14
21
|
export declare function OperatorIntersectMany<T extends PropertyKey[][]>(T: [...T]): OperatorIntersectMany<T>;
|
|
15
22
|
export type OperatorUnionMany<T extends PropertyKey[][]> = (T extends [infer L extends PropertyKey[]] ? L : T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? OperatorUnion<L, OperatorUnionMany<R>> : []);
|
|
23
|
+
/** Returns the Union of multiple sets */
|
|
16
24
|
export declare function OperatorUnionMany<T extends PropertyKey[][]>(T: [...T]): OperatorUnionMany<T>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Returns true if element S is in the set of T */
|
|
2
|
+
// prettier-ignore
|
|
1
3
|
export function OperatorIncludes(T, S) {
|
|
2
4
|
const [L, ...R] = T;
|
|
3
5
|
return (T.length > 0
|
|
@@ -6,6 +8,8 @@ export function OperatorIncludes(T, S) {
|
|
|
6
8
|
: OperatorIncludes(R, S)
|
|
7
9
|
: false);
|
|
8
10
|
}
|
|
11
|
+
/** Returns true if T is a subset of S */
|
|
12
|
+
// prettier-ignore
|
|
9
13
|
export function OperatorSubset(T, S) {
|
|
10
14
|
const [L, ...R] = T;
|
|
11
15
|
return (T.length > 0
|
|
@@ -14,6 +18,8 @@ export function OperatorSubset(T, S) {
|
|
|
14
18
|
: false
|
|
15
19
|
: true);
|
|
16
20
|
}
|
|
21
|
+
/** Returns a distinct set of elements */
|
|
22
|
+
// prettier-ignore
|
|
17
23
|
export function OperatorDistinct(T, Acc = []) {
|
|
18
24
|
const [L, ...R] = T;
|
|
19
25
|
return (T.length > 0
|
|
@@ -22,6 +28,8 @@ export function OperatorDistinct(T, Acc = []) {
|
|
|
22
28
|
: OperatorDistinct(R, [...Acc])
|
|
23
29
|
: Acc);
|
|
24
30
|
}
|
|
31
|
+
/** Returns the Intersect of the given sets */
|
|
32
|
+
// prettier-ignore
|
|
25
33
|
export function OperatorIntersect(T, S) {
|
|
26
34
|
const [L, ...R] = T;
|
|
27
35
|
return (T.length > 0
|
|
@@ -30,6 +38,8 @@ export function OperatorIntersect(T, S) {
|
|
|
30
38
|
: [...OperatorIntersect(R, S)]
|
|
31
39
|
: []);
|
|
32
40
|
}
|
|
41
|
+
/** Returns the Union of the given sets */
|
|
42
|
+
// prettier-ignore
|
|
33
43
|
export function OperatorUnion(T, S) {
|
|
34
44
|
const [L, ...R] = T;
|
|
35
45
|
return (T.length > 0
|
|
@@ -38,6 +48,8 @@ export function OperatorUnion(T, S) {
|
|
|
38
48
|
: [L, ...OperatorUnion(R, S)]
|
|
39
49
|
: S);
|
|
40
50
|
}
|
|
51
|
+
/** Returns the Complement by omitting elements in T that are in S */
|
|
52
|
+
// prettier-ignore
|
|
41
53
|
export function OperatorComplement(T, S) {
|
|
42
54
|
const [L, ...R] = T;
|
|
43
55
|
return (T.length > 0
|
|
@@ -46,6 +58,8 @@ export function OperatorComplement(T, S) {
|
|
|
46
58
|
: [L, ...OperatorComplement(R, S)]
|
|
47
59
|
: []);
|
|
48
60
|
}
|
|
61
|
+
/** Returns the Intersect of multiple sets */
|
|
62
|
+
// prettier-ignore
|
|
49
63
|
export function OperatorIntersectMany(T) {
|
|
50
64
|
return (T.length === 1
|
|
51
65
|
? T[0]
|
|
@@ -56,6 +70,7 @@ export function OperatorIntersectMany(T) {
|
|
|
56
70
|
: []);
|
|
57
71
|
})());
|
|
58
72
|
}
|
|
73
|
+
/** Returns the Union of multiple sets */
|
|
59
74
|
export function OperatorUnionMany(T) {
|
|
60
75
|
return (T.length === 1
|
|
61
76
|
? T[0]
|
|
@@ -3,4 +3,5 @@ import type { TFunction } from '../function/index.mjs';
|
|
|
3
3
|
import type { Ensure } from '../helpers/index.mjs';
|
|
4
4
|
import { type TTuple } from '../tuple/index.mjs';
|
|
5
5
|
export type TParameters<T extends TFunction> = Ensure<TTuple<T['parameters']>>;
|
|
6
|
+
/** `[JavaScript]` Extracts the Parameters from the given Function type */
|
|
6
7
|
export declare function Parameters<T extends TFunction<TSchema[], TSchema>>(schema: T, options?: SchemaOptions): TParameters<T>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Tuple } from '../tuple/index.mjs';
|
|
2
2
|
import { CloneRest } from '../clone/type.mjs';
|
|
3
|
+
/** `[JavaScript]` Extracts the Parameters from the given Function type */
|
|
3
4
|
export function Parameters(schema, options = {}) {
|
|
4
5
|
return Tuple(CloneRest(schema.parameters), { ...options });
|
|
5
6
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { MappedResult } from '../mapped/index.mjs';
|
|
2
2
|
import { Partial } from './partial.mjs';
|
|
3
|
+
// prettier-ignore
|
|
3
4
|
function FromProperties(K, options) {
|
|
4
5
|
return globalThis.Object.getOwnPropertyNames(K).reduce((Acc, K2) => {
|
|
5
6
|
return { ...Acc, [K2]: Partial(K[K2], options) };
|
|
6
7
|
}, {});
|
|
7
8
|
}
|
|
9
|
+
// prettier-ignore
|
|
8
10
|
function FromMappedResult(K, options) {
|
|
9
11
|
return FromProperties(K.properties, options);
|
|
10
12
|
}
|
|
13
|
+
// prettier-ignore
|
|
11
14
|
export function PartialFromMappedResult(T, options) {
|
|
12
15
|
const P = FromMappedResult(T, options);
|
|
13
16
|
return MappedResult(P);
|
|
@@ -20,6 +20,8 @@ declare function FromProperties<T extends TProperties>(T: T): TProperties;
|
|
|
20
20
|
type PartialResolve<T extends TSchema> = (T extends TRecursive<infer S> ? TRecursive<PartialResolve<S>> : T extends TIntersect<infer S> ? TIntersect<FromIntersect<S>> : T extends TUnion<infer S> ? TUnion<FromUnion<S>> : T extends TObject<infer S> ? TObject<FromProperties<S>> : TObject<{}>);
|
|
21
21
|
declare function PartialResolve<T extends TSchema>(T: T): PartialResolve<T>;
|
|
22
22
|
export type TPartial<T extends TSchema> = PartialResolve<T>;
|
|
23
|
+
/** `[Json]` Constructs a type where all properties are optional */
|
|
23
24
|
export declare function Partial<T extends TMappedResult>(T: T, options?: SchemaOptions): TPartialFromMappedResult<T>;
|
|
25
|
+
/** `[Json]` Constructs a type where all properties are optional */
|
|
24
26
|
export declare function Partial<T extends TSchema>(T: T, options?: SchemaOptions): TPartial<T>;
|
|
25
27
|
export {};
|
|
@@ -6,30 +6,39 @@ import { Discard } from '../discard/index.mjs';
|
|
|
6
6
|
import { TransformKind } from '../symbols/index.mjs';
|
|
7
7
|
import { CloneType } from '../clone/type.mjs';
|
|
8
8
|
import { PartialFromMappedResult } from './partial-from-mapped-result.mjs';
|
|
9
|
+
// ------------------------------------------------------------------
|
|
10
|
+
// TypeGuard
|
|
11
|
+
// ------------------------------------------------------------------
|
|
12
|
+
// prettier-ignore
|
|
9
13
|
import { TMappedResult as IsMappedResultType, TIntersect as IsIntersectType, TUnion as IsUnionType, TObject as IsObjectType } from '../guard/type.mjs';
|
|
14
|
+
// prettier-ignore
|
|
10
15
|
function FromIntersect(T) {
|
|
11
16
|
const [L, ...R] = T;
|
|
12
17
|
return (T.length > 0
|
|
13
18
|
? [PartialResolve(L), ...FromIntersect(R)]
|
|
14
19
|
: []);
|
|
15
20
|
}
|
|
21
|
+
// prettier-ignore
|
|
16
22
|
function FromUnion(T) {
|
|
17
23
|
const [L, ...R] = T;
|
|
18
24
|
return (T.length > 0
|
|
19
25
|
? [PartialResolve(L), ...FromUnion(R)]
|
|
20
26
|
: []);
|
|
21
27
|
}
|
|
28
|
+
// prettier-ignore
|
|
22
29
|
function FromProperties(T) {
|
|
23
30
|
return globalThis.Object.getOwnPropertyNames(T).reduce((Acc, K) => {
|
|
24
31
|
return { ...Acc, [K]: Optional(T[K]) };
|
|
25
32
|
}, {});
|
|
26
33
|
}
|
|
34
|
+
// prettier-ignore
|
|
27
35
|
function PartialResolve(T) {
|
|
28
36
|
return (IsIntersectType(T) ? Intersect(FromIntersect(T.allOf)) :
|
|
29
37
|
IsUnionType(T) ? Union(FromUnion(T.anyOf)) :
|
|
30
38
|
IsObjectType(T) ? Object(FromProperties(T.properties)) :
|
|
31
39
|
Object({}));
|
|
32
40
|
}
|
|
41
|
+
/** `[Json]` Constructs a type where all properties are optional */
|
|
33
42
|
export function Partial(T, options = {}) {
|
|
34
43
|
if (IsMappedResultType(T)) {
|
|
35
44
|
return PartialFromMappedResult(T, options);
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { MappedResult } from '../mapped/index.mjs';
|
|
2
2
|
import { Pick } from './pick.mjs';
|
|
3
|
+
// prettier-ignore
|
|
3
4
|
function FromPropertyKey(T, K, options) {
|
|
4
5
|
return {
|
|
5
6
|
[K]: Pick(T, [K], options)
|
|
6
7
|
};
|
|
7
8
|
}
|
|
9
|
+
// prettier-ignore
|
|
8
10
|
function FromPropertyKeys(T, K, options) {
|
|
9
11
|
const [LK, ...RK] = K;
|
|
10
12
|
return (K.length > 0
|
|
11
13
|
? { ...FromPropertyKey(T, LK, options), ...FromPropertyKeys(T, RK, options) }
|
|
12
14
|
: {});
|
|
13
15
|
}
|
|
16
|
+
// prettier-ignore
|
|
14
17
|
function FromMappedKey(T, K, options) {
|
|
15
18
|
return FromPropertyKeys(T, K.keys, options);
|
|
16
19
|
}
|
|
20
|
+
// prettier-ignore
|
|
17
21
|
export function PickFromMappedKey(T, K, options) {
|
|
18
22
|
const P = FromMappedKey(T, K, options);
|
|
19
23
|
return MappedResult(P);
|
|
@@ -16,7 +16,10 @@ declare function FromProperties<T extends TProperties, K extends PropertyKey[]>(
|
|
|
16
16
|
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<{}>;
|
|
17
17
|
export declare function PickResolve<T extends TSchema, K extends PropertyKey[]>(T: T, K: [...K]): PickResolve<T, K>;
|
|
18
18
|
export type TPick<T extends TSchema, K extends PropertyKey[]> = PickResolve<T, K>;
|
|
19
|
+
/** `[Json]` Constructs a type whose keys are picked from the given type */
|
|
19
20
|
export declare function Pick<T extends TSchema, K extends TMappedKey>(T: T, K: K): TPickFromMappedKey<T, K>;
|
|
21
|
+
/** `[Json]` Constructs a type whose keys are picked from the given type */
|
|
20
22
|
export declare function Pick<T extends TSchema, K extends TSchema, I extends PropertyKey[] = TIndexPropertyKeys<K>>(T: T, K: K, options?: SchemaOptions): TPick<T, I>;
|
|
23
|
+
/** `[Json]` Constructs a type whose keys are picked from the given type */
|
|
21
24
|
export declare function Pick<T extends TSchema, K extends PropertyKey[]>(T: T, K: readonly [...K], options?: SchemaOptions): TPick<T, K>;
|
|
22
25
|
export {};
|
|
@@ -6,18 +6,25 @@ import { Discard } from '../discard/index.mjs';
|
|
|
6
6
|
import { TransformKind } from '../symbols/index.mjs';
|
|
7
7
|
import { CloneType } from '../clone/type.mjs';
|
|
8
8
|
import { PickFromMappedKey } from './pick-from-mapped-key.mjs';
|
|
9
|
+
// ------------------------------------------------------------------
|
|
10
|
+
// TypeGuard
|
|
11
|
+
// ------------------------------------------------------------------
|
|
12
|
+
// prettier-ignore
|
|
9
13
|
import { TMappedKey as IsMappedKeyType, TIntersect as IsIntersectType, TUnion as IsUnionType, TObject as IsObjectType, TSchema as IsSchemaType, } from '../guard/type.mjs';
|
|
10
14
|
function FromIntersect(T, K) {
|
|
11
15
|
return T.map((T) => PickResolve(T, K));
|
|
12
16
|
}
|
|
17
|
+
// prettier-ignore
|
|
13
18
|
function FromUnion(T, K) {
|
|
14
19
|
return T.map((T) => PickResolve(T, K));
|
|
15
20
|
}
|
|
21
|
+
// prettier-ignore
|
|
16
22
|
function FromProperties(T, K) {
|
|
17
23
|
return K.reduce((Acc, K) => {
|
|
18
24
|
return K in T ? { ...Acc, [K]: T[K] } : Acc;
|
|
19
25
|
}, {});
|
|
20
26
|
}
|
|
27
|
+
// prettier-ignore
|
|
21
28
|
export function PickResolve(T, K) {
|
|
22
29
|
return (IsIntersectType(T) ? Intersect(FromIntersect(T.allOf, K)) :
|
|
23
30
|
IsUnionType(T) ? Union(FromUnion(T.anyOf, K)) :
|
|
@@ -2,4 +2,5 @@ import type { TSchema } from '../schema/index.mjs';
|
|
|
2
2
|
import { type TReadonly } from '../readonly/index.mjs';
|
|
3
3
|
import { type TOptional } from '../optional/index.mjs';
|
|
4
4
|
export type TReadonlyOptional<T extends TSchema> = TOptional<T> & TReadonly<T>;
|
|
5
|
+
/** `[Json]` Creates a Readonly and Optional property */
|
|
5
6
|
export declare function ReadonlyOptional<T extends TSchema>(schema: T): TReadonly<TOptional<T>>;
|