@depup/sinclair__typebox 0.34.48-depup.0
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/README.md +25 -0
- package/build/cjs/compiler/compiler.d.ts +55 -0
- package/build/cjs/compiler/compiler.js +670 -0
- package/build/cjs/compiler/index.d.ts +2 -0
- package/build/cjs/compiler/index.js +22 -0
- package/build/cjs/errors/errors.d.ts +91 -0
- package/build/cjs/errors/errors.js +599 -0
- package/build/cjs/errors/function.d.ts +21 -0
- package/build/cjs/errors/function.js +153 -0
- package/build/cjs/errors/index.d.ts +2 -0
- package/build/cjs/errors/index.js +19 -0
- package/build/cjs/index.d.ts +71 -0
- package/build/cjs/index.js +97 -0
- package/build/cjs/parser/index.d.ts +2 -0
- package/build/cjs/parser/index.js +39 -0
- package/build/cjs/parser/runtime/guard.d.ts +23 -0
- package/build/cjs/parser/runtime/guard.js +86 -0
- package/build/cjs/parser/runtime/index.d.ts +5 -0
- package/build/cjs/parser/runtime/index.js +45 -0
- package/build/cjs/parser/runtime/module.d.ts +9 -0
- package/build/cjs/parser/runtime/module.js +22 -0
- package/build/cjs/parser/runtime/parse.d.ts +9 -0
- package/build/cjs/parser/runtime/parse.js +160 -0
- package/build/cjs/parser/runtime/token.d.ts +8 -0
- package/build/cjs/parser/runtime/token.js +230 -0
- package/build/cjs/parser/runtime/types.d.ts +98 -0
- package/build/cjs/parser/runtime/types.js +71 -0
- package/build/cjs/parser/static/index.d.ts +3 -0
- package/build/cjs/parser/static/index.js +43 -0
- package/build/cjs/parser/static/parse.d.ts +20 -0
- package/build/cjs/parser/static/parse.js +3 -0
- package/build/cjs/parser/static/token.d.ts +108 -0
- package/build/cjs/parser/static/token.js +3 -0
- package/build/cjs/parser/static/types.d.ts +69 -0
- package/build/cjs/parser/static/types.js +3 -0
- package/build/cjs/syntax/index.d.ts +1 -0
- package/build/cjs/syntax/index.js +18 -0
- package/build/cjs/syntax/mapping.d.ts +167 -0
- package/build/cjs/syntax/mapping.js +491 -0
- package/build/cjs/syntax/parser.d.ts +162 -0
- package/build/cjs/syntax/parser.js +191 -0
- package/build/cjs/syntax/syntax.d.ts +12 -0
- package/build/cjs/syntax/syntax.js +54 -0
- package/build/cjs/system/index.d.ts +2 -0
- package/build/cjs/system/index.js +19 -0
- package/build/cjs/system/policy.d.ts +29 -0
- package/build/cjs/system/policy.js +58 -0
- package/build/cjs/system/system.d.ts +16 -0
- package/build/cjs/system/system.js +43 -0
- package/build/cjs/type/any/any.d.ts +8 -0
- package/build/cjs/type/any/any.js +10 -0
- package/build/cjs/type/any/index.d.ts +1 -0
- package/build/cjs/type/any/index.js +18 -0
- package/build/cjs/type/argument/argument.d.ts +9 -0
- package/build/cjs/type/argument/argument.js +10 -0
- package/build/cjs/type/argument/index.d.ts +1 -0
- package/build/cjs/type/argument/index.js +18 -0
- package/build/cjs/type/array/array.d.ts +28 -0
- package/build/cjs/type/array/array.js +10 -0
- package/build/cjs/type/array/index.d.ts +1 -0
- package/build/cjs/type/array/index.js +18 -0
- package/build/cjs/type/async-iterator/async-iterator.d.ts +11 -0
- package/build/cjs/type/async-iterator/async-iterator.js +10 -0
- package/build/cjs/type/async-iterator/index.d.ts +1 -0
- package/build/cjs/type/async-iterator/index.js +18 -0
- package/build/cjs/type/awaited/awaited.d.ts +14 -0
- package/build/cjs/type/awaited/awaited.js +41 -0
- package/build/cjs/type/awaited/index.d.ts +1 -0
- package/build/cjs/type/awaited/index.js +18 -0
- package/build/cjs/type/bigint/bigint.d.ts +16 -0
- package/build/cjs/type/bigint/bigint.js +10 -0
- package/build/cjs/type/bigint/index.d.ts +1 -0
- package/build/cjs/type/bigint/index.js +18 -0
- package/build/cjs/type/boolean/boolean.d.ts +9 -0
- package/build/cjs/type/boolean/boolean.js +10 -0
- package/build/cjs/type/boolean/index.d.ts +1 -0
- package/build/cjs/type/boolean/index.js +18 -0
- package/build/cjs/type/clone/index.d.ts +2 -0
- package/build/cjs/type/clone/index.js +19 -0
- package/build/cjs/type/clone/type.d.ts +5 -0
- package/build/cjs/type/clone/type.js +14 -0
- package/build/cjs/type/clone/value.d.ts +2 -0
- package/build/cjs/type/clone/value.js +73 -0
- package/build/cjs/type/composite/composite.d.ts +18 -0
- package/build/cjs/type/composite/composite.js +46 -0
- package/build/cjs/type/composite/index.d.ts +1 -0
- package/build/cjs/type/composite/index.js +18 -0
- package/build/cjs/type/computed/computed.d.ts +9 -0
- package/build/cjs/type/computed/computed.js +10 -0
- package/build/cjs/type/computed/index.d.ts +1 -0
- package/build/cjs/type/computed/index.js +18 -0
- package/build/cjs/type/const/const.d.ts +27 -0
- package/build/cjs/type/const/const.js +58 -0
- package/build/cjs/type/const/index.d.ts +1 -0
- package/build/cjs/type/const/index.js +18 -0
- package/build/cjs/type/constructor/constructor.d.ts +23 -0
- package/build/cjs/type/constructor/constructor.js +10 -0
- package/build/cjs/type/constructor/index.d.ts +1 -0
- package/build/cjs/type/constructor/index.js +18 -0
- package/build/cjs/type/constructor-parameters/constructor-parameters.d.ts +7 -0
- package/build/cjs/type/constructor-parameters/constructor-parameters.js +44 -0
- package/build/cjs/type/constructor-parameters/index.d.ts +1 -0
- package/build/cjs/type/constructor-parameters/index.js +18 -0
- package/build/cjs/type/create/immutable.d.ts +2 -0
- package/build/cjs/type/create/immutable.js +70 -0
- package/build/cjs/type/create/index.d.ts +1 -0
- package/build/cjs/type/create/index.js +18 -0
- package/build/cjs/type/create/type.d.ts +3 -0
- package/build/cjs/type/create/type.js +19 -0
- package/build/cjs/type/date/date.d.ts +21 -0
- package/build/cjs/type/date/date.js +10 -0
- package/build/cjs/type/date/index.d.ts +1 -0
- package/build/cjs/type/date/index.js +18 -0
- package/build/cjs/type/discard/discard.d.ts +2 -0
- package/build/cjs/type/discard/discard.js +12 -0
- package/build/cjs/type/discard/index.d.ts +1 -0
- package/build/cjs/type/discard/index.js +18 -0
- package/build/cjs/type/enum/enum.d.ts +14 -0
- package/build/cjs/type/enum/enum.js +22 -0
- package/build/cjs/type/enum/index.d.ts +1 -0
- package/build/cjs/type/enum/index.js +18 -0
- package/build/cjs/type/error/error.d.ts +4 -0
- package/build/cjs/type/error/error.js +11 -0
- package/build/cjs/type/error/index.d.ts +1 -0
- package/build/cjs/type/error/index.js +18 -0
- package/build/cjs/type/exclude/exclude-from-mapped-result.d.ts +11 -0
- package/build/cjs/type/exclude/exclude-from-mapped-result.js +22 -0
- package/build/cjs/type/exclude/exclude-from-template-literal.d.ts +5 -0
- package/build/cjs/type/exclude/exclude-from-template-literal.js +9 -0
- package/build/cjs/type/exclude/exclude.d.ts +21 -0
- package/build/cjs/type/exclude/exclude.js +29 -0
- package/build/cjs/type/exclude/index.d.ts +3 -0
- package/build/cjs/type/exclude/index.js +20 -0
- package/build/cjs/type/extends/extends-check.d.ts +10 -0
- package/build/cjs/type/extends/extends-check.js +641 -0
- package/build/cjs/type/extends/extends-from-mapped-key.d.ts +14 -0
- package/build/cjs/type/extends/extends-from-mapped-key.js +29 -0
- package/build/cjs/type/extends/extends-from-mapped-result.d.ts +11 -0
- package/build/cjs/type/extends/extends-from-mapped-result.js +23 -0
- package/build/cjs/type/extends/extends-undefined.d.ts +3 -0
- package/build/cjs/type/extends/extends-undefined.js +24 -0
- package/build/cjs/type/extends/extends.d.ts +16 -0
- package/build/cjs/type/extends/extends.js +27 -0
- package/build/cjs/type/extends/index.d.ts +5 -0
- package/build/cjs/type/extends/index.js +22 -0
- package/build/cjs/type/extract/extract-from-mapped-result.d.ts +11 -0
- package/build/cjs/type/extract/extract-from-mapped-result.js +22 -0
- package/build/cjs/type/extract/extract-from-template-literal.d.ts +5 -0
- package/build/cjs/type/extract/extract-from-template-literal.js +9 -0
- package/build/cjs/type/extract/extract.d.ts +21 -0
- package/build/cjs/type/extract/extract.js +29 -0
- package/build/cjs/type/extract/index.d.ts +3 -0
- package/build/cjs/type/extract/index.js +20 -0
- package/build/cjs/type/function/function.d.ts +23 -0
- package/build/cjs/type/function/function.js +10 -0
- package/build/cjs/type/function/index.d.ts +1 -0
- package/build/cjs/type/function/index.js +18 -0
- package/build/cjs/type/guard/index.d.ts +3 -0
- package/build/cjs/type/guard/index.js +40 -0
- package/build/cjs/type/guard/kind.d.ts +147 -0
- package/build/cjs/type/guard/kind.js +320 -0
- package/build/cjs/type/guard/type.d.ts +152 -0
- package/build/cjs/type/guard/type.js +597 -0
- package/build/cjs/type/guard/value.d.ts +34 -0
- package/build/cjs/type/guard/value.js +89 -0
- package/build/cjs/type/helpers/helpers.d.ts +42 -0
- package/build/cjs/type/helpers/helpers.js +8 -0
- package/build/cjs/type/helpers/index.d.ts +1 -0
- package/build/cjs/type/helpers/index.js +18 -0
- package/build/cjs/type/index.d.ts +71 -0
- package/build/cjs/type/index.js +88 -0
- package/build/cjs/type/indexed/index.d.ts +4 -0
- package/build/cjs/type/indexed/index.js +21 -0
- package/build/cjs/type/indexed/indexed-from-mapped-key.d.ts +13 -0
- package/build/cjs/type/indexed/indexed-from-mapped-key.js +26 -0
- package/build/cjs/type/indexed/indexed-from-mapped-result.d.ts +12 -0
- package/build/cjs/type/indexed/indexed-from-mapped-result.js +24 -0
- package/build/cjs/type/indexed/indexed-property-keys.d.ts +14 -0
- package/build/cjs/type/indexed/indexed-property-keys.js +36 -0
- package/build/cjs/type/indexed/indexed.d.ts +52 -0
- package/build/cjs/type/indexed/indexed.js +98 -0
- package/build/cjs/type/instance-type/index.d.ts +1 -0
- package/build/cjs/type/instance-type/index.js +18 -0
- package/build/cjs/type/instance-type/instance-type.d.ts +6 -0
- package/build/cjs/type/instance-type/instance-type.js +44 -0
- package/build/cjs/type/instantiate/index.d.ts +1 -0
- package/build/cjs/type/instantiate/index.js +18 -0
- package/build/cjs/type/instantiate/instantiate.d.ts +50 -0
- package/build/cjs/type/instantiate/instantiate.js +153 -0
- package/build/cjs/type/integer/index.d.ts +1 -0
- package/build/cjs/type/integer/index.js +18 -0
- package/build/cjs/type/integer/integer.d.ts +16 -0
- package/build/cjs/type/integer/integer.js +10 -0
- package/build/cjs/type/intersect/index.d.ts +3 -0
- package/build/cjs/type/intersect/index.js +20 -0
- package/build/cjs/type/intersect/intersect-create.d.ts +3 -0
- package/build/cjs/type/intersect/intersect-create.js +23 -0
- package/build/cjs/type/intersect/intersect-evaluated.d.ts +13 -0
- package/build/cjs/type/intersect/intersect-evaluated.js +42 -0
- package/build/cjs/type/intersect/intersect-type.d.ts +15 -0
- package/build/cjs/type/intersect/intersect-type.js +4 -0
- package/build/cjs/type/intersect/intersect.d.ts +6 -0
- package/build/cjs/type/intersect/intersect.js +21 -0
- package/build/cjs/type/intrinsic/capitalize.d.ts +5 -0
- package/build/cjs/type/intrinsic/capitalize.js +9 -0
- package/build/cjs/type/intrinsic/index.d.ts +6 -0
- package/build/cjs/type/intrinsic/index.js +23 -0
- package/build/cjs/type/intrinsic/intrinsic-from-mapped-key.d.ts +14 -0
- package/build/cjs/type/intrinsic/intrinsic-from-mapped-key.js +30 -0
- package/build/cjs/type/intrinsic/intrinsic.d.ts +16 -0
- package/build/cjs/type/intrinsic/intrinsic.js +68 -0
- package/build/cjs/type/intrinsic/lowercase.d.ts +5 -0
- package/build/cjs/type/intrinsic/lowercase.js +9 -0
- package/build/cjs/type/intrinsic/uncapitalize.d.ts +5 -0
- package/build/cjs/type/intrinsic/uncapitalize.js +9 -0
- package/build/cjs/type/intrinsic/uppercase.d.ts +5 -0
- package/build/cjs/type/intrinsic/uppercase.js +9 -0
- package/build/cjs/type/iterator/index.d.ts +1 -0
- package/build/cjs/type/iterator/index.js +18 -0
- package/build/cjs/type/iterator/iterator.d.ts +11 -0
- package/build/cjs/type/iterator/iterator.js +10 -0
- package/build/cjs/type/keyof/index.d.ts +4 -0
- package/build/cjs/type/keyof/index.js +21 -0
- package/build/cjs/type/keyof/keyof-from-mapped-result.d.ts +12 -0
- package/build/cjs/type/keyof/keyof-from-mapped-result.js +23 -0
- package/build/cjs/type/keyof/keyof-property-entries.d.ts +7 -0
- package/build/cjs/type/keyof/keyof-property-entries.js +16 -0
- package/build/cjs/type/keyof/keyof-property-keys.d.ts +24 -0
- package/build/cjs/type/keyof/keyof-property-keys.js +78 -0
- package/build/cjs/type/keyof/keyof.d.ts +21 -0
- package/build/cjs/type/keyof/keyof.js +40 -0
- package/build/cjs/type/literal/index.d.ts +1 -0
- package/build/cjs/type/literal/index.js +18 -0
- package/build/cjs/type/literal/literal.d.ts +10 -0
- package/build/cjs/type/literal/literal.js +14 -0
- package/build/cjs/type/mapped/index.d.ts +3 -0
- package/build/cjs/type/mapped/index.js +20 -0
- package/build/cjs/type/mapped/mapped-key.d.ts +8 -0
- package/build/cjs/type/mapped/mapped-key.js +13 -0
- package/build/cjs/type/mapped/mapped-result.d.ts +9 -0
- package/build/cjs/type/mapped/mapped-result.js +13 -0
- package/build/cjs/type/mapped/mapped.d.ts +47 -0
- package/build/cjs/type/mapped/mapped.js +107 -0
- package/build/cjs/type/module/compute.d.ts +59 -0
- package/build/cjs/type/module/compute.js +205 -0
- package/build/cjs/type/module/index.d.ts +1 -0
- package/build/cjs/type/module/index.js +18 -0
- package/build/cjs/type/module/infer.d.ts +49 -0
- package/build/cjs/type/module/infer.js +3 -0
- package/build/cjs/type/module/module.d.ts +27 -0
- package/build/cjs/type/module/module.js +38 -0
- package/build/cjs/type/never/index.d.ts +1 -0
- package/build/cjs/type/never/index.js +18 -0
- package/build/cjs/type/never/never.d.ts +9 -0
- package/build/cjs/type/never/never.js +10 -0
- package/build/cjs/type/not/index.d.ts +1 -0
- package/build/cjs/type/not/index.js +18 -0
- package/build/cjs/type/not/not.d.ts +10 -0
- package/build/cjs/type/not/not.js +10 -0
- package/build/cjs/type/null/index.d.ts +1 -0
- package/build/cjs/type/null/index.js +18 -0
- package/build/cjs/type/null/null.d.ts +9 -0
- package/build/cjs/type/null/null.js +10 -0
- package/build/cjs/type/number/index.d.ts +1 -0
- package/build/cjs/type/number/index.js +18 -0
- package/build/cjs/type/number/number.d.ts +16 -0
- package/build/cjs/type/number/number.js +10 -0
- package/build/cjs/type/object/index.d.ts +1 -0
- package/build/cjs/type/object/index.js +18 -0
- package/build/cjs/type/object/object.d.ts +51 -0
- package/build/cjs/type/object/object.js +22 -0
- package/build/cjs/type/omit/index.d.ts +3 -0
- package/build/cjs/type/omit/index.js +20 -0
- package/build/cjs/type/omit/omit-from-mapped-key.d.ts +12 -0
- package/build/cjs/type/omit/omit-from-mapped-key.js +26 -0
- package/build/cjs/type/omit/omit-from-mapped-result.d.ts +12 -0
- package/build/cjs/type/omit/omit-from-mapped-result.js +23 -0
- package/build/cjs/type/omit/omit.d.ts +36 -0
- package/build/cjs/type/omit/omit.js +75 -0
- package/build/cjs/type/optional/index.d.ts +2 -0
- package/build/cjs/type/optional/index.js +19 -0
- package/build/cjs/type/optional/optional-from-mapped-result.d.ts +10 -0
- package/build/cjs/type/optional/optional-from-mapped-result.js +22 -0
- package/build/cjs/type/optional/optional.d.ts +20 -0
- package/build/cjs/type/optional/optional.js +26 -0
- package/build/cjs/type/parameters/index.d.ts +1 -0
- package/build/cjs/type/parameters/index.js +18 -0
- package/build/cjs/type/parameters/parameters.d.ts +7 -0
- package/build/cjs/type/parameters/parameters.js +44 -0
- package/build/cjs/type/partial/index.d.ts +2 -0
- package/build/cjs/type/partial/index.js +19 -0
- package/build/cjs/type/partial/partial-from-mapped-result.d.ts +12 -0
- package/build/cjs/type/partial/partial-from-mapped-result.js +23 -0
- package/build/cjs/type/partial/partial.d.ts +35 -0
- package/build/cjs/type/partial/partial.js +111 -0
- package/build/cjs/type/patterns/index.d.ts +1 -0
- package/build/cjs/type/patterns/index.js +18 -0
- package/build/cjs/type/patterns/patterns.d.ts +8 -0
- package/build/cjs/type/patterns/patterns.js +12 -0
- package/build/cjs/type/pick/index.d.ts +3 -0
- package/build/cjs/type/pick/index.js +20 -0
- package/build/cjs/type/pick/pick-from-mapped-key.d.ts +12 -0
- package/build/cjs/type/pick/pick-from-mapped-key.js +28 -0
- package/build/cjs/type/pick/pick-from-mapped-result.d.ts +12 -0
- package/build/cjs/type/pick/pick-from-mapped-result.js +23 -0
- package/build/cjs/type/pick/pick.d.ts +36 -0
- package/build/cjs/type/pick/pick.js +70 -0
- package/build/cjs/type/promise/index.d.ts +1 -0
- package/build/cjs/type/promise/index.js +18 -0
- package/build/cjs/type/promise/promise.d.ts +11 -0
- package/build/cjs/type/promise/promise.js +10 -0
- package/build/cjs/type/readonly/index.d.ts +2 -0
- package/build/cjs/type/readonly/index.js +19 -0
- package/build/cjs/type/readonly/readonly-from-mapped-result.d.ts +10 -0
- package/build/cjs/type/readonly/readonly-from-mapped-result.js +22 -0
- package/build/cjs/type/readonly/readonly.d.ts +20 -0
- package/build/cjs/type/readonly/readonly.js +26 -0
- package/build/cjs/type/readonly-optional/index.d.ts +1 -0
- package/build/cjs/type/readonly-optional/index.js +18 -0
- package/build/cjs/type/readonly-optional/readonly-optional.d.ts +6 -0
- package/build/cjs/type/readonly-optional/readonly-optional.js +10 -0
- package/build/cjs/type/record/index.d.ts +1 -0
- package/build/cjs/type/record/index.js +18 -0
- package/build/cjs/type/record/record.d.ts +71 -0
- package/build/cjs/type/record/record.js +123 -0
- package/build/cjs/type/recursive/index.d.ts +1 -0
- package/build/cjs/type/recursive/index.js +18 -0
- package/build/cjs/type/recursive/recursive.d.ts +16 -0
- package/build/cjs/type/recursive/recursive.js +19 -0
- package/build/cjs/type/ref/index.d.ts +1 -0
- package/build/cjs/type/ref/index.js +18 -0
- package/build/cjs/type/ref/ref.d.ts +41 -0
- package/build/cjs/type/ref/ref.js +14 -0
- package/build/cjs/type/regexp/index.d.ts +1 -0
- package/build/cjs/type/regexp/index.js +18 -0
- package/build/cjs/type/regexp/regexp.d.ts +20 -0
- package/build/cjs/type/regexp/regexp.js +12 -0
- package/build/cjs/type/registry/format.d.ts +13 -0
- package/build/cjs/type/registry/format.js +35 -0
- package/build/cjs/type/registry/index.d.ts +2 -0
- package/build/cjs/type/registry/index.js +39 -0
- package/build/cjs/type/registry/type.d.ts +13 -0
- package/build/cjs/type/registry/type.js +35 -0
- package/build/cjs/type/required/index.d.ts +2 -0
- package/build/cjs/type/required/index.js +19 -0
- package/build/cjs/type/required/required-from-mapped-result.d.ts +12 -0
- package/build/cjs/type/required/required-from-mapped-result.js +22 -0
- package/build/cjs/type/required/required.d.ts +35 -0
- package/build/cjs/type/required/required.js +110 -0
- package/build/cjs/type/rest/index.d.ts +1 -0
- package/build/cjs/type/rest/index.js +18 -0
- package/build/cjs/type/rest/rest.d.ts +10 -0
- package/build/cjs/type/rest/rest.js +19 -0
- package/build/cjs/type/return-type/index.d.ts +1 -0
- package/build/cjs/type/return-type/index.js +18 -0
- package/build/cjs/type/return-type/return-type.d.ts +6 -0
- package/build/cjs/type/return-type/return-type.js +44 -0
- package/build/cjs/type/schema/anyschema.d.ts +33 -0
- package/build/cjs/type/schema/anyschema.js +3 -0
- package/build/cjs/type/schema/index.d.ts +2 -0
- package/build/cjs/type/schema/index.js +19 -0
- package/build/cjs/type/schema/schema.d.ts +29 -0
- package/build/cjs/type/schema/schema.js +4 -0
- package/build/cjs/type/sets/index.d.ts +1 -0
- package/build/cjs/type/sets/index.js +18 -0
- package/build/cjs/type/sets/set.d.ts +28 -0
- package/build/cjs/type/sets/set.js +59 -0
- package/build/cjs/type/static/index.d.ts +1 -0
- package/build/cjs/type/static/index.js +18 -0
- package/build/cjs/type/static/static.d.ts +39 -0
- package/build/cjs/type/static/static.js +3 -0
- package/build/cjs/type/string/index.d.ts +1 -0
- package/build/cjs/type/string/index.js +18 -0
- package/build/cjs/type/string/string.d.ts +25 -0
- package/build/cjs/type/string/string.js +10 -0
- package/build/cjs/type/symbol/index.d.ts +1 -0
- package/build/cjs/type/symbol/index.js +18 -0
- package/build/cjs/type/symbol/symbol.d.ts +10 -0
- package/build/cjs/type/symbol/symbol.js +10 -0
- package/build/cjs/type/symbols/index.d.ts +1 -0
- package/build/cjs/type/symbols/index.js +18 -0
- package/build/cjs/type/symbols/symbols.d.ts +10 -0
- package/build/cjs/type/symbols/symbols.js +14 -0
- package/build/cjs/type/template-literal/finite.d.ts +19 -0
- package/build/cjs/type/template-literal/finite.js +56 -0
- package/build/cjs/type/template-literal/generate.d.ts +21 -0
- package/build/cjs/type/template-literal/generate.js +60 -0
- package/build/cjs/type/template-literal/index.d.ts +7 -0
- package/build/cjs/type/template-literal/index.js +24 -0
- package/build/cjs/type/template-literal/parse.d.ts +20 -0
- package/build/cjs/type/template-literal/parse.js +174 -0
- package/build/cjs/type/template-literal/pattern.d.ts +5 -0
- package/build/cjs/type/template-literal/pattern.js +39 -0
- package/build/cjs/type/template-literal/syntax.d.ts +20 -0
- package/build/cjs/type/template-literal/syntax.js +59 -0
- package/build/cjs/type/template-literal/template-literal.d.ts +30 -0
- package/build/cjs/type/template-literal/template-literal.js +17 -0
- package/build/cjs/type/template-literal/union.d.ts +9 -0
- package/build/cjs/type/template-literal/union.js +13 -0
- package/build/cjs/type/transform/index.d.ts +1 -0
- package/build/cjs/type/transform/index.js +18 -0
- package/build/cjs/type/transform/transform.d.ts +30 -0
- package/build/cjs/type/transform/transform.js +47 -0
- package/build/cjs/type/tuple/index.d.ts +1 -0
- package/build/cjs/type/tuple/index.js +18 -0
- package/build/cjs/type/tuple/tuple.d.ts +16 -0
- package/build/cjs/type/tuple/tuple.js +13 -0
- package/build/cjs/type/type/index.d.ts +6 -0
- package/build/cjs/type/type/index.js +51 -0
- package/build/cjs/type/type/javascript.d.ts +64 -0
- package/build/cjs/type/type/javascript.js +104 -0
- package/build/cjs/type/type/json.d.ts +208 -0
- package/build/cjs/type/type/json.js +226 -0
- package/build/cjs/type/type/type.d.ts +59 -0
- package/build/cjs/type/type/type.js +129 -0
- package/build/cjs/type/uint8array/index.d.ts +1 -0
- package/build/cjs/type/uint8array/index.js +18 -0
- package/build/cjs/type/uint8array/uint8array.d.ts +13 -0
- package/build/cjs/type/uint8array/uint8array.js +10 -0
- package/build/cjs/type/undefined/index.d.ts +1 -0
- package/build/cjs/type/undefined/index.js +18 -0
- package/build/cjs/type/undefined/undefined.d.ts +9 -0
- package/build/cjs/type/undefined/undefined.js +10 -0
- package/build/cjs/type/union/index.d.ts +3 -0
- package/build/cjs/type/union/index.js +20 -0
- package/build/cjs/type/union/union-create.d.ts +3 -0
- package/build/cjs/type/union/union-create.js +9 -0
- package/build/cjs/type/union/union-evaluated.d.ts +13 -0
- package/build/cjs/type/union/union-evaluated.js +40 -0
- package/build/cjs/type/union/union-type.d.ts +12 -0
- package/build/cjs/type/union/union-type.js +4 -0
- package/build/cjs/type/union/union.d.ts +6 -0
- package/build/cjs/type/union/union.js +14 -0
- package/build/cjs/type/unknown/index.d.ts +1 -0
- package/build/cjs/type/unknown/index.js +18 -0
- package/build/cjs/type/unknown/unknown.d.ts +8 -0
- package/build/cjs/type/unknown/unknown.js +10 -0
- package/build/cjs/type/unsafe/index.d.ts +1 -0
- package/build/cjs/type/unsafe/index.js +18 -0
- package/build/cjs/type/unsafe/unsafe.d.ts +11 -0
- package/build/cjs/type/unsafe/unsafe.js +10 -0
- package/build/cjs/type/void/index.d.ts +1 -0
- package/build/cjs/type/void/index.js +18 -0
- package/build/cjs/type/void/void.d.ts +9 -0
- package/build/cjs/type/void/void.js +10 -0
- package/build/cjs/value/assert/assert.d.ts +15 -0
- package/build/cjs/value/assert/assert.js +55 -0
- package/build/cjs/value/assert/index.d.ts +1 -0
- package/build/cjs/value/assert/index.js +18 -0
- package/build/cjs/value/cast/cast.d.ts +11 -0
- package/build/cjs/value/cast/cast.js +241 -0
- package/build/cjs/value/cast/index.d.ts +1 -0
- package/build/cjs/value/cast/index.js +18 -0
- package/build/cjs/value/check/check.d.ts +11 -0
- package/build/cjs/value/check/check.js +476 -0
- package/build/cjs/value/check/index.d.ts +1 -0
- package/build/cjs/value/check/index.js +18 -0
- package/build/cjs/value/clean/clean.d.ts +5 -0
- package/build/cjs/value/clean/clean.js +149 -0
- package/build/cjs/value/clean/index.d.ts +1 -0
- package/build/cjs/value/clean/index.js +18 -0
- package/build/cjs/value/clone/clone.d.ts +2 -0
- package/build/cjs/value/clone/clone.js +60 -0
- package/build/cjs/value/clone/index.d.ts +1 -0
- package/build/cjs/value/clone/index.js +18 -0
- package/build/cjs/value/convert/convert.d.ts +5 -0
- package/build/cjs/value/convert/convert.js +264 -0
- package/build/cjs/value/convert/index.d.ts +1 -0
- package/build/cjs/value/convert/index.js +18 -0
- package/build/cjs/value/create/create.d.ts +11 -0
- package/build/cjs/value/create/create.js +474 -0
- package/build/cjs/value/create/index.d.ts +1 -0
- package/build/cjs/value/create/index.js +18 -0
- package/build/cjs/value/decode/decode.d.ts +6 -0
- package/build/cjs/value/decode/decode.js +14 -0
- package/build/cjs/value/decode/index.d.ts +1 -0
- package/build/cjs/value/decode/index.js +18 -0
- package/build/cjs/value/default/default.d.ts +5 -0
- package/build/cjs/value/default/default.js +176 -0
- package/build/cjs/value/default/index.d.ts +1 -0
- package/build/cjs/value/default/index.js +18 -0
- package/build/cjs/value/delta/delta.d.ts +32 -0
- package/build/cjs/value/delta/delta.js +178 -0
- package/build/cjs/value/delta/index.d.ts +1 -0
- package/build/cjs/value/delta/index.js +18 -0
- package/build/cjs/value/deref/deref.d.ts +12 -0
- package/build/cjs/value/deref/deref.js +36 -0
- package/build/cjs/value/deref/index.d.ts +1 -0
- package/build/cjs/value/deref/index.js +18 -0
- package/build/cjs/value/encode/encode.d.ts +6 -0
- package/build/cjs/value/encode/encode.js +15 -0
- package/build/cjs/value/encode/index.d.ts +1 -0
- package/build/cjs/value/encode/index.js +18 -0
- package/build/cjs/value/equal/equal.d.ts +2 -0
- package/build/cjs/value/equal/equal.js +50 -0
- package/build/cjs/value/equal/index.d.ts +1 -0
- package/build/cjs/value/equal/index.js +18 -0
- package/build/cjs/value/guard/guard.d.ts +74 -0
- package/build/cjs/value/guard/guard.js +195 -0
- package/build/cjs/value/guard/index.d.ts +1 -0
- package/build/cjs/value/guard/index.js +18 -0
- package/build/cjs/value/hash/hash.d.ts +7 -0
- package/build/cjs/value/hash/hash.js +152 -0
- package/build/cjs/value/hash/index.d.ts +1 -0
- package/build/cjs/value/hash/index.js +18 -0
- package/build/cjs/value/index.d.ts +20 -0
- package/build/cjs/value/index.js +53 -0
- package/build/cjs/value/mutate/index.d.ts +1 -0
- package/build/cjs/value/mutate/index.js +18 -0
- package/build/cjs/value/mutate/mutate.d.ts +9 -0
- package/build/cjs/value/mutate/mutate.js +104 -0
- package/build/cjs/value/parse/index.d.ts +1 -0
- package/build/cjs/value/parse/index.js +18 -0
- package/build/cjs/value/parse/parse.d.ts +22 -0
- package/build/cjs/value/parse/parse.js +87 -0
- package/build/cjs/value/pointer/index.d.ts +1 -0
- package/build/cjs/value/pointer/index.js +38 -0
- package/build/cjs/value/pointer/pointer.d.ts +22 -0
- package/build/cjs/value/pointer/pointer.js +126 -0
- package/build/cjs/value/transform/decode.d.ts +22 -0
- package/build/cjs/value/transform/decode.js +214 -0
- package/build/cjs/value/transform/encode.d.ts +23 -0
- package/build/cjs/value/transform/encode.js +225 -0
- package/build/cjs/value/transform/has.d.ts +3 -0
- package/build/cjs/value/transform/has.js +133 -0
- package/build/cjs/value/transform/index.d.ts +3 -0
- package/build/cjs/value/transform/index.js +20 -0
- package/build/cjs/value/value/index.d.ts +1 -0
- package/build/cjs/value/value/index.js +38 -0
- package/build/cjs/value/value/value.d.ts +16 -0
- package/build/cjs/value/value/value.js +39 -0
- package/build/esm/compiler/compiler.d.mts +55 -0
- package/build/esm/compiler/compiler.mjs +663 -0
- package/build/esm/compiler/index.d.mts +2 -0
- package/build/esm/compiler/index.mjs +2 -0
- package/build/esm/errors/errors.d.mts +91 -0
- package/build/esm/errors/errors.mjs +592 -0
- package/build/esm/errors/function.d.mts +21 -0
- package/build/esm/errors/function.mjs +147 -0
- package/build/esm/errors/index.d.mts +2 -0
- package/build/esm/errors/index.mjs +2 -0
- package/build/esm/index.d.mts +71 -0
- package/build/esm/index.mjs +80 -0
- package/build/esm/parser/index.d.mts +2 -0
- package/build/esm/parser/index.mjs +2 -0
- package/build/esm/parser/runtime/guard.d.mts +23 -0
- package/build/esm/parser/runtime/guard.mjs +72 -0
- package/build/esm/parser/runtime/index.d.mts +5 -0
- package/build/esm/parser/runtime/index.mjs +5 -0
- package/build/esm/parser/runtime/module.d.mts +9 -0
- package/build/esm/parser/runtime/module.mjs +17 -0
- package/build/esm/parser/runtime/parse.d.mts +9 -0
- package/build/esm/parser/runtime/parse.mjs +123 -0
- package/build/esm/parser/runtime/token.d.mts +8 -0
- package/build/esm/parser/runtime/token.mjs +223 -0
- package/build/esm/parser/runtime/types.d.mts +98 -0
- package/build/esm/parser/runtime/types.mjs +55 -0
- package/build/esm/parser/static/index.d.mts +3 -0
- package/build/esm/parser/static/index.mjs +3 -0
- package/build/esm/parser/static/parse.d.mts +20 -0
- package/build/esm/parser/static/parse.mjs +1 -0
- package/build/esm/parser/static/token.d.mts +108 -0
- package/build/esm/parser/static/token.mjs +1 -0
- package/build/esm/parser/static/types.d.mts +69 -0
- package/build/esm/parser/static/types.mjs +1 -0
- package/build/esm/syntax/index.d.mts +1 -0
- package/build/esm/syntax/index.mjs +1 -0
- package/build/esm/syntax/mapping.d.mts +167 -0
- package/build/esm/syntax/mapping.mjs +386 -0
- package/build/esm/syntax/parser.d.mts +162 -0
- package/build/esm/syntax/parser.mjs +78 -0
- package/build/esm/syntax/syntax.d.mts +12 -0
- package/build/esm/syntax/syntax.mjs +16 -0
- package/build/esm/system/index.d.mts +2 -0
- package/build/esm/system/index.mjs +2 -0
- package/build/esm/system/policy.d.mts +29 -0
- package/build/esm/system/policy.mjs +54 -0
- package/build/esm/system/system.d.mts +16 -0
- package/build/esm/system/system.mjs +37 -0
- package/build/esm/type/any/any.d.mts +8 -0
- package/build/esm/type/any/any.mjs +6 -0
- package/build/esm/type/any/index.d.mts +1 -0
- package/build/esm/type/any/index.mjs +1 -0
- package/build/esm/type/argument/argument.d.mts +9 -0
- package/build/esm/type/argument/argument.mjs +6 -0
- package/build/esm/type/argument/index.d.mts +1 -0
- package/build/esm/type/argument/index.mjs +1 -0
- package/build/esm/type/array/array.d.mts +28 -0
- package/build/esm/type/array/array.mjs +6 -0
- package/build/esm/type/array/index.d.mts +1 -0
- package/build/esm/type/array/index.mjs +1 -0
- package/build/esm/type/async-iterator/async-iterator.d.mts +11 -0
- package/build/esm/type/async-iterator/async-iterator.mjs +6 -0
- package/build/esm/type/async-iterator/index.d.mts +1 -0
- package/build/esm/type/async-iterator/index.mjs +1 -0
- package/build/esm/type/awaited/awaited.d.mts +14 -0
- package/build/esm/type/awaited/awaited.mjs +37 -0
- package/build/esm/type/awaited/index.d.mts +1 -0
- package/build/esm/type/awaited/index.mjs +1 -0
- package/build/esm/type/bigint/bigint.d.mts +16 -0
- package/build/esm/type/bigint/bigint.mjs +6 -0
- package/build/esm/type/bigint/index.d.mts +1 -0
- package/build/esm/type/bigint/index.mjs +1 -0
- package/build/esm/type/boolean/boolean.d.mts +9 -0
- package/build/esm/type/boolean/boolean.mjs +6 -0
- package/build/esm/type/boolean/index.d.mts +1 -0
- package/build/esm/type/boolean/index.mjs +1 -0
- package/build/esm/type/clone/index.d.mts +2 -0
- package/build/esm/type/clone/index.mjs +2 -0
- package/build/esm/type/clone/type.d.mts +5 -0
- package/build/esm/type/clone/type.mjs +9 -0
- package/build/esm/type/clone/value.d.mts +2 -0
- package/build/esm/type/clone/value.mjs +36 -0
- package/build/esm/type/composite/composite.d.mts +18 -0
- package/build/esm/type/composite/composite.mjs +42 -0
- package/build/esm/type/composite/index.d.mts +1 -0
- package/build/esm/type/composite/index.mjs +1 -0
- package/build/esm/type/computed/computed.d.mts +9 -0
- package/build/esm/type/computed/computed.mjs +6 -0
- package/build/esm/type/computed/index.d.mts +1 -0
- package/build/esm/type/computed/index.mjs +1 -0
- package/build/esm/type/const/const.d.mts +27 -0
- package/build/esm/type/const/const.mjs +54 -0
- package/build/esm/type/const/index.d.mts +1 -0
- package/build/esm/type/const/index.mjs +1 -0
- package/build/esm/type/constructor/constructor.d.mts +23 -0
- package/build/esm/type/constructor/constructor.mjs +6 -0
- package/build/esm/type/constructor/index.d.mts +1 -0
- package/build/esm/type/constructor/index.mjs +1 -0
- package/build/esm/type/constructor-parameters/constructor-parameters.d.mts +7 -0
- package/build/esm/type/constructor-parameters/constructor-parameters.mjs +7 -0
- package/build/esm/type/constructor-parameters/index.d.mts +1 -0
- package/build/esm/type/constructor-parameters/index.mjs +1 -0
- package/build/esm/type/create/immutable.d.mts +2 -0
- package/build/esm/type/create/immutable.mjs +33 -0
- package/build/esm/type/create/index.d.mts +1 -0
- package/build/esm/type/create/index.mjs +1 -0
- package/build/esm/type/create/type.d.mts +3 -0
- package/build/esm/type/create/type.mjs +15 -0
- package/build/esm/type/date/date.d.mts +21 -0
- package/build/esm/type/date/date.mjs +6 -0
- package/build/esm/type/date/index.d.mts +1 -0
- package/build/esm/type/date/index.mjs +1 -0
- package/build/esm/type/discard/discard.d.mts +2 -0
- package/build/esm/type/discard/discard.mjs +8 -0
- package/build/esm/type/discard/index.d.mts +1 -0
- package/build/esm/type/discard/index.mjs +1 -0
- package/build/esm/type/enum/enum.d.mts +14 -0
- package/build/esm/type/enum/enum.mjs +18 -0
- package/build/esm/type/enum/index.d.mts +1 -0
- package/build/esm/type/enum/index.mjs +1 -0
- package/build/esm/type/error/error.d.mts +4 -0
- package/build/esm/type/error/error.mjs +6 -0
- package/build/esm/type/error/index.d.mts +1 -0
- package/build/esm/type/error/index.mjs +1 -0
- package/build/esm/type/exclude/exclude-from-mapped-result.d.mts +11 -0
- package/build/esm/type/exclude/exclude-from-mapped-result.mjs +18 -0
- package/build/esm/type/exclude/exclude-from-template-literal.d.mts +5 -0
- package/build/esm/type/exclude/exclude-from-template-literal.mjs +5 -0
- package/build/esm/type/exclude/exclude.d.mts +21 -0
- package/build/esm/type/exclude/exclude.mjs +25 -0
- package/build/esm/type/exclude/index.d.mts +3 -0
- package/build/esm/type/exclude/index.mjs +3 -0
- package/build/esm/type/extends/extends-check.d.mts +10 -0
- package/build/esm/type/extends/extends-check.mjs +635 -0
- package/build/esm/type/extends/extends-from-mapped-key.d.mts +14 -0
- package/build/esm/type/extends/extends-from-mapped-key.mjs +25 -0
- package/build/esm/type/extends/extends-from-mapped-result.d.mts +11 -0
- package/build/esm/type/extends/extends-from-mapped-result.mjs +19 -0
- package/build/esm/type/extends/extends-undefined.d.mts +3 -0
- package/build/esm/type/extends/extends-undefined.mjs +20 -0
- package/build/esm/type/extends/extends.d.mts +16 -0
- package/build/esm/type/extends/extends.mjs +23 -0
- package/build/esm/type/extends/index.d.mts +5 -0
- package/build/esm/type/extends/index.mjs +5 -0
- package/build/esm/type/extract/extract-from-mapped-result.d.mts +11 -0
- package/build/esm/type/extract/extract-from-mapped-result.mjs +18 -0
- package/build/esm/type/extract/extract-from-template-literal.d.mts +5 -0
- package/build/esm/type/extract/extract-from-template-literal.mjs +5 -0
- package/build/esm/type/extract/extract.d.mts +21 -0
- package/build/esm/type/extract/extract.mjs +25 -0
- package/build/esm/type/extract/index.d.mts +3 -0
- package/build/esm/type/extract/index.mjs +3 -0
- package/build/esm/type/function/function.d.mts +23 -0
- package/build/esm/type/function/function.mjs +6 -0
- package/build/esm/type/function/index.d.mts +1 -0
- package/build/esm/type/function/index.mjs +1 -0
- package/build/esm/type/guard/index.d.mts +3 -0
- package/build/esm/type/guard/index.mjs +3 -0
- package/build/esm/type/guard/kind.d.mts +147 -0
- package/build/esm/type/guard/kind.mjs +235 -0
- package/build/esm/type/guard/type.d.mts +152 -0
- package/build/esm/type/guard/type.mjs +509 -0
- package/build/esm/type/guard/value.d.mts +34 -0
- package/build/esm/type/guard/value.mjs +70 -0
- package/build/esm/type/helpers/helpers.d.mts +42 -0
- package/build/esm/type/helpers/helpers.mjs +4 -0
- package/build/esm/type/helpers/index.d.mts +1 -0
- package/build/esm/type/helpers/index.mjs +1 -0
- package/build/esm/type/index.d.mts +71 -0
- package/build/esm/type/index.mjs +71 -0
- package/build/esm/type/indexed/index.d.mts +4 -0
- package/build/esm/type/indexed/index.mjs +4 -0
- package/build/esm/type/indexed/indexed-from-mapped-key.d.mts +13 -0
- package/build/esm/type/indexed/indexed-from-mapped-key.mjs +22 -0
- package/build/esm/type/indexed/indexed-from-mapped-result.d.mts +12 -0
- package/build/esm/type/indexed/indexed-from-mapped-result.mjs +20 -0
- package/build/esm/type/indexed/indexed-property-keys.d.mts +14 -0
- package/build/esm/type/indexed/indexed-property-keys.mjs +32 -0
- package/build/esm/type/indexed/indexed.d.mts +52 -0
- package/build/esm/type/indexed/indexed.mjs +91 -0
- package/build/esm/type/instance-type/index.d.mts +1 -0
- package/build/esm/type/instance-type/index.mjs +1 -0
- package/build/esm/type/instance-type/instance-type.d.mts +6 -0
- package/build/esm/type/instance-type/instance-type.mjs +7 -0
- package/build/esm/type/instantiate/index.d.mts +1 -0
- package/build/esm/type/instantiate/index.mjs +1 -0
- package/build/esm/type/instantiate/instantiate.d.mts +50 -0
- package/build/esm/type/instantiate/instantiate.mjs +115 -0
- package/build/esm/type/integer/index.d.mts +1 -0
- package/build/esm/type/integer/index.mjs +1 -0
- package/build/esm/type/integer/integer.d.mts +16 -0
- package/build/esm/type/integer/integer.mjs +6 -0
- package/build/esm/type/intersect/index.d.mts +3 -0
- package/build/esm/type/intersect/index.mjs +3 -0
- package/build/esm/type/intersect/intersect-create.d.mts +3 -0
- package/build/esm/type/intersect/intersect-create.mjs +19 -0
- package/build/esm/type/intersect/intersect-evaluated.d.mts +13 -0
- package/build/esm/type/intersect/intersect-evaluated.mjs +38 -0
- package/build/esm/type/intersect/intersect-type.d.mts +15 -0
- package/build/esm/type/intersect/intersect-type.mjs +1 -0
- package/build/esm/type/intersect/intersect.d.mts +6 -0
- package/build/esm/type/intersect/intersect.mjs +17 -0
- package/build/esm/type/intrinsic/capitalize.d.mts +5 -0
- package/build/esm/type/intrinsic/capitalize.mjs +5 -0
- package/build/esm/type/intrinsic/index.d.mts +6 -0
- package/build/esm/type/intrinsic/index.mjs +6 -0
- package/build/esm/type/intrinsic/intrinsic-from-mapped-key.d.mts +14 -0
- package/build/esm/type/intrinsic/intrinsic-from-mapped-key.mjs +26 -0
- package/build/esm/type/intrinsic/intrinsic.d.mts +16 -0
- package/build/esm/type/intrinsic/intrinsic.mjs +64 -0
- package/build/esm/type/intrinsic/lowercase.d.mts +5 -0
- package/build/esm/type/intrinsic/lowercase.mjs +5 -0
- package/build/esm/type/intrinsic/uncapitalize.d.mts +5 -0
- package/build/esm/type/intrinsic/uncapitalize.mjs +5 -0
- package/build/esm/type/intrinsic/uppercase.d.mts +5 -0
- package/build/esm/type/intrinsic/uppercase.mjs +5 -0
- package/build/esm/type/iterator/index.d.mts +1 -0
- package/build/esm/type/iterator/index.mjs +1 -0
- package/build/esm/type/iterator/iterator.d.mts +11 -0
- package/build/esm/type/iterator/iterator.mjs +6 -0
- package/build/esm/type/keyof/index.d.mts +4 -0
- package/build/esm/type/keyof/index.mjs +4 -0
- package/build/esm/type/keyof/keyof-from-mapped-result.d.mts +12 -0
- package/build/esm/type/keyof/keyof-from-mapped-result.mjs +19 -0
- package/build/esm/type/keyof/keyof-property-entries.d.mts +7 -0
- package/build/esm/type/keyof/keyof-property-entries.mjs +12 -0
- package/build/esm/type/keyof/keyof-property-keys.d.mts +24 -0
- package/build/esm/type/keyof/keyof-property-keys.mjs +73 -0
- package/build/esm/type/keyof/keyof.d.mts +21 -0
- package/build/esm/type/keyof/keyof.mjs +35 -0
- package/build/esm/type/literal/index.d.mts +1 -0
- package/build/esm/type/literal/index.mjs +1 -0
- package/build/esm/type/literal/literal.d.mts +10 -0
- package/build/esm/type/literal/literal.mjs +10 -0
- package/build/esm/type/mapped/index.d.mts +3 -0
- package/build/esm/type/mapped/index.mjs +3 -0
- package/build/esm/type/mapped/mapped-key.d.mts +8 -0
- package/build/esm/type/mapped/mapped-key.mjs +9 -0
- package/build/esm/type/mapped/mapped-result.d.mts +9 -0
- package/build/esm/type/mapped/mapped-result.mjs +9 -0
- package/build/esm/type/mapped/mapped.d.mts +47 -0
- package/build/esm/type/mapped/mapped.mjs +102 -0
- package/build/esm/type/module/compute.d.mts +59 -0
- package/build/esm/type/module/compute.mjs +166 -0
- package/build/esm/type/module/index.d.mts +1 -0
- package/build/esm/type/module/index.mjs +1 -0
- package/build/esm/type/module/infer.d.mts +49 -0
- package/build/esm/type/module/infer.mjs +1 -0
- package/build/esm/type/module/module.d.mts +27 -0
- package/build/esm/type/module/module.mjs +32 -0
- package/build/esm/type/never/index.d.mts +1 -0
- package/build/esm/type/never/index.mjs +1 -0
- package/build/esm/type/never/never.d.mts +9 -0
- package/build/esm/type/never/never.mjs +6 -0
- package/build/esm/type/not/index.d.mts +1 -0
- package/build/esm/type/not/index.mjs +1 -0
- package/build/esm/type/not/not.d.mts +10 -0
- package/build/esm/type/not/not.mjs +6 -0
- package/build/esm/type/null/index.d.mts +1 -0
- package/build/esm/type/null/index.mjs +1 -0
- package/build/esm/type/null/null.d.mts +9 -0
- package/build/esm/type/null/null.mjs +6 -0
- package/build/esm/type/number/index.d.mts +1 -0
- package/build/esm/type/number/index.mjs +1 -0
- package/build/esm/type/number/number.d.mts +16 -0
- package/build/esm/type/number/number.mjs +6 -0
- package/build/esm/type/object/index.d.mts +1 -0
- package/build/esm/type/object/index.mjs +1 -0
- package/build/esm/type/object/object.d.mts +51 -0
- package/build/esm/type/object/object.mjs +18 -0
- package/build/esm/type/omit/index.d.mts +3 -0
- package/build/esm/type/omit/index.mjs +3 -0
- package/build/esm/type/omit/omit-from-mapped-key.d.mts +12 -0
- package/build/esm/type/omit/omit-from-mapped-key.mjs +22 -0
- package/build/esm/type/omit/omit-from-mapped-result.d.mts +12 -0
- package/build/esm/type/omit/omit-from-mapped-result.mjs +19 -0
- package/build/esm/type/omit/omit.d.mts +36 -0
- package/build/esm/type/omit/omit.mjs +71 -0
- package/build/esm/type/optional/index.d.mts +2 -0
- package/build/esm/type/optional/index.mjs +2 -0
- package/build/esm/type/optional/optional-from-mapped-result.d.mts +10 -0
- package/build/esm/type/optional/optional-from-mapped-result.mjs +18 -0
- package/build/esm/type/optional/optional.d.mts +20 -0
- package/build/esm/type/optional/optional.mjs +22 -0
- package/build/esm/type/parameters/index.d.mts +1 -0
- package/build/esm/type/parameters/index.mjs +1 -0
- package/build/esm/type/parameters/parameters.d.mts +7 -0
- package/build/esm/type/parameters/parameters.mjs +7 -0
- package/build/esm/type/partial/index.d.mts +2 -0
- package/build/esm/type/partial/index.mjs +2 -0
- package/build/esm/type/partial/partial-from-mapped-result.d.mts +12 -0
- package/build/esm/type/partial/partial-from-mapped-result.mjs +19 -0
- package/build/esm/type/partial/partial.d.mts +35 -0
- package/build/esm/type/partial/partial.mjs +74 -0
- package/build/esm/type/patterns/index.d.mts +1 -0
- package/build/esm/type/patterns/index.mjs +1 -0
- package/build/esm/type/patterns/patterns.d.mts +8 -0
- package/build/esm/type/patterns/patterns.mjs +8 -0
- package/build/esm/type/pick/index.d.mts +3 -0
- package/build/esm/type/pick/index.mjs +3 -0
- package/build/esm/type/pick/pick-from-mapped-key.d.mts +12 -0
- package/build/esm/type/pick/pick-from-mapped-key.mjs +24 -0
- package/build/esm/type/pick/pick-from-mapped-result.d.mts +12 -0
- package/build/esm/type/pick/pick-from-mapped-result.mjs +19 -0
- package/build/esm/type/pick/pick.d.mts +36 -0
- package/build/esm/type/pick/pick.mjs +66 -0
- package/build/esm/type/promise/index.d.mts +1 -0
- package/build/esm/type/promise/index.mjs +1 -0
- package/build/esm/type/promise/promise.d.mts +11 -0
- package/build/esm/type/promise/promise.mjs +6 -0
- package/build/esm/type/readonly/index.d.mts +2 -0
- package/build/esm/type/readonly/index.mjs +2 -0
- package/build/esm/type/readonly/readonly-from-mapped-result.d.mts +10 -0
- package/build/esm/type/readonly/readonly-from-mapped-result.mjs +18 -0
- package/build/esm/type/readonly/readonly.d.mts +20 -0
- package/build/esm/type/readonly/readonly.mjs +22 -0
- package/build/esm/type/readonly-optional/index.d.mts +1 -0
- package/build/esm/type/readonly-optional/index.mjs +1 -0
- package/build/esm/type/readonly-optional/readonly-optional.d.mts +6 -0
- package/build/esm/type/readonly-optional/readonly-optional.mjs +6 -0
- package/build/esm/type/record/index.d.mts +1 -0
- package/build/esm/type/record/index.mjs +1 -0
- package/build/esm/type/record/record.d.mts +71 -0
- package/build/esm/type/record/record.mjs +116 -0
- package/build/esm/type/recursive/index.d.mts +1 -0
- package/build/esm/type/recursive/index.mjs +1 -0
- package/build/esm/type/recursive/recursive.d.mts +16 -0
- package/build/esm/type/recursive/recursive.mjs +15 -0
- package/build/esm/type/ref/index.d.mts +1 -0
- package/build/esm/type/ref/index.mjs +1 -0
- package/build/esm/type/ref/ref.d.mts +41 -0
- package/build/esm/type/ref/ref.mjs +10 -0
- package/build/esm/type/regexp/index.d.mts +1 -0
- package/build/esm/type/regexp/index.mjs +1 -0
- package/build/esm/type/regexp/regexp.d.mts +20 -0
- package/build/esm/type/regexp/regexp.mjs +8 -0
- package/build/esm/type/registry/format.d.mts +13 -0
- package/build/esm/type/registry/format.mjs +26 -0
- package/build/esm/type/registry/index.d.mts +2 -0
- package/build/esm/type/registry/index.mjs +2 -0
- package/build/esm/type/registry/type.d.mts +13 -0
- package/build/esm/type/registry/type.mjs +26 -0
- package/build/esm/type/required/index.d.mts +2 -0
- package/build/esm/type/required/index.mjs +2 -0
- package/build/esm/type/required/required-from-mapped-result.d.mts +12 -0
- package/build/esm/type/required/required-from-mapped-result.mjs +18 -0
- package/build/esm/type/required/required.d.mts +35 -0
- package/build/esm/type/required/required.mjs +73 -0
- package/build/esm/type/rest/index.d.mts +1 -0
- package/build/esm/type/rest/index.mjs +1 -0
- package/build/esm/type/rest/rest.d.mts +10 -0
- package/build/esm/type/rest/rest.mjs +15 -0
- package/build/esm/type/return-type/index.d.mts +1 -0
- package/build/esm/type/return-type/index.mjs +1 -0
- package/build/esm/type/return-type/return-type.d.mts +6 -0
- package/build/esm/type/return-type/return-type.mjs +7 -0
- package/build/esm/type/schema/anyschema.d.mts +33 -0
- package/build/esm/type/schema/anyschema.mjs +1 -0
- package/build/esm/type/schema/index.d.mts +2 -0
- package/build/esm/type/schema/index.mjs +2 -0
- package/build/esm/type/schema/schema.d.mts +29 -0
- package/build/esm/type/schema/schema.mjs +1 -0
- package/build/esm/type/sets/index.d.mts +1 -0
- package/build/esm/type/sets/index.mjs +1 -0
- package/build/esm/type/sets/set.d.mts +28 -0
- package/build/esm/type/sets/set.mjs +48 -0
- package/build/esm/type/static/index.d.mts +1 -0
- package/build/esm/type/static/index.mjs +1 -0
- package/build/esm/type/static/static.d.mts +39 -0
- package/build/esm/type/static/static.mjs +1 -0
- package/build/esm/type/string/index.d.mts +1 -0
- package/build/esm/type/string/index.mjs +1 -0
- package/build/esm/type/string/string.d.mts +25 -0
- package/build/esm/type/string/string.mjs +6 -0
- package/build/esm/type/symbol/index.d.mts +1 -0
- package/build/esm/type/symbol/index.mjs +1 -0
- package/build/esm/type/symbol/symbol.d.mts +10 -0
- package/build/esm/type/symbol/symbol.mjs +6 -0
- package/build/esm/type/symbols/index.d.mts +1 -0
- package/build/esm/type/symbols/index.mjs +1 -0
- package/build/esm/type/symbols/symbols.d.mts +10 -0
- package/build/esm/type/symbols/symbols.mjs +10 -0
- package/build/esm/type/template-literal/finite.d.mts +19 -0
- package/build/esm/type/template-literal/finite.mjs +49 -0
- package/build/esm/type/template-literal/generate.d.mts +21 -0
- package/build/esm/type/template-literal/generate.mjs +53 -0
- package/build/esm/type/template-literal/index.d.mts +7 -0
- package/build/esm/type/template-literal/index.mjs +7 -0
- package/build/esm/type/template-literal/parse.d.mts +20 -0
- package/build/esm/type/template-literal/parse.mjs +167 -0
- package/build/esm/type/template-literal/pattern.d.mts +5 -0
- package/build/esm/type/template-literal/pattern.mjs +33 -0
- package/build/esm/type/template-literal/syntax.d.mts +20 -0
- package/build/esm/type/template-literal/syntax.mjs +55 -0
- package/build/esm/type/template-literal/template-literal.d.mts +30 -0
- package/build/esm/type/template-literal/template-literal.mjs +13 -0
- package/build/esm/type/template-literal/union.d.mts +9 -0
- package/build/esm/type/template-literal/union.mjs +9 -0
- package/build/esm/type/transform/index.d.mts +1 -0
- package/build/esm/type/transform/index.mjs +1 -0
- package/build/esm/type/transform/transform.d.mts +30 -0
- package/build/esm/type/transform/transform.mjs +40 -0
- package/build/esm/type/tuple/index.d.mts +1 -0
- package/build/esm/type/tuple/index.mjs +1 -0
- package/build/esm/type/tuple/tuple.d.mts +16 -0
- package/build/esm/type/tuple/tuple.mjs +9 -0
- package/build/esm/type/type/index.d.mts +6 -0
- package/build/esm/type/type/index.mjs +13 -0
- package/build/esm/type/type/javascript.d.mts +64 -0
- package/build/esm/type/type/javascript.mjs +99 -0
- package/build/esm/type/type/json.d.mts +208 -0
- package/build/esm/type/type/json.mjs +221 -0
- package/build/esm/type/type/type.d.mts +59 -0
- package/build/esm/type/type/type.mjs +62 -0
- package/build/esm/type/uint8array/index.d.mts +1 -0
- package/build/esm/type/uint8array/index.mjs +1 -0
- package/build/esm/type/uint8array/uint8array.d.mts +13 -0
- package/build/esm/type/uint8array/uint8array.mjs +6 -0
- package/build/esm/type/undefined/index.d.mts +1 -0
- package/build/esm/type/undefined/index.mjs +1 -0
- package/build/esm/type/undefined/undefined.d.mts +9 -0
- package/build/esm/type/undefined/undefined.mjs +6 -0
- package/build/esm/type/union/index.d.mts +3 -0
- package/build/esm/type/union/index.mjs +3 -0
- package/build/esm/type/union/union-create.d.mts +3 -0
- package/build/esm/type/union/union-create.mjs +5 -0
- package/build/esm/type/union/union-evaluated.d.mts +13 -0
- package/build/esm/type/union/union-evaluated.mjs +36 -0
- package/build/esm/type/union/union-type.d.mts +12 -0
- package/build/esm/type/union/union-type.mjs +1 -0
- package/build/esm/type/union/union.d.mts +6 -0
- package/build/esm/type/union/union.mjs +10 -0
- package/build/esm/type/unknown/index.d.mts +1 -0
- package/build/esm/type/unknown/index.mjs +1 -0
- package/build/esm/type/unknown/unknown.d.mts +8 -0
- package/build/esm/type/unknown/unknown.mjs +6 -0
- package/build/esm/type/unsafe/index.d.mts +1 -0
- package/build/esm/type/unsafe/index.mjs +1 -0
- package/build/esm/type/unsafe/unsafe.d.mts +11 -0
- package/build/esm/type/unsafe/unsafe.mjs +6 -0
- package/build/esm/type/void/index.d.mts +1 -0
- package/build/esm/type/void/index.mjs +1 -0
- package/build/esm/type/void/void.d.mts +9 -0
- package/build/esm/type/void/void.mjs +6 -0
- package/build/esm/value/assert/assert.d.mts +15 -0
- package/build/esm/value/assert/assert.mjs +49 -0
- package/build/esm/value/assert/index.d.mts +1 -0
- package/build/esm/value/assert/index.mjs +1 -0
- package/build/esm/value/cast/cast.d.mts +11 -0
- package/build/esm/value/cast/cast.mjs +235 -0
- package/build/esm/value/cast/index.d.mts +1 -0
- package/build/esm/value/cast/index.mjs +1 -0
- package/build/esm/value/check/check.d.mts +11 -0
- package/build/esm/value/check/check.mjs +470 -0
- package/build/esm/value/check/index.d.mts +1 -0
- package/build/esm/value/check/index.mjs +1 -0
- package/build/esm/value/clean/clean.d.mts +5 -0
- package/build/esm/value/clean/clean.mjs +145 -0
- package/build/esm/value/clean/index.d.mts +1 -0
- package/build/esm/value/clean/index.mjs +1 -0
- package/build/esm/value/clone/clone.d.mts +2 -0
- package/build/esm/value/clone/clone.mjs +56 -0
- package/build/esm/value/clone/index.d.mts +1 -0
- package/build/esm/value/clone/index.mjs +1 -0
- package/build/esm/value/convert/convert.d.mts +5 -0
- package/build/esm/value/convert/convert.mjs +260 -0
- package/build/esm/value/convert/index.d.mts +1 -0
- package/build/esm/value/convert/index.mjs +1 -0
- package/build/esm/value/create/create.d.mts +11 -0
- package/build/esm/value/create/create.mjs +468 -0
- package/build/esm/value/create/index.d.mts +1 -0
- package/build/esm/value/create/index.mjs +1 -0
- package/build/esm/value/decode/decode.d.mts +6 -0
- package/build/esm/value/decode/decode.mjs +10 -0
- package/build/esm/value/decode/index.d.mts +1 -0
- package/build/esm/value/decode/index.mjs +1 -0
- package/build/esm/value/default/default.d.mts +5 -0
- package/build/esm/value/default/default.mjs +172 -0
- package/build/esm/value/default/index.d.mts +1 -0
- package/build/esm/value/default/index.mjs +1 -0
- package/build/esm/value/delta/delta.d.mts +32 -0
- package/build/esm/value/delta/delta.mjs +171 -0
- package/build/esm/value/delta/index.d.mts +1 -0
- package/build/esm/value/delta/index.mjs +1 -0
- package/build/esm/value/deref/deref.d.mts +12 -0
- package/build/esm/value/deref/deref.mjs +29 -0
- package/build/esm/value/deref/index.d.mts +1 -0
- package/build/esm/value/deref/index.mjs +1 -0
- package/build/esm/value/encode/encode.d.mts +6 -0
- package/build/esm/value/encode/encode.mjs +11 -0
- package/build/esm/value/encode/index.d.mts +1 -0
- package/build/esm/value/encode/index.mjs +1 -0
- package/build/esm/value/equal/equal.d.mts +2 -0
- package/build/esm/value/equal/equal.mjs +46 -0
- package/build/esm/value/equal/index.d.mts +1 -0
- package/build/esm/value/equal/index.mjs +1 -0
- package/build/esm/value/guard/guard.d.mts +74 -0
- package/build/esm/value/guard/guard.mjs +158 -0
- package/build/esm/value/guard/index.d.mts +1 -0
- package/build/esm/value/guard/index.mjs +1 -0
- package/build/esm/value/hash/hash.d.mts +7 -0
- package/build/esm/value/hash/hash.mjs +146 -0
- package/build/esm/value/hash/index.d.mts +1 -0
- package/build/esm/value/hash/index.mjs +1 -0
- package/build/esm/value/index.d.mts +20 -0
- package/build/esm/value/index.mjs +32 -0
- package/build/esm/value/mutate/index.d.mts +1 -0
- package/build/esm/value/mutate/index.mjs +1 -0
- package/build/esm/value/mutate/mutate.d.mts +9 -0
- package/build/esm/value/mutate/mutate.mjs +98 -0
- package/build/esm/value/parse/index.d.mts +1 -0
- package/build/esm/value/parse/index.mjs +1 -0
- package/build/esm/value/parse/parse.d.mts +22 -0
- package/build/esm/value/parse/parse.mjs +81 -0
- package/build/esm/value/pointer/index.d.mts +1 -0
- package/build/esm/value/pointer/index.mjs +1 -0
- package/build/esm/value/pointer/pointer.d.mts +22 -0
- package/build/esm/value/pointer/pointer.mjs +115 -0
- package/build/esm/value/transform/decode.d.mts +22 -0
- package/build/esm/value/transform/decode.mjs +207 -0
- package/build/esm/value/transform/encode.d.mts +23 -0
- package/build/esm/value/transform/encode.mjs +218 -0
- package/build/esm/value/transform/has.d.mts +3 -0
- package/build/esm/value/transform/has.mjs +129 -0
- package/build/esm/value/transform/index.d.mts +3 -0
- package/build/esm/value/transform/index.mjs +3 -0
- package/build/esm/value/value/index.d.mts +1 -0
- package/build/esm/value/value/index.mjs +1 -0
- package/build/esm/value/value/value.d.mts +16 -0
- package/build/esm/value/value/value.mjs +16 -0
- package/changes.json +5 -0
- package/compiler/package.json +4 -0
- package/errors/package.json +4 -0
- package/license +25 -0
- package/package.json +128 -0
- package/parser/package.json +4 -0
- package/readme.md +1865 -0
- package/syntax/package.json +4 -0
- package/system/package.json +4 -0
- package/type/package.json +4 -0
- package/value/package.json +4 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const PatternBoolean = '(true|false)';
|
|
2
|
+
export const PatternNumber = '(0|[1-9][0-9]*)';
|
|
3
|
+
export const PatternString = '(.*)';
|
|
4
|
+
export const PatternNever = '(?!.*)';
|
|
5
|
+
export const PatternBooleanExact = `^${PatternBoolean}$`;
|
|
6
|
+
export const PatternNumberExact = `^${PatternNumber}$`;
|
|
7
|
+
export const PatternStringExact = `^${PatternString}$`;
|
|
8
|
+
export const PatternNeverExact = `^${PatternNever}$`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TSchema, SchemaOptions } from '../schema/index.mjs';
|
|
2
|
+
import type { TProperties } from '../object/index.mjs';
|
|
3
|
+
import { type TMappedResult, type TMappedKey } from '../mapped/index.mjs';
|
|
4
|
+
import { type TPick } from './pick.mjs';
|
|
5
|
+
type TFromPropertyKey<Type extends TSchema, Key extends PropertyKey> = {
|
|
6
|
+
[_ in Key]: TPick<Type, [Key]>;
|
|
7
|
+
};
|
|
8
|
+
type TFromPropertyKeys<Type extends TSchema, PropertyKeys extends PropertyKey[], Result extends TProperties = {}> = (PropertyKeys extends [infer LeftKey extends PropertyKey, ...infer RightKeys extends PropertyKey[]] ? TFromPropertyKeys<Type, RightKeys, Result & TFromPropertyKey<Type, LeftKey>> : Result);
|
|
9
|
+
type TFromMappedKey<Type extends TSchema, MappedKey extends TMappedKey> = (TFromPropertyKeys<Type, MappedKey['keys']>);
|
|
10
|
+
export type TPickFromMappedKey<Type extends TSchema, MappedKey extends TMappedKey, Properties extends TProperties = TFromMappedKey<Type, MappedKey>> = (TMappedResult<Properties>);
|
|
11
|
+
export declare function PickFromMappedKey<Type extends TSchema, MappedKey extends TMappedKey, Properties extends TProperties = TFromMappedKey<Type, MappedKey>>(type: Type, mappedKey: MappedKey, options?: SchemaOptions): TMappedResult<Properties>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MappedResult } from '../mapped/index.mjs';
|
|
2
|
+
import { Pick } from './pick.mjs';
|
|
3
|
+
import { Clone } from '../clone/value.mjs';
|
|
4
|
+
// prettier-ignore
|
|
5
|
+
function FromPropertyKey(type, key, options) {
|
|
6
|
+
return {
|
|
7
|
+
[key]: Pick(type, [key], Clone(options))
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
// prettier-ignore
|
|
11
|
+
function FromPropertyKeys(type, propertyKeys, options) {
|
|
12
|
+
return propertyKeys.reduce((result, leftKey) => {
|
|
13
|
+
return { ...result, ...FromPropertyKey(type, leftKey, options) };
|
|
14
|
+
}, {});
|
|
15
|
+
}
|
|
16
|
+
// prettier-ignore
|
|
17
|
+
function FromMappedKey(type, mappedKey, options) {
|
|
18
|
+
return FromPropertyKeys(type, mappedKey.keys, options);
|
|
19
|
+
}
|
|
20
|
+
// prettier-ignore
|
|
21
|
+
export function PickFromMappedKey(type, mappedKey, options) {
|
|
22
|
+
const properties = FromMappedKey(type, mappedKey, options);
|
|
23
|
+
return MappedResult(properties);
|
|
24
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SchemaOptions } from '../schema/index.mjs';
|
|
2
|
+
import type { Ensure, Evaluate } from '../helpers/index.mjs';
|
|
3
|
+
import type { TProperties } from '../object/index.mjs';
|
|
4
|
+
import { type TMappedResult } from '../mapped/index.mjs';
|
|
5
|
+
import { type TPick } from './pick.mjs';
|
|
6
|
+
type TFromProperties<Properties extends TProperties, PropertyKeys extends PropertyKey[]> = ({
|
|
7
|
+
[K2 in keyof Properties]: TPick<Properties[K2], PropertyKeys>;
|
|
8
|
+
});
|
|
9
|
+
type TFromMappedResult<MappedResult extends TMappedResult, PropertyKeys extends PropertyKey[]> = (Evaluate<TFromProperties<MappedResult['properties'], PropertyKeys>>);
|
|
10
|
+
export type TPickFromMappedResult<MappedResult extends TMappedResult, PropertyKeys extends PropertyKey[], Properties extends TProperties = TFromMappedResult<MappedResult, PropertyKeys>> = (Ensure<TMappedResult<Properties>>);
|
|
11
|
+
export declare function PickFromMappedResult<MappedResult extends TMappedResult, PropertyKeys extends PropertyKey[], Properties extends TProperties = TFromMappedResult<MappedResult, PropertyKeys>>(mappedResult: MappedResult, propertyKeys: [...PropertyKeys], options?: SchemaOptions): TMappedResult<Properties>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MappedResult } from '../mapped/index.mjs';
|
|
2
|
+
import { Pick } from './pick.mjs';
|
|
3
|
+
import { Clone } from '../clone/value.mjs';
|
|
4
|
+
// prettier-ignore
|
|
5
|
+
function FromProperties(properties, propertyKeys, options) {
|
|
6
|
+
const result = {};
|
|
7
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(properties))
|
|
8
|
+
result[K2] = Pick(properties[K2], propertyKeys, Clone(options));
|
|
9
|
+
return result;
|
|
10
|
+
}
|
|
11
|
+
// prettier-ignore
|
|
12
|
+
function FromMappedResult(mappedResult, propertyKeys, options) {
|
|
13
|
+
return FromProperties(mappedResult.properties, propertyKeys, options);
|
|
14
|
+
}
|
|
15
|
+
// prettier-ignore
|
|
16
|
+
export function PickFromMappedResult(mappedResult, propertyKeys, options) {
|
|
17
|
+
const properties = FromMappedResult(mappedResult, propertyKeys, options);
|
|
18
|
+
return MappedResult(properties);
|
|
19
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { TSchema, SchemaOptions } from '../schema/index.mjs';
|
|
2
|
+
import type { TupleToUnion, Evaluate } from '../helpers/index.mjs';
|
|
3
|
+
import { type TRecursive } from '../recursive/index.mjs';
|
|
4
|
+
import { type TComputed } from '../computed/index.mjs';
|
|
5
|
+
import { type TIntersect } from '../intersect/index.mjs';
|
|
6
|
+
import { type TLiteral, type TLiteralValue } from '../literal/index.mjs';
|
|
7
|
+
import { type TObject, type TProperties } from '../object/index.mjs';
|
|
8
|
+
import { type TUnion } from '../union/index.mjs';
|
|
9
|
+
import { type TMappedKey, type TMappedResult } from '../mapped/index.mjs';
|
|
10
|
+
import { type TRef } from '../ref/index.mjs';
|
|
11
|
+
import { type TIndexPropertyKeys } from '../indexed/index.mjs';
|
|
12
|
+
import { type TPickFromMappedKey } from './pick-from-mapped-key.mjs';
|
|
13
|
+
import { type TPickFromMappedResult } from './pick-from-mapped-result.mjs';
|
|
14
|
+
type TFromIntersect<Types extends TSchema[], PropertyKeys extends PropertyKey[], Result extends TSchema[] = []> = Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromIntersect<R, PropertyKeys, [...Result, TPick<L, PropertyKeys>]> : Result;
|
|
15
|
+
type TFromUnion<Types extends TSchema[], PropertyKeys extends PropertyKey[], Result extends TSchema[] = []> = Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromUnion<R, PropertyKeys, [...Result, TPick<L, PropertyKeys>]> : Result;
|
|
16
|
+
type TFromProperties<Properties extends TProperties, PropertyKeys extends PropertyKey[], UnionKeys extends PropertyKey = TupleToUnion<PropertyKeys>> = (Evaluate<Pick<Properties, UnionKeys & keyof Properties>>);
|
|
17
|
+
type TFromObject<_Type extends TObject, Keys extends PropertyKey[], Properties extends TProperties, MappedProperties extends TProperties = TFromProperties<Properties, Keys>, Result extends TSchema = TObject<MappedProperties>> = Result;
|
|
18
|
+
type TUnionFromPropertyKeys<PropertyKeys extends PropertyKey[], Result extends TLiteral[] = []> = (PropertyKeys extends [infer Key extends PropertyKey, ...infer Rest extends PropertyKey[]] ? Key extends TLiteralValue ? TUnionFromPropertyKeys<Rest, [...Result, TLiteral<Key>]> : TUnionFromPropertyKeys<Rest, [...Result]> : TUnion<Result>);
|
|
19
|
+
export type TPickResolve<Type extends TProperties, PropertyKeys extends PropertyKey[]> = (Type extends TRecursive<infer Types extends TSchema> ? TRecursive<TPickResolve<Types, PropertyKeys>> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromIntersect<Types, PropertyKeys>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromUnion<Types, PropertyKeys>> : Type extends TObject<infer Properties extends TProperties> ? TFromObject<TObject, PropertyKeys, Properties> : TObject<{}>);
|
|
20
|
+
type TResolvePropertyKeys<Key extends TSchema | PropertyKey[]> = Key extends TSchema ? TIndexPropertyKeys<Key> : Key;
|
|
21
|
+
type TResolveTypeKey<Key extends TSchema | PropertyKey[]> = Key extends PropertyKey[] ? TUnionFromPropertyKeys<Key> : Key;
|
|
22
|
+
export type TPick<Type extends TSchema, Key extends TSchema | PropertyKey[], IsTypeRef extends boolean = Type extends TRef ? true : false, IsKeyRef extends boolean = Key extends TRef ? true : false> = (Type extends TMappedResult ? TPickFromMappedResult<Type, TResolvePropertyKeys<Key>> : Key extends TMappedKey ? TPickFromMappedKey<Type, Key> : [
|
|
23
|
+
IsTypeRef,
|
|
24
|
+
IsKeyRef
|
|
25
|
+
] extends [true, true] ? TComputed<'Pick', [Type, TResolveTypeKey<Key>]> : [
|
|
26
|
+
IsTypeRef,
|
|
27
|
+
IsKeyRef
|
|
28
|
+
] extends [false, true] ? TComputed<'Pick', [Type, TResolveTypeKey<Key>]> : [
|
|
29
|
+
IsTypeRef,
|
|
30
|
+
IsKeyRef
|
|
31
|
+
] extends [true, false] ? TComputed<'Pick', [Type, TResolveTypeKey<Key>]> : TPickResolve<Type, TResolvePropertyKeys<Key>>);
|
|
32
|
+
/** `[Json]` Constructs a type whose keys are picked from the given type */
|
|
33
|
+
export declare function Pick<Type extends TSchema, Key extends PropertyKey[]>(type: Type, key: readonly [...Key], options?: SchemaOptions): TPick<Type, Key>;
|
|
34
|
+
/** `[Json]` Constructs a type whose keys are picked from the given type */
|
|
35
|
+
export declare function Pick<Type extends TSchema, Key extends TSchema>(type: Type, key: Key, options?: SchemaOptions): TPick<Type, Key>;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { CreateType } from '../create/type.mjs';
|
|
2
|
+
import { Discard } from '../discard/discard.mjs';
|
|
3
|
+
import { Computed } from '../computed/index.mjs';
|
|
4
|
+
import { Intersect } from '../intersect/index.mjs';
|
|
5
|
+
import { Literal } from '../literal/index.mjs';
|
|
6
|
+
import { Object } from '../object/index.mjs';
|
|
7
|
+
import { Union } from '../union/index.mjs';
|
|
8
|
+
import { IndexPropertyKeys } from '../indexed/index.mjs';
|
|
9
|
+
import { TransformKind } from '../symbols/symbols.mjs';
|
|
10
|
+
// ------------------------------------------------------------------
|
|
11
|
+
// Guards
|
|
12
|
+
// ------------------------------------------------------------------
|
|
13
|
+
import { IsMappedKey, IsMappedResult, IsIntersect, IsUnion, IsObject, IsSchema, IsLiteralValue, IsRef } from '../guard/kind.mjs';
|
|
14
|
+
import { IsArray as IsArrayValue } from '../guard/value.mjs';
|
|
15
|
+
// ------------------------------------------------------------------
|
|
16
|
+
// Infrastructure
|
|
17
|
+
// ------------------------------------------------------------------
|
|
18
|
+
import { PickFromMappedKey } from './pick-from-mapped-key.mjs';
|
|
19
|
+
import { PickFromMappedResult } from './pick-from-mapped-result.mjs';
|
|
20
|
+
function FromIntersect(types, propertyKeys) {
|
|
21
|
+
return types.map((type) => PickResolve(type, propertyKeys));
|
|
22
|
+
}
|
|
23
|
+
// prettier-ignore
|
|
24
|
+
function FromUnion(types, propertyKeys) {
|
|
25
|
+
return types.map((type) => PickResolve(type, propertyKeys));
|
|
26
|
+
}
|
|
27
|
+
// prettier-ignore
|
|
28
|
+
function FromProperties(properties, propertyKeys) {
|
|
29
|
+
const result = {};
|
|
30
|
+
for (const K2 of propertyKeys)
|
|
31
|
+
if (K2 in properties)
|
|
32
|
+
result[K2] = properties[K2];
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
// prettier-ignore
|
|
36
|
+
function FromObject(Type, keys, properties) {
|
|
37
|
+
const options = Discard(Type, [TransformKind, '$id', 'required', 'properties']);
|
|
38
|
+
const mappedProperties = FromProperties(properties, keys);
|
|
39
|
+
return Object(mappedProperties, options);
|
|
40
|
+
}
|
|
41
|
+
// prettier-ignore
|
|
42
|
+
function UnionFromPropertyKeys(propertyKeys) {
|
|
43
|
+
const result = propertyKeys.reduce((result, key) => IsLiteralValue(key) ? [...result, Literal(key)] : result, []);
|
|
44
|
+
return Union(result);
|
|
45
|
+
}
|
|
46
|
+
// prettier-ignore
|
|
47
|
+
function PickResolve(type, propertyKeys) {
|
|
48
|
+
return (IsIntersect(type) ? Intersect(FromIntersect(type.allOf, propertyKeys)) :
|
|
49
|
+
IsUnion(type) ? Union(FromUnion(type.anyOf, propertyKeys)) :
|
|
50
|
+
IsObject(type) ? FromObject(type, propertyKeys, type.properties) :
|
|
51
|
+
Object({}));
|
|
52
|
+
}
|
|
53
|
+
/** `[Json]` Constructs a type whose keys are picked from the given type */
|
|
54
|
+
// prettier-ignore
|
|
55
|
+
export function Pick(type, key, options) {
|
|
56
|
+
const typeKey = IsArrayValue(key) ? UnionFromPropertyKeys(key) : key;
|
|
57
|
+
const propertyKeys = IsSchema(key) ? IndexPropertyKeys(key) : key;
|
|
58
|
+
const isTypeRef = IsRef(type);
|
|
59
|
+
const isKeyRef = IsRef(key);
|
|
60
|
+
return (IsMappedResult(type) ? PickFromMappedResult(type, propertyKeys, options) :
|
|
61
|
+
IsMappedKey(key) ? PickFromMappedKey(type, key, options) :
|
|
62
|
+
(isTypeRef && isKeyRef) ? Computed('Pick', [type, typeKey], options) :
|
|
63
|
+
(!isTypeRef && isKeyRef) ? Computed('Pick', [type, typeKey], options) :
|
|
64
|
+
(isTypeRef && !isKeyRef) ? Computed('Pick', [type, typeKey], options) :
|
|
65
|
+
CreateType({ ...PickResolve(type, propertyKeys), ...options }));
|
|
66
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './promise.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './promise.mjs';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TSchema, SchemaOptions } from '../schema/index.mjs';
|
|
2
|
+
import type { Static } from '../static/index.mjs';
|
|
3
|
+
import { Kind } from '../symbols/index.mjs';
|
|
4
|
+
export interface TPromise<T extends TSchema = TSchema> extends TSchema {
|
|
5
|
+
[Kind]: 'Promise';
|
|
6
|
+
static: Promise<Static<T, this['params']>>;
|
|
7
|
+
type: 'Promise';
|
|
8
|
+
item: TSchema;
|
|
9
|
+
}
|
|
10
|
+
/** `[JavaScript]` Creates a Promise type */
|
|
11
|
+
export declare function Promise<T extends TSchema>(item: T, options?: SchemaOptions): TPromise<T>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TProperties } from '../object/index.mjs';
|
|
2
|
+
import { type TMappedResult } from '../mapped/index.mjs';
|
|
3
|
+
import { type TReadonlyWithFlag } from './readonly.mjs';
|
|
4
|
+
type TFromProperties<P extends TProperties, F extends boolean> = ({
|
|
5
|
+
[K2 in keyof P]: TReadonlyWithFlag<P[K2], F>;
|
|
6
|
+
});
|
|
7
|
+
type TFromMappedResult<R extends TMappedResult, F extends boolean> = (TFromProperties<R['properties'], F>);
|
|
8
|
+
export type TReadonlyFromMappedResult<R extends TMappedResult, F extends boolean, P extends TProperties = TFromMappedResult<R, F>> = (TMappedResult<P>);
|
|
9
|
+
export declare function ReadonlyFromMappedResult<R extends TMappedResult, F extends boolean, P extends TProperties = TFromMappedResult<R, F>>(R: R, F: F): TMappedResult<P>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MappedResult } from '../mapped/index.mjs';
|
|
2
|
+
import { Readonly } from './readonly.mjs';
|
|
3
|
+
// prettier-ignore
|
|
4
|
+
function FromProperties(K, F) {
|
|
5
|
+
const Acc = {};
|
|
6
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(K))
|
|
7
|
+
Acc[K2] = Readonly(K[K2], F);
|
|
8
|
+
return Acc;
|
|
9
|
+
}
|
|
10
|
+
// prettier-ignore
|
|
11
|
+
function FromMappedResult(R, F) {
|
|
12
|
+
return FromProperties(R.properties, F);
|
|
13
|
+
}
|
|
14
|
+
// prettier-ignore
|
|
15
|
+
export function ReadonlyFromMappedResult(R, F) {
|
|
16
|
+
const P = FromMappedResult(R, F);
|
|
17
|
+
return MappedResult(P);
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TSchema } from '../schema/index.mjs';
|
|
2
|
+
import type { Ensure } from '../helpers/index.mjs';
|
|
3
|
+
import { ReadonlyKind } from '../symbols/index.mjs';
|
|
4
|
+
import type { TMappedResult } from '../mapped/index.mjs';
|
|
5
|
+
import { type TReadonlyFromMappedResult } from './readonly-from-mapped-result.mjs';
|
|
6
|
+
type TRemoveReadonly<T extends TSchema> = T extends TReadonly<infer S> ? S : T;
|
|
7
|
+
type TAddReadonly<T extends TSchema> = T extends TReadonly<infer S> ? TReadonly<S> : Ensure<TReadonly<T>>;
|
|
8
|
+
export type TReadonlyWithFlag<T extends TSchema, F extends boolean> = F extends false ? TRemoveReadonly<T> : TAddReadonly<T>;
|
|
9
|
+
export type TReadonly<T extends TSchema> = T & {
|
|
10
|
+
[ReadonlyKind]: 'Readonly';
|
|
11
|
+
};
|
|
12
|
+
/** `[Json]` Creates a Readonly property */
|
|
13
|
+
export declare function Readonly<T extends TMappedResult, F extends boolean>(schema: T, enable: F): TReadonlyFromMappedResult<T, F>;
|
|
14
|
+
/** `[Json]` Creates a Readonly property */
|
|
15
|
+
export declare function Readonly<T extends TSchema, F extends boolean>(schema: T, enable: F): TReadonlyWithFlag<T, F>;
|
|
16
|
+
/** `[Json]` Creates a Readonly property */
|
|
17
|
+
export declare function Readonly<T extends TMappedResult>(schema: T): TReadonlyFromMappedResult<T, true>;
|
|
18
|
+
/** `[Json]` Creates a Readonly property */
|
|
19
|
+
export declare function Readonly<T extends TSchema>(schema: T): TReadonlyWithFlag<T, true>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CreateType } from '../create/type.mjs';
|
|
2
|
+
import { ReadonlyKind } from '../symbols/index.mjs';
|
|
3
|
+
import { Discard } from '../discard/index.mjs';
|
|
4
|
+
import { ReadonlyFromMappedResult } from './readonly-from-mapped-result.mjs';
|
|
5
|
+
import { IsMappedResult } from '../guard/kind.mjs';
|
|
6
|
+
function RemoveReadonly(schema) {
|
|
7
|
+
return CreateType(Discard(schema, [ReadonlyKind]));
|
|
8
|
+
}
|
|
9
|
+
function AddReadonly(schema) {
|
|
10
|
+
return CreateType({ ...schema, [ReadonlyKind]: 'Readonly' });
|
|
11
|
+
}
|
|
12
|
+
// prettier-ignore
|
|
13
|
+
function ReadonlyWithFlag(schema, F) {
|
|
14
|
+
return (F === false
|
|
15
|
+
? RemoveReadonly(schema)
|
|
16
|
+
: AddReadonly(schema));
|
|
17
|
+
}
|
|
18
|
+
/** `[Json]` Creates a Readonly property */
|
|
19
|
+
export function Readonly(schema, enable) {
|
|
20
|
+
const F = enable ?? true;
|
|
21
|
+
return IsMappedResult(schema) ? ReadonlyFromMappedResult(schema, F) : ReadonlyWithFlag(schema, F);
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './readonly-optional.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './readonly-optional.mjs';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TSchema } from '../schema/index.mjs';
|
|
2
|
+
import { type TReadonly } from '../readonly/index.mjs';
|
|
3
|
+
import { type TOptional } from '../optional/index.mjs';
|
|
4
|
+
export type TReadonlyOptional<T extends TSchema> = TOptional<T> & TReadonly<T>;
|
|
5
|
+
/** `[Json]` Creates a Readonly and Optional property */
|
|
6
|
+
export declare function ReadonlyOptional<T extends TSchema>(schema: T): TReadonly<TOptional<T>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './record.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './record.mjs';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Kind } from '../symbols/index.mjs';
|
|
2
|
+
import type { TSchema } from '../schema/index.mjs';
|
|
3
|
+
import type { Static } from '../static/index.mjs';
|
|
4
|
+
import type { Evaluate, Ensure, Assert } from '../helpers/index.mjs';
|
|
5
|
+
import { type TAny } from '../any/index.mjs';
|
|
6
|
+
import { type TBoolean } from '../boolean/index.mjs';
|
|
7
|
+
import { type TEnumRecord, type TEnum } from '../enum/index.mjs';
|
|
8
|
+
import { type TInteger } from '../integer/index.mjs';
|
|
9
|
+
import { type TLiteral, type TLiteralValue } from '../literal/index.mjs';
|
|
10
|
+
import { type TNever } from '../never/index.mjs';
|
|
11
|
+
import { type TNumber } from '../number/index.mjs';
|
|
12
|
+
import { type TObject, type TProperties, type TAdditionalProperties, type ObjectOptions } from '../object/index.mjs';
|
|
13
|
+
import { type TRegExp } from '../regexp/index.mjs';
|
|
14
|
+
import { type TString } from '../string/index.mjs';
|
|
15
|
+
import { type TUnion } from '../union/index.mjs';
|
|
16
|
+
import { TIsTemplateLiteralFinite, type TTemplateLiteral } from '../template-literal/index.mjs';
|
|
17
|
+
type TFromTemplateLiteralKeyInfinite<Key extends TTemplateLiteral, Type extends TSchema> = Ensure<TRecord<Key, Type>>;
|
|
18
|
+
type TFromTemplateLiteralKeyFinite<Key extends TTemplateLiteral, Type extends TSchema, I extends string = Static<Key>> = (Ensure<TObject<Evaluate<{
|
|
19
|
+
[_ in I]: Type;
|
|
20
|
+
}>>>);
|
|
21
|
+
type TFromTemplateLiteralKey<Key extends TTemplateLiteral, Type extends TSchema> = TIsTemplateLiteralFinite<Key> extends false ? TFromTemplateLiteralKeyInfinite<Key, Type> : TFromTemplateLiteralKeyFinite<Key, Type>;
|
|
22
|
+
type TFromEnumKey<Key extends Record<string, string | number>, Type extends TSchema> = Ensure<TObject<{
|
|
23
|
+
[_ in Key[keyof Key]]: Type;
|
|
24
|
+
}>>;
|
|
25
|
+
type TFromUnionKeyLiteralString<Key extends TLiteral<string>, Type extends TSchema> = {
|
|
26
|
+
[_ in Key['const']]: Type;
|
|
27
|
+
};
|
|
28
|
+
type TFromUnionKeyLiteralNumber<Key extends TLiteral<number>, Type extends TSchema> = {
|
|
29
|
+
[_ in Key['const']]: Type;
|
|
30
|
+
};
|
|
31
|
+
type TFromUnionKeyVariants<Keys extends TSchema[], Type extends TSchema, Result extends TProperties = {}> = Keys extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? (Left extends TUnion<infer Types extends TSchema[]> ? TFromUnionKeyVariants<Right, Type, Result & TFromUnionKeyVariants<Types, Type>> : Left extends TLiteral<string> ? TFromUnionKeyVariants<Right, Type, Result & TFromUnionKeyLiteralString<Left, Type>> : Left extends TLiteral<number> ? TFromUnionKeyVariants<Right, Type, Result & TFromUnionKeyLiteralNumber<Left, Type>> : {}) : Result;
|
|
32
|
+
type TFromUnionKey<Key extends TSchema[], Type extends TSchema, Properties extends TProperties = TFromUnionKeyVariants<Key, Type>> = (Ensure<TObject<Evaluate<Properties>>>);
|
|
33
|
+
type TFromLiteralKey<Key extends TLiteralValue, Type extends TSchema> = (Ensure<TObject<{
|
|
34
|
+
[_ in Assert<Key, PropertyKey>]: Type;
|
|
35
|
+
}>>);
|
|
36
|
+
type TFromRegExpKey<_Key extends TRegExp, Type extends TSchema> = (Ensure<TRecord<TRegExp, Type>>);
|
|
37
|
+
type TFromStringKey<_Key extends TString, Type extends TSchema> = (Ensure<TRecord<TString, Type>>);
|
|
38
|
+
type TFromAnyKey<_Key extends TAny, Type extends TSchema> = (Ensure<TRecord<TAny, Type>>);
|
|
39
|
+
type TFromNeverKey<_Key extends TNever, Type extends TSchema> = (Ensure<TRecord<TNever, Type>>);
|
|
40
|
+
type TFromBooleanKey<_Key extends TBoolean, Type extends TSchema> = (Ensure<TObject<{
|
|
41
|
+
true: Type;
|
|
42
|
+
false: Type;
|
|
43
|
+
}>>);
|
|
44
|
+
type TFromIntegerKey<_Key extends TSchema, Type extends TSchema> = (Ensure<TRecord<TNumber, Type>>);
|
|
45
|
+
type TFromNumberKey<_Key extends TSchema, Type extends TSchema> = (Ensure<TRecord<TNumber, Type>>);
|
|
46
|
+
type RecordStatic<Key extends TSchema, Type extends TSchema, P extends unknown[]> = (Evaluate<{
|
|
47
|
+
[_ in Assert<Static<Key>, PropertyKey>]: Static<Type, P>;
|
|
48
|
+
}>);
|
|
49
|
+
export interface TRecord<Key extends TSchema = TSchema, Type extends TSchema = TSchema> extends TSchema {
|
|
50
|
+
[Kind]: 'Record';
|
|
51
|
+
static: RecordStatic<Key, Type, this['params']>;
|
|
52
|
+
type: 'object';
|
|
53
|
+
patternProperties: {
|
|
54
|
+
[pattern: string]: Type;
|
|
55
|
+
};
|
|
56
|
+
additionalProperties: TAdditionalProperties;
|
|
57
|
+
}
|
|
58
|
+
export type TRecordOrObject<Key extends TSchema, Type extends TSchema> = (Key extends TTemplateLiteral ? TFromTemplateLiteralKey<Key, Type> : Key extends TEnum<infer Enum extends TEnumRecord> ? TFromEnumKey<Enum, Type> : Key extends TUnion<infer Types extends TSchema[]> ? TFromUnionKey<Types, Type> : Key extends TLiteral<infer Value extends TLiteralValue> ? TFromLiteralKey<Value, Type> : Key extends TBoolean ? TFromBooleanKey<Key, Type> : Key extends TInteger ? TFromIntegerKey<Key, Type> : Key extends TNumber ? TFromNumberKey<Key, Type> : Key extends TRegExp ? TFromRegExpKey<Key, Type> : Key extends TString ? TFromStringKey<Key, Type> : Key extends TAny ? TFromAnyKey<Key, Type> : Key extends TNever ? TFromNeverKey<Key, Type> : TNever);
|
|
59
|
+
/** `[Json]` Creates a Record type */
|
|
60
|
+
export declare function Record<Key extends TSchema, Type extends TSchema>(key: Key, type: Type, options?: ObjectOptions): TRecordOrObject<Key, Type>;
|
|
61
|
+
/** Gets the Records Pattern */
|
|
62
|
+
export declare function RecordPattern(record: TRecord): string;
|
|
63
|
+
/** Gets the Records Key Type */
|
|
64
|
+
export type TRecordKey<Type extends TRecord, Result extends TSchema = Type extends TRecord<infer Key extends TSchema, TSchema> ? (Key extends TNumber ? TNumber : Key extends TString ? TString : TString) : TString> = Result;
|
|
65
|
+
/** Gets the Records Key Type */
|
|
66
|
+
export declare function RecordKey<Type extends TRecord>(type: Type): TRecordKey<Type>;
|
|
67
|
+
/** Gets a Record Value Type */
|
|
68
|
+
export type TRecordValue<Type extends TRecord, Result extends TSchema = (Type extends TRecord<TSchema, infer Value extends TSchema> ? Value : TNever)> = Result;
|
|
69
|
+
/** Gets a Record Value Type */
|
|
70
|
+
export declare function RecordValue<Type extends TRecord>(type: Type): TRecordValue<Type>;
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { CreateType } from '../create/type.mjs';
|
|
2
|
+
import { Kind, Hint } from '../symbols/index.mjs';
|
|
3
|
+
import { Never } from '../never/index.mjs';
|
|
4
|
+
import { Number } from '../number/index.mjs';
|
|
5
|
+
import { Object } from '../object/index.mjs';
|
|
6
|
+
import { String } from '../string/index.mjs';
|
|
7
|
+
import { Union } from '../union/index.mjs';
|
|
8
|
+
import { IsTemplateLiteralFinite } from '../template-literal/index.mjs';
|
|
9
|
+
import { PatternStringExact, PatternNumberExact, PatternNeverExact } from '../patterns/index.mjs';
|
|
10
|
+
import { IndexPropertyKeys } from '../indexed/index.mjs';
|
|
11
|
+
// ------------------------------------------------------------------
|
|
12
|
+
// ValueGuard
|
|
13
|
+
// ------------------------------------------------------------------
|
|
14
|
+
import { IsUndefined } from '../guard/value.mjs';
|
|
15
|
+
// ------------------------------------------------------------------
|
|
16
|
+
// TypeGuard
|
|
17
|
+
// ------------------------------------------------------------------
|
|
18
|
+
import { IsInteger, IsLiteral, IsAny, IsBoolean, IsNever, IsNumber, IsString, IsRegExp, IsTemplateLiteral, IsUnion } from '../guard/kind.mjs';
|
|
19
|
+
// ------------------------------------------------------------------
|
|
20
|
+
// RecordCreateFromPattern
|
|
21
|
+
// ------------------------------------------------------------------
|
|
22
|
+
// prettier-ignore
|
|
23
|
+
function RecordCreateFromPattern(pattern, T, options) {
|
|
24
|
+
return CreateType({ [Kind]: 'Record', type: 'object', patternProperties: { [pattern]: T } }, options);
|
|
25
|
+
}
|
|
26
|
+
// ------------------------------------------------------------------
|
|
27
|
+
// RecordCreateFromKeys
|
|
28
|
+
// ------------------------------------------------------------------
|
|
29
|
+
// prettier-ignore
|
|
30
|
+
function RecordCreateFromKeys(K, T, options) {
|
|
31
|
+
const result = {};
|
|
32
|
+
for (const K2 of K)
|
|
33
|
+
result[K2] = T;
|
|
34
|
+
return Object(result, { ...options, [Hint]: 'Record' });
|
|
35
|
+
}
|
|
36
|
+
// prettier-ignore
|
|
37
|
+
function FromTemplateLiteralKey(K, T, options) {
|
|
38
|
+
return (IsTemplateLiteralFinite(K)
|
|
39
|
+
? RecordCreateFromKeys(IndexPropertyKeys(K), T, options)
|
|
40
|
+
: RecordCreateFromPattern(K.pattern, T, options));
|
|
41
|
+
}
|
|
42
|
+
// prettier-ignore
|
|
43
|
+
function FromUnionKey(key, type, options) {
|
|
44
|
+
return RecordCreateFromKeys(IndexPropertyKeys(Union(key)), type, options);
|
|
45
|
+
}
|
|
46
|
+
// prettier-ignore
|
|
47
|
+
function FromLiteralKey(key, type, options) {
|
|
48
|
+
return RecordCreateFromKeys([key.toString()], type, options);
|
|
49
|
+
}
|
|
50
|
+
// prettier-ignore
|
|
51
|
+
function FromRegExpKey(key, type, options) {
|
|
52
|
+
return RecordCreateFromPattern(key.source, type, options);
|
|
53
|
+
}
|
|
54
|
+
// prettier-ignore
|
|
55
|
+
function FromStringKey(key, type, options) {
|
|
56
|
+
const pattern = IsUndefined(key.pattern) ? PatternStringExact : key.pattern;
|
|
57
|
+
return RecordCreateFromPattern(pattern, type, options);
|
|
58
|
+
}
|
|
59
|
+
// prettier-ignore
|
|
60
|
+
function FromAnyKey(_, type, options) {
|
|
61
|
+
return RecordCreateFromPattern(PatternStringExact, type, options);
|
|
62
|
+
}
|
|
63
|
+
// prettier-ignore
|
|
64
|
+
function FromNeverKey(_key, type, options) {
|
|
65
|
+
return RecordCreateFromPattern(PatternNeverExact, type, options);
|
|
66
|
+
}
|
|
67
|
+
// prettier-ignore
|
|
68
|
+
function FromBooleanKey(_key, type, options) {
|
|
69
|
+
return Object({ true: type, false: type }, options);
|
|
70
|
+
}
|
|
71
|
+
// prettier-ignore
|
|
72
|
+
function FromIntegerKey(_key, type, options) {
|
|
73
|
+
return RecordCreateFromPattern(PatternNumberExact, type, options);
|
|
74
|
+
}
|
|
75
|
+
// prettier-ignore
|
|
76
|
+
function FromNumberKey(_, type, options) {
|
|
77
|
+
return RecordCreateFromPattern(PatternNumberExact, type, options);
|
|
78
|
+
}
|
|
79
|
+
// ------------------------------------------------------------------
|
|
80
|
+
// TRecordOrObject
|
|
81
|
+
// ------------------------------------------------------------------
|
|
82
|
+
/** `[Json]` Creates a Record type */
|
|
83
|
+
export function Record(key, type, options = {}) {
|
|
84
|
+
// prettier-ignore
|
|
85
|
+
return (IsUnion(key) ? FromUnionKey(key.anyOf, type, options) :
|
|
86
|
+
IsTemplateLiteral(key) ? FromTemplateLiteralKey(key, type, options) :
|
|
87
|
+
IsLiteral(key) ? FromLiteralKey(key.const, type, options) :
|
|
88
|
+
IsBoolean(key) ? FromBooleanKey(key, type, options) :
|
|
89
|
+
IsInteger(key) ? FromIntegerKey(key, type, options) :
|
|
90
|
+
IsNumber(key) ? FromNumberKey(key, type, options) :
|
|
91
|
+
IsRegExp(key) ? FromRegExpKey(key, type, options) :
|
|
92
|
+
IsString(key) ? FromStringKey(key, type, options) :
|
|
93
|
+
IsAny(key) ? FromAnyKey(key, type, options) :
|
|
94
|
+
IsNever(key) ? FromNeverKey(key, type, options) :
|
|
95
|
+
Never(options));
|
|
96
|
+
}
|
|
97
|
+
// ------------------------------------------------------------------
|
|
98
|
+
// Record Utilities
|
|
99
|
+
// ------------------------------------------------------------------
|
|
100
|
+
/** Gets the Records Pattern */
|
|
101
|
+
export function RecordPattern(record) {
|
|
102
|
+
return globalThis.Object.getOwnPropertyNames(record.patternProperties)[0];
|
|
103
|
+
}
|
|
104
|
+
/** Gets the Records Key Type */
|
|
105
|
+
// prettier-ignore
|
|
106
|
+
export function RecordKey(type) {
|
|
107
|
+
const pattern = RecordPattern(type);
|
|
108
|
+
return (pattern === PatternStringExact ? String() :
|
|
109
|
+
pattern === PatternNumberExact ? Number() :
|
|
110
|
+
String({ pattern }));
|
|
111
|
+
}
|
|
112
|
+
/** Gets a Record Value Type */
|
|
113
|
+
// prettier-ignore
|
|
114
|
+
export function RecordValue(type) {
|
|
115
|
+
return type.patternProperties[RecordPattern(type)];
|
|
116
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './recursive.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './recursive.mjs';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TSchema, SchemaOptions } from '../schema/index.mjs';
|
|
2
|
+
import { Kind, Hint } from '../symbols/index.mjs';
|
|
3
|
+
import { Static } from '../static/index.mjs';
|
|
4
|
+
export interface TThis extends TSchema {
|
|
5
|
+
[Kind]: 'This';
|
|
6
|
+
static: this['params'][0];
|
|
7
|
+
$ref: string;
|
|
8
|
+
}
|
|
9
|
+
type RecursiveStatic<T extends TSchema> = Static<T, [RecursiveStatic<T>]>;
|
|
10
|
+
export interface TRecursive<T extends TSchema> extends TSchema {
|
|
11
|
+
[Hint]: 'Recursive';
|
|
12
|
+
static: RecursiveStatic<T>;
|
|
13
|
+
}
|
|
14
|
+
/** `[Json]` Creates a Recursive type */
|
|
15
|
+
export declare function Recursive<T extends TSchema>(callback: (thisType: TThis) => T, options?: SchemaOptions): TRecursive<T>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CloneType } from '../clone/type.mjs';
|
|
2
|
+
import { CreateType } from '../create/type.mjs';
|
|
3
|
+
import { IsUndefined } from '../guard/value.mjs';
|
|
4
|
+
import { Kind, Hint } from '../symbols/index.mjs';
|
|
5
|
+
// Auto Tracked For Recursive Types without ID's
|
|
6
|
+
let Ordinal = 0;
|
|
7
|
+
/** `[Json]` Creates a Recursive type */
|
|
8
|
+
export function Recursive(callback, options = {}) {
|
|
9
|
+
if (IsUndefined(options.$id))
|
|
10
|
+
options.$id = `T${Ordinal++}`;
|
|
11
|
+
const thisType = CloneType(callback({ [Kind]: 'This', $ref: `${options.$id}` }));
|
|
12
|
+
thisType.$id = options.$id;
|
|
13
|
+
// prettier-ignore
|
|
14
|
+
return CreateType({ [Hint]: 'Recursive', ...thisType }, options);
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ref.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ref.mjs';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { TSchema, SchemaOptions } from '../schema/index.mjs';
|
|
2
|
+
import { Kind } from '../symbols/index.mjs';
|
|
3
|
+
import { TUnsafe } from '../unsafe/index.mjs';
|
|
4
|
+
import { Static } from '../static/index.mjs';
|
|
5
|
+
export interface TRef<Ref extends string = string> extends TSchema {
|
|
6
|
+
[Kind]: 'Ref';
|
|
7
|
+
static: unknown;
|
|
8
|
+
$ref: Ref;
|
|
9
|
+
}
|
|
10
|
+
export type TRefUnsafe<Type extends TSchema> = TUnsafe<Static<Type>>;
|
|
11
|
+
/** `[Json]` Creates a Ref type.*/
|
|
12
|
+
export declare function Ref<Ref extends string>($ref: Ref, options?: SchemaOptions): TRef<Ref>;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated `[Json]` Creates a Ref type. This signature was deprecated in 0.34.0 where Ref requires callers to pass
|
|
15
|
+
* a `string` value for the reference (and not a schema).
|
|
16
|
+
*
|
|
17
|
+
* To adhere to the 0.34.0 signature, Ref implementations should be updated to the following.
|
|
18
|
+
*
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // pre-0.34.0
|
|
21
|
+
*
|
|
22
|
+
* const T = Type.String({ $id: 'T' })
|
|
23
|
+
*
|
|
24
|
+
* const R = Type.Ref(T)
|
|
25
|
+
* ```
|
|
26
|
+
* should be changed to the following
|
|
27
|
+
*
|
|
28
|
+
* ```typescript
|
|
29
|
+
* // post-0.34.0
|
|
30
|
+
*
|
|
31
|
+
* const T = Type.String({ $id: 'T' })
|
|
32
|
+
*
|
|
33
|
+
* const R = Type.Unsafe<Static<typeof T>>(Type.Ref('T'))
|
|
34
|
+
* ```
|
|
35
|
+
* You can also create a generic function to replicate the pre-0.34.0 signature if required
|
|
36
|
+
*
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const LegacyRef = <T extends TSchema>(schema: T) => Type.Unsafe<Static<T>>(Type.Ref(schema.$id!))
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function Ref<Type extends TSchema>(type: Type, options?: SchemaOptions): TRefUnsafe<Type>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TypeBoxError } from '../error/index.mjs';
|
|
2
|
+
import { CreateType } from '../create/type.mjs';
|
|
3
|
+
import { Kind } from '../symbols/index.mjs';
|
|
4
|
+
/** `[Json]` Creates a Ref type. The referenced type must contain a $id */
|
|
5
|
+
export function Ref(...args) {
|
|
6
|
+
const [$ref, options] = typeof args[0] === 'string' ? [args[0], args[1]] : [args[0].$id, args[1]];
|
|
7
|
+
if (typeof $ref !== 'string')
|
|
8
|
+
throw new TypeBoxError('Ref: $ref must be a string');
|
|
9
|
+
return CreateType({ [Kind]: 'Ref', $ref }, options);
|
|
10
|
+
}
|