zod 4.0.0-beta.20250505T195954 → 4.0.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 +208 -0
- package/index.cjs +33 -0
- package/index.d.cts +4 -0
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/locales/index.cjs +17 -0
- package/locales/index.d.cts +1 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/mini/index.cjs +17 -0
- package/mini/index.d.cts +1 -0
- package/mini/index.d.ts +1 -0
- package/mini/index.js +1 -0
- package/package.json +87 -40
- package/src/index.ts +2 -3
- package/src/locales/index.ts +1 -0
- package/src/mini/index.ts +1 -0
- package/src/v3/ZodError.ts +330 -0
- package/src/v3/benchmarks/datetime.ts +58 -0
- package/src/v3/benchmarks/discriminatedUnion.ts +80 -0
- package/src/v3/benchmarks/index.ts +59 -0
- package/src/v3/benchmarks/ipv4.ts +57 -0
- package/src/v3/benchmarks/object.ts +69 -0
- package/src/v3/benchmarks/primitives.ts +162 -0
- package/src/v3/benchmarks/realworld.ts +63 -0
- package/src/v3/benchmarks/string.ts +55 -0
- package/src/v3/benchmarks/union.ts +80 -0
- package/src/v3/errors.ts +13 -0
- package/src/v3/external.ts +6 -0
- package/src/v3/helpers/enumUtil.ts +17 -0
- package/src/v3/helpers/errorUtil.ts +8 -0
- package/src/v3/helpers/parseUtil.ts +176 -0
- package/src/v3/helpers/partialUtil.ts +34 -0
- package/src/v3/helpers/typeAliases.ts +2 -0
- package/src/v3/helpers/util.ts +224 -0
- package/src/v3/index.ts +4 -0
- package/src/v3/locales/en.ts +124 -0
- package/src/v3/standard-schema.ts +113 -0
- package/src/v3/tests/Mocker.ts +54 -0
- package/src/v3/tests/all-errors.test.ts +157 -0
- package/src/v3/tests/anyunknown.test.ts +28 -0
- package/src/v3/tests/array.test.ts +71 -0
- package/src/v3/tests/async-parsing.test.ts +388 -0
- package/src/v3/tests/async-refinements.test.ts +46 -0
- package/src/v3/tests/base.test.ts +29 -0
- package/src/v3/tests/bigint.test.ts +55 -0
- package/src/v3/tests/branded.test.ts +53 -0
- package/src/v3/tests/catch.test.ts +220 -0
- package/src/v3/tests/coerce.test.ts +133 -0
- package/src/v3/tests/complex.test.ts +56 -0
- package/src/v3/tests/custom.test.ts +31 -0
- package/src/v3/tests/date.test.ts +32 -0
- package/src/v3/tests/deepmasking.test.ts +186 -0
- package/src/v3/tests/default.test.ts +112 -0
- package/src/v3/tests/description.test.ts +33 -0
- package/src/v3/tests/discriminated-unions.test.ts +315 -0
- package/src/v3/tests/enum.test.ts +80 -0
- package/src/v3/tests/error.test.ts +551 -0
- package/src/v3/tests/firstparty.test.ts +87 -0
- package/src/v3/tests/firstpartyschematypes.test.ts +21 -0
- package/src/v3/tests/function.test.ts +257 -0
- package/src/v3/tests/generics.test.ts +48 -0
- package/src/v3/tests/instanceof.test.ts +37 -0
- package/src/v3/tests/intersection.test.ts +110 -0
- package/src/v3/tests/language-server.source.ts +76 -0
- package/src/v3/tests/language-server.test.ts +207 -0
- package/src/v3/tests/literal.test.ts +36 -0
- package/src/v3/tests/map.test.ts +110 -0
- package/src/v3/tests/masking.test.ts +4 -0
- package/src/v3/tests/mocker.test.ts +19 -0
- package/src/v3/tests/nan.test.ts +21 -0
- package/src/v3/tests/nativeEnum.test.ts +87 -0
- package/src/v3/tests/nullable.test.ts +42 -0
- package/src/v3/tests/number.test.ts +176 -0
- package/src/v3/tests/object-augmentation.test.ts +29 -0
- package/src/v3/tests/object-in-es5-env.test.ts +29 -0
- package/src/v3/tests/object.test.ts +434 -0
- package/src/v3/tests/optional.test.ts +42 -0
- package/src/v3/tests/parseUtil.test.ts +23 -0
- package/src/v3/tests/parser.test.ts +41 -0
- package/src/v3/tests/partials.test.ts +243 -0
- package/src/v3/tests/pickomit.test.ts +111 -0
- package/src/v3/tests/pipeline.test.ts +29 -0
- package/src/v3/tests/preprocess.test.ts +186 -0
- package/src/v3/tests/primitive.test.ts +440 -0
- package/src/v3/tests/promise.test.ts +90 -0
- package/src/v3/tests/readonly.test.ts +194 -0
- package/src/v3/tests/record.test.ts +171 -0
- package/src/v3/tests/recursive.test.ts +197 -0
- package/src/v3/tests/refine.test.ts +313 -0
- package/src/v3/tests/safeparse.test.ts +27 -0
- package/src/v3/tests/set.test.ts +142 -0
- package/src/v3/tests/standard-schema.test.ts +83 -0
- package/src/v3/tests/string.test.ts +916 -0
- package/src/v3/tests/transformer.test.ts +233 -0
- package/src/v3/tests/tuple.test.ts +90 -0
- package/src/v3/tests/unions.test.ts +57 -0
- package/src/v3/tests/validations.test.ts +133 -0
- package/src/v3/tests/void.test.ts +15 -0
- package/src/v3/types.ts +5136 -0
- package/src/{checks.ts → v4/classic/checks.ts} +1 -1
- package/src/v4/classic/coerce.ts +27 -0
- package/src/{compat.ts → v4/classic/compat.ts} +3 -13
- package/src/v4/classic/errors.ts +75 -0
- package/src/v4/classic/external.ts +50 -0
- package/src/v4/classic/index.ts +5 -0
- package/src/{iso.ts → v4/classic/iso.ts} +1 -1
- package/src/{parse.ts → v4/classic/parse.ts} +13 -12
- package/src/{schemas.ts → v4/classic/schemas.ts} +430 -417
- package/src/v4/classic/tests/anyunknown.test.ts +26 -0
- package/src/v4/classic/tests/array.test.ts +264 -0
- package/src/v4/classic/tests/assignability.test.ts +210 -0
- package/src/v4/classic/tests/async-parsing.test.ts +381 -0
- package/src/v4/classic/tests/async-refinements.test.ts +68 -0
- package/src/v4/classic/tests/base.test.ts +7 -0
- package/src/v4/classic/tests/bigint.test.ts +54 -0
- package/src/v4/classic/tests/brand.test.ts +63 -0
- package/src/v4/classic/tests/catch.test.ts +252 -0
- package/src/v4/classic/tests/coalesce.test.ts +20 -0
- package/src/v4/classic/tests/coerce.test.ts +160 -0
- package/src/v4/classic/tests/continuability.test.ts +352 -0
- package/src/v4/classic/tests/custom.test.ts +40 -0
- package/src/v4/classic/tests/date.test.ts +31 -0
- package/src/v4/classic/tests/datetime.test.ts +296 -0
- package/src/v4/classic/tests/default.test.ts +313 -0
- package/src/v4/classic/tests/description.test.ts +32 -0
- package/src/v4/classic/tests/discriminated-unions.test.ts +619 -0
- package/src/v4/classic/tests/enum.test.ts +285 -0
- package/src/v4/classic/tests/error-utils.test.ts +552 -0
- package/src/v4/classic/tests/error.test.ts +711 -0
- package/src/v4/classic/tests/file.test.ts +91 -0
- package/src/v4/classic/tests/firstparty.test.ts +175 -0
- package/src/v4/classic/tests/function.test.ts +268 -0
- package/src/v4/classic/tests/generics.test.ts +72 -0
- package/src/v4/classic/tests/index.test.ts +829 -0
- package/src/v4/classic/tests/instanceof.test.ts +34 -0
- package/src/v4/classic/tests/intersection.test.ts +171 -0
- package/src/v4/classic/tests/json.test.ts +108 -0
- package/src/v4/classic/tests/lazy.test.ts +227 -0
- package/src/v4/classic/tests/literal.test.ts +92 -0
- package/src/v4/classic/tests/map.test.ts +196 -0
- package/src/v4/classic/tests/nan.test.ts +21 -0
- package/src/v4/classic/tests/nested-refine.test.ts +168 -0
- package/src/v4/classic/tests/nonoptional.test.ts +86 -0
- package/src/v4/classic/tests/nullable.test.ts +22 -0
- package/src/v4/classic/tests/number.test.ts +247 -0
- package/src/v4/classic/tests/object.test.ts +563 -0
- package/src/v4/classic/tests/optional.test.ts +123 -0
- package/src/v4/classic/tests/partial.test.ts +147 -0
- package/src/v4/classic/tests/pickomit.test.ts +127 -0
- package/src/v4/classic/tests/pipe.test.ts +81 -0
- package/src/v4/classic/tests/prefault.test.ts +37 -0
- package/src/v4/classic/tests/preprocess.test.ts +298 -0
- package/src/v4/classic/tests/primitive.test.ts +175 -0
- package/src/v4/classic/tests/promise.test.ts +81 -0
- package/src/v4/classic/tests/prototypes.test.ts +23 -0
- package/src/v4/classic/tests/readonly.test.ts +252 -0
- package/src/v4/classic/tests/record.test.ts +342 -0
- package/src/v4/classic/tests/recursive-types.test.ts +356 -0
- package/src/v4/classic/tests/refine.test.ts +532 -0
- package/src/v4/classic/tests/registries.test.ts +204 -0
- package/src/v4/classic/tests/set.test.ts +179 -0
- package/src/v4/classic/tests/standard-schema.test.ts +57 -0
- package/src/v4/classic/tests/string-formats.test.ts +109 -0
- package/src/v4/classic/tests/string.test.ts +881 -0
- package/src/v4/classic/tests/stringbool.test.ts +66 -0
- package/src/v4/classic/tests/template-literal.test.ts +758 -0
- package/src/v4/classic/tests/to-json-schema.test.ts +2314 -0
- package/src/v4/classic/tests/transform.test.ts +250 -0
- package/src/v4/classic/tests/tuple.test.ts +163 -0
- package/src/v4/classic/tests/union.test.ts +94 -0
- package/src/v4/classic/tests/validations.test.ts +283 -0
- package/src/v4/classic/tests/void.test.ts +12 -0
- package/src/v4/core/api.ts +1594 -0
- package/src/v4/core/checks.ts +1283 -0
- package/src/v4/core/config.ts +15 -0
- package/src/v4/core/core.ts +134 -0
- package/src/v4/core/doc.ts +44 -0
- package/src/v4/core/errors.ts +426 -0
- package/src/v4/core/function.ts +176 -0
- package/src/v4/core/index.ts +15 -0
- package/src/v4/core/json-schema.ts +143 -0
- package/src/v4/core/parse.ts +94 -0
- package/src/v4/core/regexes.ts +135 -0
- package/src/v4/core/registries.ts +96 -0
- package/src/v4/core/schemas.ts +3842 -0
- package/src/v4/core/standard-schema.ts +64 -0
- package/src/v4/core/tests/index.test.ts +46 -0
- package/src/v4/core/tests/locales/be.test.ts +124 -0
- package/src/v4/core/tests/locales/en.test.ts +22 -0
- package/src/v4/core/tests/locales/ru.test.ts +128 -0
- package/src/v4/core/tests/locales/tr.test.ts +69 -0
- package/src/v4/core/to-json-schema.ts +977 -0
- package/src/v4/core/util.ts +775 -0
- package/src/v4/core/versions.ts +5 -0
- package/src/v4/core/zsf.ts +323 -0
- package/src/v4/index.ts +4 -0
- package/src/v4/locales/ar.ts +125 -0
- package/src/v4/locales/az.ts +121 -0
- package/src/v4/locales/be.ts +184 -0
- package/src/v4/locales/ca.ts +127 -0
- package/src/v4/locales/cs.ts +142 -0
- package/src/v4/locales/de.ts +124 -0
- package/src/v4/locales/en.ts +127 -0
- package/src/v4/locales/eo.ts +125 -0
- package/src/v4/locales/es.ts +125 -0
- package/src/v4/locales/fa.ts +134 -0
- package/src/v4/locales/fi.ts +131 -0
- package/src/v4/locales/fr-CA.ts +126 -0
- package/src/v4/locales/fr.ts +124 -0
- package/src/v4/locales/he.ts +125 -0
- package/src/v4/locales/hu.ts +126 -0
- package/src/v4/locales/id.ts +125 -0
- package/src/v4/locales/index.ts +39 -0
- package/src/v4/locales/it.ts +125 -0
- package/src/v4/locales/ja.ts +122 -0
- package/src/v4/locales/kh.ts +126 -0
- package/src/v4/locales/ko.ts +131 -0
- package/src/v4/locales/mk.ts +127 -0
- package/src/v4/locales/ms.ts +124 -0
- package/src/v4/locales/nl.ts +126 -0
- package/src/v4/locales/no.ts +124 -0
- package/src/v4/locales/ota.ts +125 -0
- package/src/v4/locales/pl.ts +126 -0
- package/src/v4/locales/ps.ts +133 -0
- package/src/v4/locales/pt.ts +123 -0
- package/src/v4/locales/ru.ts +184 -0
- package/src/v4/locales/sl.ts +126 -0
- package/src/v4/locales/sv.ts +127 -0
- package/src/v4/locales/ta.ts +125 -0
- package/src/v4/locales/th.ts +126 -0
- package/src/v4/locales/tr.ts +121 -0
- package/src/v4/locales/ua.ts +126 -0
- package/src/v4/locales/ur.ts +126 -0
- package/src/v4/locales/vi.ts +125 -0
- package/src/v4/locales/zh-CN.ts +123 -0
- package/src/v4/locales/zh-TW.ts +125 -0
- package/src/v4/mini/checks.ts +32 -0
- package/src/v4/mini/coerce.ts +22 -0
- package/src/v4/mini/external.ts +40 -0
- package/src/v4/mini/index.ts +3 -0
- package/src/v4/mini/iso.ts +62 -0
- package/src/v4/mini/parse.ts +1 -0
- package/src/v4/mini/schemas.ts +1579 -0
- package/src/v4/mini/tests/assignability.test.ts +129 -0
- package/src/v4/mini/tests/brand.test.ts +51 -0
- package/src/v4/mini/tests/checks.test.ts +144 -0
- package/src/v4/mini/tests/computed.test.ts +36 -0
- package/src/v4/mini/tests/error.test.ts +22 -0
- package/src/v4/mini/tests/functions.test.ts +43 -0
- package/src/v4/mini/tests/index.test.ts +871 -0
- package/src/v4/mini/tests/number.test.ts +95 -0
- package/src/v4/mini/tests/object.test.ts +185 -0
- package/src/v4/mini/tests/prototypes.test.ts +43 -0
- package/src/v4/mini/tests/recursive-types.test.ts +275 -0
- package/src/v4/mini/tests/string.test.ts +299 -0
- package/src/v4-mini/index.ts +1 -0
- package/v3/ZodError.cjs +138 -0
- package/v3/ZodError.d.cts +164 -0
- package/v3/ZodError.d.ts +164 -0
- package/v3/ZodError.js +133 -0
- package/v3/errors.cjs +17 -0
- package/v3/errors.d.cts +5 -0
- package/v3/errors.d.ts +5 -0
- package/v3/errors.js +9 -0
- package/v3/external.cjs +22 -0
- package/v3/external.d.cts +6 -0
- package/v3/external.d.ts +6 -0
- package/v3/external.js +6 -0
- package/v3/helpers/enumUtil.cjs +2 -0
- package/v3/helpers/enumUtil.d.cts +8 -0
- package/v3/helpers/enumUtil.d.ts +8 -0
- package/v3/helpers/enumUtil.js +1 -0
- package/v3/helpers/errorUtil.cjs +9 -0
- package/v3/helpers/errorUtil.d.cts +9 -0
- package/v3/helpers/errorUtil.d.ts +9 -0
- package/v3/helpers/errorUtil.js +6 -0
- package/v3/helpers/parseUtil.cjs +124 -0
- package/v3/helpers/parseUtil.d.cts +78 -0
- package/v3/helpers/parseUtil.d.ts +78 -0
- package/v3/helpers/parseUtil.js +109 -0
- package/v3/helpers/partialUtil.cjs +2 -0
- package/v3/helpers/partialUtil.d.cts +8 -0
- package/v3/helpers/partialUtil.d.ts +8 -0
- package/v3/helpers/partialUtil.js +1 -0
- package/v3/helpers/typeAliases.cjs +2 -0
- package/v3/helpers/typeAliases.d.cts +2 -0
- package/v3/helpers/typeAliases.d.ts +2 -0
- package/v3/helpers/typeAliases.js +1 -0
- package/v3/helpers/util.cjs +137 -0
- package/v3/helpers/util.d.cts +85 -0
- package/v3/helpers/util.d.ts +85 -0
- package/v3/helpers/util.js +133 -0
- package/{dist/commonjs/index.js → v3/index.cjs} +2 -2
- package/v3/index.d.cts +4 -0
- package/v3/index.js +4 -0
- package/v3/locales/en.cjs +111 -0
- package/v3/locales/en.d.cts +3 -0
- package/v3/locales/en.d.ts +3 -0
- package/v3/locales/en.js +109 -0
- package/v3/standard-schema.cjs +2 -0
- package/v3/standard-schema.d.cts +102 -0
- package/v3/standard-schema.d.ts +102 -0
- package/v3/standard-schema.js +1 -0
- package/v3/types.cjs +3775 -0
- package/v3/types.d.cts +1031 -0
- package/v3/types.d.ts +1031 -0
- package/v3/types.js +3693 -0
- package/{dist/commonjs/checks.js → v4/classic/checks.cjs} +29 -29
- package/{dist/esm/checks.d.ts → v4/classic/checks.d.cts} +1 -1
- package/{dist/commonjs → v4/classic}/checks.d.ts +1 -1
- package/{dist/esm → v4/classic}/checks.js +1 -1
- package/{dist/commonjs/coerce.js → v4/classic/coerce.cjs} +2 -2
- package/v4/classic/coerce.d.cts +17 -0
- package/v4/classic/coerce.d.ts +17 -0
- package/{dist/esm → v4/classic}/coerce.js +1 -1
- package/{dist/commonjs/compat.js → v4/classic/compat.cjs} +5 -11
- package/{dist/esm/compat.d.ts → v4/classic/compat.d.cts} +4 -6
- package/{dist/commonjs → v4/classic}/compat.d.ts +3 -5
- package/{dist/esm → v4/classic}/compat.js +2 -8
- package/v4/classic/errors.cjs +67 -0
- package/{dist/commonjs/errors.d.ts → v4/classic/errors.d.cts} +8 -7
- package/{dist/esm → v4/classic}/errors.d.ts +8 -7
- package/v4/classic/errors.js +41 -0
- package/v4/classic/external.cjs +70 -0
- package/v4/classic/external.d.cts +13 -0
- package/v4/classic/external.d.ts +13 -0
- package/v4/classic/external.js +18 -0
- package/v4/classic/index.cjs +33 -0
- package/v4/classic/index.d.cts +4 -0
- package/{dist/commonjs/iso.js → v4/classic/iso.cjs} +2 -2
- package/{dist/esm/iso.d.ts → v4/classic/iso.d.cts} +2 -2
- package/{dist/commonjs → v4/classic}/iso.d.ts +1 -1
- package/{dist/esm → v4/classic}/iso.js +1 -1
- package/{dist/commonjs/parse.js → v4/classic/parse.cjs} +7 -9
- package/{dist/commonjs/parse.d.ts → v4/classic/parse.d.cts} +10 -4
- package/{dist/esm → v4/classic}/parse.d.ts +10 -4
- package/v4/classic/parse.js +6 -0
- package/{dist/commonjs/schemas.js → v4/classic/schemas.cjs} +167 -138
- package/{dist/esm/schemas.d.ts → v4/classic/schemas.d.cts} +176 -196
- package/{dist/commonjs → v4/classic}/schemas.d.ts +175 -195
- package/{dist/esm → v4/classic}/schemas.js +128 -102
- package/v4/core/api.cjs +1039 -0
- package/v4/core/api.d.cts +284 -0
- package/v4/core/api.d.ts +284 -0
- package/v4/core/api.js +906 -0
- package/v4/core/checks.cjs +591 -0
- package/v4/core/checks.d.cts +278 -0
- package/v4/core/checks.d.ts +278 -0
- package/v4/core/checks.js +565 -0
- package/v4/core/core.cjs +67 -0
- package/v4/core/core.d.cts +49 -0
- package/v4/core/core.d.ts +49 -0
- package/v4/core/core.js +61 -0
- package/v4/core/doc.cjs +39 -0
- package/v4/core/doc.d.cts +14 -0
- package/v4/core/doc.d.ts +14 -0
- package/v4/core/doc.js +35 -0
- package/v4/core/errors.cjs +226 -0
- package/v4/core/errors.d.cts +210 -0
- package/v4/core/errors.d.ts +210 -0
- package/v4/core/errors.js +195 -0
- package/v4/core/function.cjs +102 -0
- package/v4/core/function.d.cts +52 -0
- package/v4/core/function.d.ts +52 -0
- package/v4/core/function.js +75 -0
- package/v4/core/index.cjs +44 -0
- package/v4/core/index.d.cts +15 -0
- package/v4/core/index.d.ts +15 -0
- package/v4/core/index.js +15 -0
- package/v4/core/json-schema.cjs +2 -0
- package/v4/core/json-schema.d.cts +87 -0
- package/v4/core/json-schema.d.ts +87 -0
- package/v4/core/json-schema.js +1 -0
- package/v4/core/parse.cjs +87 -0
- package/v4/core/parse.d.cts +25 -0
- package/v4/core/parse.d.ts +25 -0
- package/v4/core/parse.js +57 -0
- package/v4/core/regexes.cjs +103 -0
- package/v4/core/regexes.d.cts +61 -0
- package/v4/core/regexes.d.ts +61 -0
- package/v4/core/regexes.js +95 -0
- package/v4/core/registries.cjs +56 -0
- package/v4/core/registries.d.cts +35 -0
- package/v4/core/registries.d.ts +35 -0
- package/v4/core/registries.js +51 -0
- package/v4/core/schemas.cjs +1748 -0
- package/v4/core/schemas.d.cts +1041 -0
- package/v4/core/schemas.d.ts +1041 -0
- package/v4/core/schemas.js +1717 -0
- package/v4/core/standard-schema.cjs +2 -0
- package/v4/core/standard-schema.d.cts +55 -0
- package/v4/core/standard-schema.d.ts +55 -0
- package/v4/core/standard-schema.js +1 -0
- package/v4/core/to-json-schema.cjs +854 -0
- package/v4/core/to-json-schema.d.cts +88 -0
- package/v4/core/to-json-schema.d.ts +88 -0
- package/v4/core/to-json-schema.js +849 -0
- package/v4/core/util.cjs +539 -0
- package/v4/core/util.d.cts +183 -0
- package/v4/core/util.d.ts +183 -0
- package/v4/core/util.js +493 -0
- package/v4/core/versions.cjs +8 -0
- package/v4/core/versions.d.cts +5 -0
- package/v4/core/versions.d.ts +5 -0
- package/v4/core/versions.js +5 -0
- package/v4/index.cjs +22 -0
- package/v4/index.d.cts +3 -0
- package/v4/index.d.ts +3 -0
- package/v4/index.js +3 -0
- package/v4/locales/ar.cjs +142 -0
- package/v4/locales/ar.d.cts +4 -0
- package/v4/locales/ar.d.ts +4 -0
- package/v4/locales/ar.js +116 -0
- package/v4/locales/az.cjs +141 -0
- package/v4/locales/az.d.cts +4 -0
- package/v4/locales/az.d.ts +4 -0
- package/v4/locales/az.js +115 -0
- package/v4/locales/be.cjs +190 -0
- package/v4/locales/be.d.cts +4 -0
- package/v4/locales/be.d.ts +4 -0
- package/v4/locales/be.js +164 -0
- package/v4/locales/ca.cjs +144 -0
- package/v4/locales/ca.d.cts +4 -0
- package/v4/locales/ca.d.ts +4 -0
- package/v4/locales/ca.js +118 -0
- package/v4/locales/cs.cjs +161 -0
- package/v4/locales/cs.d.cts +4 -0
- package/v4/locales/cs.d.ts +4 -0
- package/v4/locales/cs.js +135 -0
- package/v4/locales/de.cjs +142 -0
- package/v4/locales/de.d.cts +4 -0
- package/v4/locales/de.d.ts +4 -0
- package/v4/locales/de.js +116 -0
- package/v4/locales/en.cjs +145 -0
- package/v4/locales/en.d.cts +5 -0
- package/v4/locales/en.d.ts +5 -0
- package/v4/locales/en.js +117 -0
- package/v4/locales/eo.cjs +144 -0
- package/v4/locales/eo.d.cts +5 -0
- package/v4/locales/eo.d.ts +5 -0
- package/v4/locales/eo.js +116 -0
- package/v4/locales/es.cjs +143 -0
- package/v4/locales/es.d.cts +4 -0
- package/v4/locales/es.d.ts +4 -0
- package/v4/locales/es.js +117 -0
- package/v4/locales/fa.cjs +148 -0
- package/v4/locales/fa.d.cts +4 -0
- package/v4/locales/fa.d.ts +4 -0
- package/v4/locales/fa.js +122 -0
- package/v4/locales/fi.cjs +148 -0
- package/v4/locales/fi.d.cts +4 -0
- package/v4/locales/fi.d.ts +4 -0
- package/v4/locales/fi.js +122 -0
- package/v4/locales/fr-CA.cjs +143 -0
- package/v4/locales/fr-CA.d.cts +4 -0
- package/v4/locales/fr-CA.d.ts +4 -0
- package/v4/locales/fr-CA.js +117 -0
- package/v4/locales/fr.cjs +142 -0
- package/v4/locales/fr.d.cts +4 -0
- package/v4/locales/fr.d.ts +4 -0
- package/v4/locales/fr.js +116 -0
- package/v4/locales/he.cjs +143 -0
- package/v4/locales/he.d.cts +4 -0
- package/v4/locales/he.d.ts +4 -0
- package/v4/locales/he.js +117 -0
- package/v4/locales/hu.cjs +143 -0
- package/v4/locales/hu.d.cts +4 -0
- package/v4/locales/hu.d.ts +4 -0
- package/v4/locales/hu.js +117 -0
- package/v4/locales/id.cjs +142 -0
- package/v4/locales/id.d.cts +4 -0
- package/v4/locales/id.d.ts +4 -0
- package/v4/locales/id.js +116 -0
- package/v4/locales/index.cjs +84 -0
- package/v4/locales/index.d.cts +39 -0
- package/v4/locales/index.d.ts +39 -0
- package/v4/locales/index.js +39 -0
- package/v4/locales/it.cjs +143 -0
- package/v4/locales/it.d.cts +4 -0
- package/v4/locales/it.d.ts +4 -0
- package/v4/locales/it.js +117 -0
- package/v4/locales/ja.cjs +141 -0
- package/v4/locales/ja.d.cts +4 -0
- package/v4/locales/ja.d.ts +4 -0
- package/v4/locales/ja.js +115 -0
- package/v4/locales/kh.cjs +143 -0
- package/v4/locales/kh.d.cts +4 -0
- package/v4/locales/kh.d.ts +4 -0
- package/v4/locales/kh.js +117 -0
- package/v4/locales/ko.cjs +147 -0
- package/v4/locales/ko.d.cts +4 -0
- package/v4/locales/ko.d.ts +4 -0
- package/v4/locales/ko.js +121 -0
- package/v4/locales/mk.cjs +144 -0
- package/v4/locales/mk.d.cts +4 -0
- package/v4/locales/mk.d.ts +4 -0
- package/v4/locales/mk.js +118 -0
- package/v4/locales/ms.cjs +142 -0
- package/v4/locales/ms.d.cts +4 -0
- package/v4/locales/ms.d.ts +4 -0
- package/v4/locales/ms.js +116 -0
- package/v4/locales/nl.cjs +143 -0
- package/v4/locales/nl.d.cts +4 -0
- package/v4/locales/nl.d.ts +4 -0
- package/v4/locales/nl.js +117 -0
- package/v4/locales/no.cjs +142 -0
- package/v4/locales/no.d.cts +4 -0
- package/v4/locales/no.d.ts +4 -0
- package/v4/locales/no.js +116 -0
- package/v4/locales/ota.cjs +143 -0
- package/v4/locales/ota.d.cts +4 -0
- package/v4/locales/ota.d.ts +4 -0
- package/v4/locales/ota.js +117 -0
- package/v4/locales/pl.cjs +143 -0
- package/v4/locales/pl.d.cts +4 -0
- package/v4/locales/pl.d.ts +4 -0
- package/v4/locales/pl.js +117 -0
- package/v4/locales/ps.cjs +148 -0
- package/v4/locales/ps.d.cts +4 -0
- package/v4/locales/ps.d.ts +4 -0
- package/v4/locales/ps.js +122 -0
- package/v4/locales/pt.cjs +142 -0
- package/v4/locales/pt.d.cts +4 -0
- package/v4/locales/pt.d.ts +4 -0
- package/v4/locales/pt.js +116 -0
- package/v4/locales/ru.cjs +190 -0
- package/v4/locales/ru.d.cts +4 -0
- package/v4/locales/ru.d.ts +4 -0
- package/v4/locales/ru.js +164 -0
- package/v4/locales/sl.cjs +143 -0
- package/v4/locales/sl.d.cts +4 -0
- package/v4/locales/sl.d.ts +4 -0
- package/v4/locales/sl.js +117 -0
- package/v4/locales/sv.cjs +144 -0
- package/v4/locales/sv.d.cts +4 -0
- package/v4/locales/sv.d.ts +4 -0
- package/v4/locales/sv.js +118 -0
- package/v4/locales/ta.cjs +143 -0
- package/v4/locales/ta.d.cts +4 -0
- package/v4/locales/ta.d.ts +4 -0
- package/v4/locales/ta.js +117 -0
- package/v4/locales/th.cjs +143 -0
- package/v4/locales/th.d.cts +4 -0
- package/v4/locales/th.d.ts +4 -0
- package/v4/locales/th.js +117 -0
- package/v4/locales/tr.cjs +143 -0
- package/v4/locales/tr.d.cts +5 -0
- package/v4/locales/tr.d.ts +5 -0
- package/v4/locales/tr.js +115 -0
- package/v4/locales/ua.cjs +143 -0
- package/v4/locales/ua.d.cts +4 -0
- package/v4/locales/ua.d.ts +4 -0
- package/v4/locales/ua.js +117 -0
- package/v4/locales/ur.cjs +143 -0
- package/v4/locales/ur.d.cts +4 -0
- package/v4/locales/ur.d.ts +4 -0
- package/v4/locales/ur.js +117 -0
- package/v4/locales/vi.cjs +142 -0
- package/v4/locales/vi.d.cts +4 -0
- package/v4/locales/vi.d.ts +4 -0
- package/v4/locales/vi.js +116 -0
- package/v4/locales/zh-CN.cjs +142 -0
- package/v4/locales/zh-CN.d.cts +4 -0
- package/v4/locales/zh-CN.d.ts +4 -0
- package/v4/locales/zh-CN.js +116 -0
- package/v4/locales/zh-TW.cjs +143 -0
- package/v4/locales/zh-TW.d.cts +4 -0
- package/v4/locales/zh-TW.d.ts +4 -0
- package/v4/locales/zh-TW.js +117 -0
- package/v4/mini/checks.cjs +34 -0
- package/v4/mini/checks.d.cts +1 -0
- package/v4/mini/checks.d.ts +1 -0
- package/v4/mini/checks.js +1 -0
- package/{dist/commonjs/errors.js → v4/mini/coerce.cjs} +21 -25
- package/v4/mini/coerce.d.cts +7 -0
- package/v4/mini/coerce.d.ts +7 -0
- package/v4/mini/coerce.js +17 -0
- package/v4/mini/external.cjs +62 -0
- package/v4/mini/external.d.cts +11 -0
- package/v4/mini/external.d.ts +11 -0
- package/v4/mini/external.js +13 -0
- package/v4/mini/index.cjs +32 -0
- package/v4/mini/index.d.cts +3 -0
- package/v4/mini/index.d.ts +3 -0
- package/v4/mini/index.js +3 -0
- package/v4/mini/iso.cjs +60 -0
- package/v4/mini/iso.d.cts +22 -0
- package/v4/mini/iso.d.ts +22 -0
- package/v4/mini/iso.js +30 -0
- package/v4/mini/parse.cjs +8 -0
- package/v4/mini/parse.d.cts +1 -0
- package/v4/mini/parse.d.ts +1 -0
- package/v4/mini/parse.js +1 -0
- package/v4/mini/schemas.cjs +839 -0
- package/v4/mini/schemas.d.cts +356 -0
- package/v4/mini/schemas.d.ts +356 -0
- package/v4/mini/schemas.js +732 -0
- package/v4-mini/index.cjs +17 -0
- package/v4-mini/index.d.cts +1 -0
- package/v4-mini/index.d.ts +1 -0
- package/v4-mini/index.js +1 -0
- package/dist/commonjs/coerce.d.ts +0 -17
- package/dist/commonjs/external.d.ts +0 -8
- package/dist/commonjs/external.js +0 -58
- package/dist/commonjs/package.json +0 -3
- package/dist/esm/coerce.d.ts +0 -17
- package/dist/esm/errors.js +0 -24
- package/dist/esm/external.d.ts +0 -8
- package/dist/esm/external.js +0 -14
- package/dist/esm/package.json +0 -3
- package/dist/esm/parse.js +0 -8
- package/src/coerce.ts +0 -27
- package/src/errors.ts +0 -50
- package/src/external.ts +0 -30
- package/{dist/esm → v3}/index.d.ts +1 -1
- /package/{dist/commonjs → v4/classic}/index.d.ts +0 -0
- /package/{dist/esm → v4/classic}/index.js +0 -0
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import * as core from "
|
|
2
|
-
import { util } from "
|
|
3
|
-
import * as parse from "./parse.
|
|
4
|
-
export * as iso from "./iso.js";
|
|
5
|
-
export * as coerce from "./coerce.js";
|
|
1
|
+
import * as core from "../core/index.cjs";
|
|
2
|
+
import { util } from "../core/index.cjs";
|
|
3
|
+
import * as parse from "./parse.cjs";
|
|
6
4
|
export interface RefinementCtx<T = unknown> extends core.ParsePayload<T> {
|
|
7
5
|
addIssue(arg: string | core.$ZodRawIssue | Partial<core.$ZodIssueCustom>): void;
|
|
8
6
|
}
|
|
9
|
-
export interface ZodType<out Output = unknown, out Input = unknown> extends core.$ZodType<Output, Input> {
|
|
10
|
-
def:
|
|
7
|
+
export interface ZodType<out Output = unknown, out Input = unknown, out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>> extends core.$ZodType<Output, Input, Internals> {
|
|
8
|
+
def: Internals["def"];
|
|
9
|
+
type: Internals["def"]["type"];
|
|
11
10
|
/** @deprecated Use `.def` instead. */
|
|
12
|
-
_def:
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
_def: Internals["def"];
|
|
12
|
+
/** @deprecated Use `z.output<typeof schema>` instead. */
|
|
13
|
+
_output: Internals["output"];
|
|
14
|
+
/** @deprecated Use `z.input<typeof schema>` instead. */
|
|
15
|
+
_input: Internals["input"];
|
|
15
16
|
check(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;
|
|
16
|
-
clone(def?:
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
clone(def?: Internals["def"], params?: {
|
|
18
|
+
parent: boolean;
|
|
19
|
+
}): this;
|
|
20
|
+
register<R extends core.$ZodRegistry>(registry: R, ...meta: this extends R["_schema"] ? undefined extends R["_meta"] ? [core.$replace<R["_meta"], this>?] : [core.$replace<R["_meta"], this>] : ["Incompatible schema"]): this;
|
|
21
|
+
brand<T extends PropertyKey = PropertyKey>(value?: T): PropertyKey extends T ? this : core.$ZodBranded<this, T>;
|
|
19
22
|
parse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): core.output<this>;
|
|
20
23
|
safeParse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): parse.ZodSafeParseResult<core.output<this>>;
|
|
21
24
|
parseAsync(data: unknown, params?: core.ParseContext<core.$ZodIssue>): Promise<core.output<this>>;
|
|
@@ -23,21 +26,23 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
|
|
|
23
26
|
spa: (data: unknown, params?: core.ParseContext<core.$ZodIssue>) => Promise<parse.ZodSafeParseResult<core.output<this>>>;
|
|
24
27
|
refine(check: (arg: core.output<this>) => unknown | Promise<unknown>, params?: string | core.$ZodCustomParams): this;
|
|
25
28
|
/** @deprecated Use `.check()` instead. */
|
|
26
|
-
superRefine(refinement: (arg: core.output<this>, ctx: RefinementCtx<this
|
|
29
|
+
superRefine(refinement: (arg: core.output<this>, ctx: RefinementCtx<core.output<this>>) => void | Promise<void>): this;
|
|
27
30
|
overwrite(fn: (x: core.output<this>) => core.output<this>): this;
|
|
28
|
-
optional(
|
|
31
|
+
optional(): ZodOptional<this>;
|
|
29
32
|
nonoptional(params?: string | core.$ZodNonOptionalParams): ZodNonOptional<this>;
|
|
30
|
-
nullable(
|
|
33
|
+
nullable(): ZodNullable<this>;
|
|
31
34
|
nullish(): ZodOptional<ZodNullable<this>>;
|
|
32
|
-
default(def:
|
|
33
|
-
default(def: () => util.NoUndefined<core.output<this
|
|
35
|
+
default(def: core.output<this>): ZodDefault<this>;
|
|
36
|
+
default(def: () => util.NoUndefined<core.output<this>>): ZodDefault<this>;
|
|
37
|
+
prefault(def: () => core.input<this>): ZodPrefault<this>;
|
|
38
|
+
prefault(def: core.input<this>): ZodPrefault<this>;
|
|
34
39
|
array(): ZodArray<this>;
|
|
35
|
-
or<T extends core
|
|
36
|
-
and<T extends core
|
|
40
|
+
or<T extends core.SomeType>(option: T): ZodUnion<[this, T]>;
|
|
41
|
+
and<T extends core.SomeType>(incoming: T): ZodIntersection<this, T>;
|
|
37
42
|
transform<NewOut>(transform: (arg: core.output<this>, ctx: RefinementCtx<core.output<this>>) => NewOut | Promise<NewOut>): ZodPipe<this, ZodTransform<Awaited<NewOut>, core.output<this>>>;
|
|
38
43
|
catch(def: core.output<this>): ZodCatch<this>;
|
|
39
44
|
catch(def: (ctx: core.$ZodCatchCtx) => core.output<this>): ZodCatch<this>;
|
|
40
|
-
pipe<T extends core.$ZodType<any, this
|
|
45
|
+
pipe<T extends core.$ZodType<any, core.output<this>>>(target: T | core.$ZodType<any, core.output<this>>): ZodPipe<this, T>;
|
|
41
46
|
readonly(): ZodReadonly<this>;
|
|
42
47
|
/** Returns a new instance that has been registered in `z.globalRegistry` with the specified description */
|
|
43
48
|
describe(description: string): this;
|
|
@@ -46,20 +51,33 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
|
|
|
46
51
|
meta(): core.$replace<core.GlobalMeta, this> | undefined;
|
|
47
52
|
/** Returns a new instance that has been registered in `z.globalRegistry` with the specified metadata */
|
|
48
53
|
meta(data: core.$replace<core.GlobalMeta, this>): this;
|
|
54
|
+
/** @deprecated Try safe-parsing `undefined` (this is what `isOptional` does internally):
|
|
55
|
+
*
|
|
56
|
+
* ```ts
|
|
57
|
+
* const schema = z.string().optional();
|
|
58
|
+
* const isOptional = schema.safeParse(undefined).success; // true
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
49
61
|
isOptional(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated Try safe-parsing `null` (this is what `isNullable` does internally):
|
|
64
|
+
*
|
|
65
|
+
* ```ts
|
|
66
|
+
* const schema = z.string().nullable();
|
|
67
|
+
* const isNullable = schema.safeParse(null).success; // true
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
50
70
|
isNullable(): boolean;
|
|
51
71
|
}
|
|
72
|
+
export interface _ZodType<out Internals extends core.$ZodTypeInternals = core.$ZodTypeInternals> extends ZodType<any, any, Internals> {
|
|
73
|
+
}
|
|
52
74
|
export declare const ZodType: core.$constructor<ZodType>;
|
|
53
|
-
export interface _ZodString<
|
|
54
|
-
_zod: core.$ZodStringInternals<Input>;
|
|
75
|
+
export interface _ZodString<T extends core.$ZodStringInternals<unknown> = core.$ZodStringInternals<unknown>> extends _ZodType<T> {
|
|
55
76
|
format: string | null;
|
|
56
77
|
minLength: number | null;
|
|
57
78
|
maxLength: number | null;
|
|
58
79
|
regex(regex: RegExp, params?: string | core.$ZodCheckRegexParams): this;
|
|
59
|
-
includes(value: string, params?:
|
|
60
|
-
message?: string;
|
|
61
|
-
position?: number;
|
|
62
|
-
}): this;
|
|
80
|
+
includes(value: string, params?: core.$ZodCheckIncludesParams): this;
|
|
63
81
|
startsWith(value: string, params?: string | core.$ZodCheckStartsWithParams): this;
|
|
64
82
|
endsWith(value: string, params?: string | core.$ZodCheckEndsWithParams): this;
|
|
65
83
|
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
|
@@ -73,8 +91,9 @@ export interface _ZodString<Input = unknown> extends ZodType {
|
|
|
73
91
|
toLowerCase(): this;
|
|
74
92
|
toUpperCase(): this;
|
|
75
93
|
}
|
|
94
|
+
/** @internal */
|
|
76
95
|
export declare const _ZodString: core.$constructor<_ZodString>;
|
|
77
|
-
export interface ZodString extends _ZodString<string
|
|
96
|
+
export interface ZodString extends _ZodString<core.$ZodStringInternals<string>> {
|
|
78
97
|
/** @deprecated Use `z.email()` instead. */
|
|
79
98
|
email(params?: string | core.$ZodCheckEmailParams): this;
|
|
80
99
|
/** @deprecated Use `z.url()` instead. */
|
|
@@ -132,8 +151,8 @@ export interface ZodString extends _ZodString<string> {
|
|
|
132
151
|
}
|
|
133
152
|
export declare const ZodString: core.$constructor<ZodString>;
|
|
134
153
|
export declare function string(params?: string | core.$ZodStringParams): ZodString;
|
|
135
|
-
export
|
|
136
|
-
|
|
154
|
+
export declare function string<T extends string>(params?: string | core.$ZodStringParams): core.$ZodType<T, T>;
|
|
155
|
+
export interface ZodStringFormat<Format extends string = string> extends _ZodString<core.$ZodStringFormatInternals<Format>> {
|
|
137
156
|
}
|
|
138
157
|
export declare const ZodStringFormat: core.$constructor<ZodStringFormat>;
|
|
139
158
|
export interface ZodEmail extends ZodStringFormat<"email"> {
|
|
@@ -234,8 +253,12 @@ export interface ZodJWT extends ZodStringFormat<"jwt"> {
|
|
|
234
253
|
}
|
|
235
254
|
export declare const ZodJWT: core.$constructor<ZodJWT>;
|
|
236
255
|
export declare function jwt(params?: string | core.$ZodJWTParams): ZodJWT;
|
|
237
|
-
export interface
|
|
238
|
-
_zod: core.$
|
|
256
|
+
export interface ZodCustomStringFormat<Format extends string = string> extends ZodStringFormat<Format>, core.$ZodCustomStringFormat<Format> {
|
|
257
|
+
_zod: core.$ZodCustomStringFormatInternals<Format>;
|
|
258
|
+
}
|
|
259
|
+
export declare const ZodCustomStringFormat: core.$constructor<ZodCustomStringFormat>;
|
|
260
|
+
export declare function stringFormat<Format extends string>(format: Format, fnOrRegex: ((arg: string) => util.MaybeAsync<unknown>) | RegExp, _params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<Format>;
|
|
261
|
+
export interface _ZodNumber<Internals extends core.$ZodNumberInternals = core.$ZodNumberInternals> extends _ZodType<Internals> {
|
|
239
262
|
gt(value: number, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
240
263
|
/** Identical to .min() */
|
|
241
264
|
gte(value: number, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
@@ -256,7 +279,7 @@ export interface _ZodNumber<Input = unknown> extends ZodType {
|
|
|
256
279
|
/** @deprecated Use `.multipleOf()` instead. */
|
|
257
280
|
step(value: number, params?: string | core.$ZodCheckMultipleOfParams): this;
|
|
258
281
|
/** @deprecated In v4 and later, z.number() does not allow infinite values by default. This is a no-op. */
|
|
259
|
-
finite(params?:
|
|
282
|
+
finite(params?: unknown): this;
|
|
260
283
|
minValue: number | null;
|
|
261
284
|
maxValue: number | null;
|
|
262
285
|
/** @deprecated Check the `format` property instead. */
|
|
@@ -265,7 +288,7 @@ export interface _ZodNumber<Input = unknown> extends ZodType {
|
|
|
265
288
|
isFinite: boolean;
|
|
266
289
|
format: string | null;
|
|
267
290
|
}
|
|
268
|
-
export interface ZodNumber extends _ZodNumber<number
|
|
291
|
+
export interface ZodNumber extends _ZodNumber<core.$ZodNumberInternals<number>> {
|
|
269
292
|
}
|
|
270
293
|
export declare const ZodNumber: core.$constructor<ZodNumber>;
|
|
271
294
|
export declare function number(params?: string | core.$ZodNumberParams): ZodNumber;
|
|
@@ -288,15 +311,13 @@ export declare function int32(params?: string | core.$ZodCheckNumberFormatParams
|
|
|
288
311
|
export interface ZodUInt32 extends ZodNumberFormat {
|
|
289
312
|
}
|
|
290
313
|
export declare function uint32(params?: string | core.$ZodCheckNumberFormatParams): ZodUInt32;
|
|
291
|
-
export interface _ZodBoolean<T =
|
|
292
|
-
_zod: core.$ZodBooleanInternals<T>;
|
|
314
|
+
export interface _ZodBoolean<T extends core.$ZodBooleanInternals = core.$ZodBooleanInternals> extends _ZodType<T> {
|
|
293
315
|
}
|
|
294
|
-
export interface ZodBoolean extends _ZodBoolean<boolean
|
|
316
|
+
export interface ZodBoolean extends _ZodBoolean<core.$ZodBooleanInternals<boolean>> {
|
|
295
317
|
}
|
|
296
318
|
export declare const ZodBoolean: core.$constructor<ZodBoolean>;
|
|
297
319
|
export declare function boolean(params?: string | core.$ZodBooleanParams): ZodBoolean;
|
|
298
|
-
export interface _ZodBigInt<T =
|
|
299
|
-
_zod: core.$ZodBigIntInternals<T>;
|
|
320
|
+
export interface _ZodBigInt<T extends core.$ZodBigIntInternals = core.$ZodBigIntInternals> extends _ZodType<T> {
|
|
300
321
|
gte(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
301
322
|
/** Alias of `.gte()` */
|
|
302
323
|
min(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
@@ -314,7 +335,7 @@ export interface _ZodBigInt<T = unknown> extends ZodType {
|
|
|
314
335
|
maxValue: bigint | null;
|
|
315
336
|
format: string | null;
|
|
316
337
|
}
|
|
317
|
-
export interface ZodBigInt extends _ZodBigInt<bigint
|
|
338
|
+
export interface ZodBigInt extends _ZodBigInt<core.$ZodBigIntInternals<bigint>> {
|
|
318
339
|
}
|
|
319
340
|
export declare const ZodBigInt: core.$constructor<ZodBigInt>;
|
|
320
341
|
export declare function bigint(params?: string | core.$ZodBigIntParams): ZodBigInt;
|
|
@@ -324,46 +345,38 @@ export interface ZodBigIntFormat extends ZodBigInt {
|
|
|
324
345
|
export declare const ZodBigIntFormat: core.$constructor<ZodBigIntFormat>;
|
|
325
346
|
export declare function int64(params?: string | core.$ZodBigIntFormatParams): ZodBigIntFormat;
|
|
326
347
|
export declare function uint64(params?: string | core.$ZodBigIntFormatParams): ZodBigIntFormat;
|
|
327
|
-
export interface ZodSymbol extends
|
|
328
|
-
_zod: core.$ZodSymbolInternals;
|
|
348
|
+
export interface ZodSymbol extends _ZodType<core.$ZodSymbolInternals> {
|
|
329
349
|
}
|
|
330
350
|
export declare const ZodSymbol: core.$constructor<ZodSymbol>;
|
|
331
351
|
export declare function symbol(params?: string | core.$ZodSymbolParams): ZodSymbol;
|
|
332
|
-
export interface ZodUndefined extends
|
|
333
|
-
_zod: core.$ZodUndefinedInternals;
|
|
352
|
+
export interface ZodUndefined extends _ZodType<core.$ZodUndefinedInternals> {
|
|
334
353
|
}
|
|
335
354
|
export declare const ZodUndefined: core.$constructor<ZodUndefined>;
|
|
336
355
|
declare function _undefined(params?: string | core.$ZodUndefinedParams): ZodUndefined;
|
|
337
356
|
export { _undefined as undefined };
|
|
338
|
-
export interface ZodNull extends
|
|
339
|
-
_zod: core.$ZodNullInternals;
|
|
357
|
+
export interface ZodNull extends _ZodType<core.$ZodNullInternals> {
|
|
340
358
|
}
|
|
341
359
|
export declare const ZodNull: core.$constructor<ZodNull>;
|
|
342
360
|
declare function _null(params?: string | core.$ZodNullParams): ZodNull;
|
|
343
361
|
export { _null as null };
|
|
344
|
-
export interface ZodAny extends
|
|
345
|
-
_zod: core.$ZodAnyInternals;
|
|
362
|
+
export interface ZodAny extends _ZodType<core.$ZodAnyInternals> {
|
|
346
363
|
}
|
|
347
364
|
export declare const ZodAny: core.$constructor<ZodAny>;
|
|
348
|
-
export declare function any(
|
|
349
|
-
export interface ZodUnknown extends
|
|
350
|
-
_zod: core.$ZodUnknownInternals;
|
|
365
|
+
export declare function any(): ZodAny;
|
|
366
|
+
export interface ZodUnknown extends _ZodType<core.$ZodUnknownInternals> {
|
|
351
367
|
}
|
|
352
368
|
export declare const ZodUnknown: core.$constructor<ZodUnknown>;
|
|
353
|
-
export declare function unknown(
|
|
354
|
-
export interface ZodNever extends
|
|
355
|
-
_zod: core.$ZodNeverInternals;
|
|
369
|
+
export declare function unknown(): ZodUnknown;
|
|
370
|
+
export interface ZodNever extends _ZodType<core.$ZodNeverInternals> {
|
|
356
371
|
}
|
|
357
372
|
export declare const ZodNever: core.$constructor<ZodNever>;
|
|
358
373
|
export declare function never(params?: string | core.$ZodNeverParams): ZodNever;
|
|
359
|
-
export interface ZodVoid extends
|
|
360
|
-
_zod: core.$ZodVoidInternals;
|
|
374
|
+
export interface ZodVoid extends _ZodType<core.$ZodVoidInternals> {
|
|
361
375
|
}
|
|
362
376
|
export declare const ZodVoid: core.$constructor<ZodVoid>;
|
|
363
377
|
declare function _void(params?: string | core.$ZodVoidParams): ZodVoid;
|
|
364
378
|
export { _void as void };
|
|
365
|
-
export interface _ZodDate<T =
|
|
366
|
-
_zod: core.$ZodDateInternals<T>;
|
|
379
|
+
export interface _ZodDate<T extends core.$ZodDateInternals = core.$ZodDateInternals> extends _ZodType<T> {
|
|
367
380
|
min(value: number | Date, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
368
381
|
max(value: number | Date, params?: string | core.$ZodCheckLessThanParams): this;
|
|
369
382
|
/** @deprecated Not recommended. */
|
|
@@ -371,128 +384,105 @@ export interface _ZodDate<T = unknown> extends ZodType {
|
|
|
371
384
|
/** @deprecated Not recommended. */
|
|
372
385
|
maxDate: Date | null;
|
|
373
386
|
}
|
|
374
|
-
export interface ZodDate extends _ZodDate<Date
|
|
387
|
+
export interface ZodDate extends _ZodDate<core.$ZodDateInternals<Date>> {
|
|
375
388
|
}
|
|
376
389
|
export declare const ZodDate: core.$constructor<ZodDate>;
|
|
377
390
|
export declare function date(params?: string | core.$ZodDateParams): ZodDate;
|
|
378
|
-
export interface ZodArray<T extends core
|
|
379
|
-
_zod: core.$ZodArrayInternals<T>;
|
|
391
|
+
export interface ZodArray<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodArrayInternals<T>>, core.$ZodArray<T> {
|
|
380
392
|
element: T;
|
|
381
393
|
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
|
382
394
|
nonempty(params?: string | core.$ZodCheckMinLengthParams): this;
|
|
383
395
|
max(maxLength: number, params?: string | core.$ZodCheckMaxLengthParams): this;
|
|
384
396
|
length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;
|
|
397
|
+
unwrap(): T;
|
|
385
398
|
}
|
|
386
399
|
export declare const ZodArray: core.$constructor<ZodArray>;
|
|
387
|
-
export declare function array<T extends core
|
|
388
|
-
export declare function keyof<T extends ZodObject>(schema: T): ZodLiteral<keyof T["_zod"]["output"]
|
|
389
|
-
export interface ZodObject<
|
|
390
|
-
|
|
400
|
+
export declare function array<T extends core.SomeType>(element: T, params?: string | core.$ZodArrayParams): ZodArray<T>;
|
|
401
|
+
export declare function keyof<T extends ZodObject>(schema: T): ZodLiteral<Exclude<keyof T["_zod"]["output"], symbol>>;
|
|
402
|
+
export interface ZodObject<
|
|
403
|
+
/** @ts-ignore Cast variance */
|
|
404
|
+
out Shape extends core.$ZodShape = core.$ZodLooseShape, out Config extends core.$ZodObjectConfig = core.$strip> extends _ZodType<core.$ZodObjectInternals<Shape, Config>>, core.$ZodObject<Shape, Config> {
|
|
391
405
|
shape: Shape;
|
|
392
406
|
keyof(): ZodEnum<util.ToEnum<keyof Shape & string>>;
|
|
393
407
|
/** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
|
|
394
|
-
catchall<T extends core
|
|
408
|
+
catchall<T extends core.SomeType>(schema: T): ZodObject<Shape, core.$catchall<T>>;
|
|
395
409
|
/** @deprecated Use `z.looseObject()` or `.loose()` instead. */
|
|
396
|
-
passthrough(): ZodObject<Shape,
|
|
410
|
+
passthrough(): ZodObject<Shape, core.$loose>;
|
|
397
411
|
/** Consider `z.looseObject(A.shape)` instead */
|
|
398
|
-
loose(): ZodObject<Shape,
|
|
412
|
+
loose(): ZodObject<Shape, core.$loose>;
|
|
399
413
|
/** Consider `z.strictObject(A.shape)` instead */
|
|
400
|
-
strict(): ZodObject<Shape,
|
|
414
|
+
strict(): ZodObject<Shape, core.$strict>;
|
|
401
415
|
/** This is the default behavior. This method call is likely unnecessary. */
|
|
402
|
-
strip(): ZodObject<Shape,
|
|
403
|
-
extend<U extends core.$ZodLooseShape
|
|
416
|
+
strip(): ZodObject<Shape, core.$strip>;
|
|
417
|
+
extend<U extends core.$ZodLooseShape & Partial<Record<keyof Shape, core.SomeType>>>(shape: U): ZodObject<util.Extend<Shape, U>, Config>;
|
|
404
418
|
/**
|
|
405
|
-
* @deprecated Use
|
|
419
|
+
* @deprecated Use spread syntax and the `.shape` property to combine two object schemas:
|
|
406
420
|
*
|
|
407
421
|
* ```ts
|
|
408
|
-
* z.object({
|
|
409
|
-
*
|
|
410
|
-
* ...B.shape
|
|
411
|
-
* });
|
|
412
|
-
* ```
|
|
413
|
-
*/
|
|
414
|
-
merge<U extends ZodObject>(other: U): ZodObject<util.Extend<Shape, U["shape"]>, U["_zod"]["outextra"], U["_zod"]["inextra"]>;
|
|
415
|
-
/**
|
|
416
|
-
* @deprecated Use destructuring to merge the shapes:
|
|
422
|
+
* const A = z.object({ a: z.string() });
|
|
423
|
+
* const B = z.object({ b: z.number() });
|
|
417
424
|
*
|
|
418
|
-
*
|
|
419
|
-
* z.object({
|
|
425
|
+
* const C = z.object({
|
|
420
426
|
* ...A.shape,
|
|
421
427
|
* ...B.shape
|
|
422
428
|
* });
|
|
423
429
|
* ```
|
|
424
430
|
*/
|
|
425
|
-
|
|
426
|
-
|
|
431
|
+
merge<U extends ZodObject>(other: U): ZodObject<util.Extend<Shape, U["shape"]>, U["_zod"]["config"]>;
|
|
432
|
+
pick<M extends util.Mask<keyof Shape>>(mask: M): ZodObject<util.Flatten<Pick<Shape, Extract<keyof Shape, keyof M>>>, Config>;
|
|
433
|
+
omit<M extends util.Mask<keyof Shape>>(mask: M): ZodObject<util.Flatten<Omit<Shape, Extract<keyof Shape, keyof M>>>, Config>;
|
|
427
434
|
partial(): ZodObject<{
|
|
428
435
|
[k in keyof Shape]: ZodOptional<Shape[k]>;
|
|
429
|
-
},
|
|
430
|
-
partial<M extends util.
|
|
436
|
+
}, Config>;
|
|
437
|
+
partial<M extends util.Mask<keyof Shape>>(mask: M): ZodObject<{
|
|
431
438
|
[k in keyof Shape]: k extends keyof M ? ZodOptional<Shape[k]> : Shape[k];
|
|
432
|
-
},
|
|
439
|
+
}, Config>;
|
|
433
440
|
required(): ZodObject<{
|
|
434
441
|
[k in keyof Shape]: ZodNonOptional<Shape[k]>;
|
|
435
|
-
},
|
|
436
|
-
required<M extends util.
|
|
442
|
+
}, Config>;
|
|
443
|
+
required<M extends util.Mask<keyof Shape>>(mask: M): ZodObject<{
|
|
437
444
|
[k in keyof Shape]: k extends keyof M ? ZodNonOptional<Shape[k]> : Shape[k];
|
|
438
|
-
},
|
|
445
|
+
}, Config>;
|
|
439
446
|
}
|
|
440
447
|
export declare const ZodObject: core.$constructor<ZodObject>;
|
|
441
|
-
export declare function object<T extends core.$ZodLooseShape = Record<never, core
|
|
442
|
-
export declare function strictObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T,
|
|
443
|
-
export declare function looseObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T,
|
|
444
|
-
|
|
445
|
-
}, {
|
|
446
|
-
[k: string]: unknown;
|
|
447
|
-
}>;
|
|
448
|
-
export interface ZodUnion<T extends readonly core.$ZodType[] = readonly core.$ZodType[]> extends ZodType {
|
|
449
|
-
_zod: core.$ZodUnionInternals<T>;
|
|
448
|
+
export declare function object<T extends core.$ZodLooseShape = Partial<Record<never, core.SomeType>>>(shape?: T, params?: string | core.$ZodObjectParams): ZodObject<util.Writeable<T>, core.$strip>;
|
|
449
|
+
export declare function strictObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T, core.$strict>;
|
|
450
|
+
export declare function looseObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T, core.$loose>;
|
|
451
|
+
export interface ZodUnion<T extends readonly core.SomeType[] = readonly core.$ZodType[]> extends _ZodType<core.$ZodUnionInternals<T>>, core.$ZodUnion<T> {
|
|
450
452
|
options: T;
|
|
451
453
|
}
|
|
452
454
|
export declare const ZodUnion: core.$constructor<ZodUnion>;
|
|
453
|
-
export declare function union<const T extends readonly core
|
|
454
|
-
export interface ZodDiscriminatedUnion<Options extends readonly core
|
|
455
|
+
export declare function union<const T extends readonly core.SomeType[]>(options: T, params?: string | core.$ZodUnionParams): ZodUnion<T>;
|
|
456
|
+
export interface ZodDiscriminatedUnion<Options extends readonly core.SomeType[] = readonly core.$ZodType[]> extends ZodUnion<Options>, core.$ZodDiscriminatedUnion<Options> {
|
|
455
457
|
_zod: core.$ZodDiscriminatedUnionInternals<Options>;
|
|
456
458
|
}
|
|
457
459
|
export declare const ZodDiscriminatedUnion: core.$constructor<ZodDiscriminatedUnion>;
|
|
458
|
-
export
|
|
459
|
-
|
|
460
|
-
}
|
|
461
|
-
export interface $ZodTypeDiscriminable extends ZodType {
|
|
462
|
-
_zod: $ZodTypeDiscriminableInternals;
|
|
463
|
-
}
|
|
464
|
-
export declare function discriminatedUnion<Types extends [$ZodTypeDiscriminable, ...$ZodTypeDiscriminable[]]>(disc: string, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types>;
|
|
465
|
-
export declare function discriminatedUnion<Types extends [$ZodTypeDiscriminable, ...$ZodTypeDiscriminable[]]>(options: Types, params?: string | core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types>;
|
|
466
|
-
export interface ZodIntersection<A extends core.$ZodType = core.$ZodType, B extends core.$ZodType = core.$ZodType> extends ZodType {
|
|
467
|
-
_zod: core.$ZodIntersectionInternals<A, B>;
|
|
460
|
+
export declare function discriminatedUnion<Types extends readonly [core.$ZodTypeDiscriminable, ...core.$ZodTypeDiscriminable[]]>(discriminator: string, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types>;
|
|
461
|
+
export interface ZodIntersection<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodIntersectionInternals<A, B>>, core.$ZodIntersection<A, B> {
|
|
468
462
|
}
|
|
469
463
|
export declare const ZodIntersection: core.$constructor<ZodIntersection>;
|
|
470
|
-
export declare function intersection<T extends core
|
|
471
|
-
export interface ZodTuple<T extends util.TupleItems =
|
|
472
|
-
|
|
473
|
-
rest<Rest extends core.$ZodType>(rest: Rest): ZodTuple<T, Rest>;
|
|
464
|
+
export declare function intersection<T extends core.SomeType, U extends core.SomeType>(left: T, right: U): ZodIntersection<T, U>;
|
|
465
|
+
export interface ZodTuple<T extends util.TupleItems = readonly core.$ZodType[], Rest extends core.SomeType | null = core.$ZodType | null> extends _ZodType<core.$ZodTupleInternals<T, Rest>>, core.$ZodTuple<T, Rest> {
|
|
466
|
+
rest<Rest extends core.SomeType = core.$ZodType>(rest: Rest): ZodTuple<T, Rest>;
|
|
474
467
|
}
|
|
475
468
|
export declare const ZodTuple: core.$constructor<ZodTuple>;
|
|
476
|
-
export declare function tuple<T extends readonly [core
|
|
477
|
-
export declare function tuple<T extends readonly [core
|
|
469
|
+
export declare function tuple<T extends readonly [core.SomeType, ...core.SomeType[]]>(items: T, params?: string | core.$ZodTupleParams): ZodTuple<T, null>;
|
|
470
|
+
export declare function tuple<T extends readonly [core.SomeType, ...core.SomeType[]], Rest extends core.SomeType>(items: T, rest: Rest, params?: string | core.$ZodTupleParams): ZodTuple<T, Rest>;
|
|
478
471
|
export declare function tuple(items: [], params?: string | core.$ZodTupleParams): ZodTuple<[], null>;
|
|
479
|
-
export interface ZodRecord<Key extends core.$ZodRecordKey = core.$ZodRecordKey, Value extends core
|
|
480
|
-
_zod: core.$ZodRecordInternals<Key, Value>;
|
|
472
|
+
export interface ZodRecord<Key extends core.$ZodRecordKey = core.$ZodRecordKey, Value extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodRecordInternals<Key, Value>>, core.$ZodRecord<Key, Value> {
|
|
481
473
|
keyType: Key;
|
|
482
474
|
valueType: Value;
|
|
483
475
|
}
|
|
484
476
|
export declare const ZodRecord: core.$constructor<ZodRecord>;
|
|
485
|
-
export declare function record<Key extends core.$ZodRecordKey, Value extends core
|
|
486
|
-
export declare function partialRecord<Key extends core.$ZodRecordKey, Value extends core
|
|
487
|
-
export interface ZodMap<Key extends core
|
|
488
|
-
_zod: core.$ZodMapInternals<Key, Value>;
|
|
477
|
+
export declare function record<Key extends core.$ZodRecordKey, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$ZodRecordParams): ZodRecord<Key, Value>;
|
|
478
|
+
export declare function partialRecord<Key extends core.$ZodRecordKey, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$ZodRecordParams): ZodRecord<Key & core.$partial, Value>;
|
|
479
|
+
export interface ZodMap<Key extends core.SomeType = core.$ZodType, Value extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodMapInternals<Key, Value>>, core.$ZodMap<Key, Value> {
|
|
489
480
|
keyType: Key;
|
|
490
481
|
valueType: Value;
|
|
491
482
|
}
|
|
492
483
|
export declare const ZodMap: core.$constructor<ZodMap>;
|
|
493
|
-
export declare function map<Key extends core
|
|
494
|
-
export interface ZodSet<T extends core
|
|
495
|
-
_zod: core.$ZodSetInternals<T>;
|
|
484
|
+
export declare function map<Key extends core.SomeType, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$ZodMapParams): ZodMap<Key, Value>;
|
|
485
|
+
export interface ZodSet<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodSetInternals<T>>, core.$ZodSet<T> {
|
|
496
486
|
min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
|
|
497
487
|
/** */
|
|
498
488
|
nonempty(params?: string | core.$ZodCheckMinSizeParams): this;
|
|
@@ -500,9 +490,10 @@ export interface ZodSet<T extends core.$ZodType = core.$ZodType> extends ZodType
|
|
|
500
490
|
size(size: number, params?: string | core.$ZodCheckSizeEqualsParams): this;
|
|
501
491
|
}
|
|
502
492
|
export declare const ZodSet: core.$constructor<ZodSet>;
|
|
503
|
-
export declare function set<Value extends core
|
|
504
|
-
export interface ZodEnum<
|
|
505
|
-
|
|
493
|
+
export declare function set<Value extends core.SomeType>(valueType: Value, params?: string | core.$ZodSetParams): ZodSet<Value>;
|
|
494
|
+
export interface ZodEnum<
|
|
495
|
+
/** @ts-ignore Cast variance */
|
|
496
|
+
out T extends util.EnumLike = util.EnumLike> extends _ZodType<core.$ZodEnumInternals<T>>, core.$ZodEnum<T> {
|
|
506
497
|
enum: T;
|
|
507
498
|
options: Array<T[keyof T]>;
|
|
508
499
|
extract<const U extends readonly (keyof T)[]>(values: U, params?: string | core.$ZodEnumParams): ZodEnum<util.Flatten<Pick<T, U[number]>>>;
|
|
@@ -520,131 +511,120 @@ export { _enum as enum };
|
|
|
520
511
|
* ```
|
|
521
512
|
*/
|
|
522
513
|
export declare function nativeEnum<T extends util.EnumLike>(entries: T, params?: string | core.$ZodEnumParams): ZodEnum<T>;
|
|
523
|
-
export interface ZodLiteral<T extends util.
|
|
524
|
-
_zod: core.$ZodLiteralInternals<T>;
|
|
514
|
+
export interface ZodLiteral<T extends util.Literal = util.Literal> extends _ZodType<core.$ZodLiteralInternals<T>>, core.$ZodLiteral<T> {
|
|
525
515
|
values: Set<T>;
|
|
516
|
+
/** @legacy Use `.values` instead. Accessing this property will throw an error if the literal accepts multiple values. */
|
|
517
|
+
value: T;
|
|
526
518
|
}
|
|
527
519
|
export declare const ZodLiteral: core.$constructor<ZodLiteral>;
|
|
528
|
-
export declare function literal<const T extends
|
|
520
|
+
export declare function literal<const T extends ReadonlyArray<util.Literal>>(value: T, params?: string | core.$ZodLiteralParams): ZodLiteral<T[number]>;
|
|
529
521
|
export declare function literal<const T extends util.Literal>(value: T, params?: string | core.$ZodLiteralParams): ZodLiteral<T>;
|
|
530
|
-
export interface ZodFile extends
|
|
531
|
-
_zod: core.$ZodFileInternals;
|
|
522
|
+
export interface ZodFile extends _ZodType<core.$ZodFileInternals>, core.$ZodFile {
|
|
532
523
|
min(size: number, params?: string | core.$ZodCheckMinSizeParams): this;
|
|
533
524
|
max(size: number, params?: string | core.$ZodCheckMaxSizeParams): this;
|
|
534
|
-
mime(types: Array<util.MimeTypes>, params?: string | core.$ZodCheckMimeTypeParams): this;
|
|
525
|
+
mime(types: util.MimeTypes | Array<util.MimeTypes>, params?: string | core.$ZodCheckMimeTypeParams): this;
|
|
535
526
|
}
|
|
536
527
|
export declare const ZodFile: core.$constructor<ZodFile>;
|
|
537
528
|
export declare function file(params?: string | core.$ZodFileParams): ZodFile;
|
|
538
|
-
export interface ZodTransform<O = unknown, I = unknown> extends
|
|
539
|
-
_zod: core.$ZodTransformInternals<O, I>;
|
|
529
|
+
export interface ZodTransform<O = unknown, I = unknown> extends _ZodType<core.$ZodTransformInternals<O, I>>, core.$ZodTransform<O, I> {
|
|
540
530
|
}
|
|
541
531
|
export declare const ZodTransform: core.$constructor<ZodTransform>;
|
|
542
|
-
export declare function transform<I = unknown, O = I>(fn: (input: I, ctx: core.ParsePayload) => O
|
|
543
|
-
export interface ZodOptional<T extends core
|
|
544
|
-
_zod: core.$ZodOptionalInternals<T>;
|
|
532
|
+
export declare function transform<I = unknown, O = I>(fn: (input: I, ctx: core.ParsePayload) => O): ZodTransform<Awaited<O>, I>;
|
|
533
|
+
export interface ZodOptional<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodOptionalInternals<T>>, core.$ZodOptional<T> {
|
|
545
534
|
unwrap(): T;
|
|
546
535
|
}
|
|
547
536
|
export declare const ZodOptional: core.$constructor<ZodOptional>;
|
|
548
|
-
export declare function optional<T extends core
|
|
549
|
-
export interface ZodNullable<T extends core
|
|
550
|
-
_zod: core.$ZodNullableInternals<T>;
|
|
537
|
+
export declare function optional<T extends core.SomeType>(innerType: T): ZodOptional<T>;
|
|
538
|
+
export interface ZodNullable<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodNullableInternals<T>>, core.$ZodNullable<T> {
|
|
551
539
|
unwrap(): T;
|
|
552
540
|
}
|
|
553
541
|
export declare const ZodNullable: core.$constructor<ZodNullable>;
|
|
554
|
-
export declare function nullable<T extends core
|
|
555
|
-
export declare function nullish<T extends core
|
|
556
|
-
export interface ZodDefault<T extends core
|
|
557
|
-
_zod: core.$ZodDefaultInternals<T>;
|
|
542
|
+
export declare function nullable<T extends core.SomeType>(innerType: T): ZodNullable<T>;
|
|
543
|
+
export declare function nullish<T extends core.SomeType>(innerType: T): ZodOptional<ZodNullable<T>>;
|
|
544
|
+
export interface ZodDefault<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodDefaultInternals<T>>, core.$ZodDefault<T> {
|
|
558
545
|
unwrap(): T;
|
|
559
546
|
/** @deprecated Use `.unwrap()` instead. */
|
|
560
547
|
removeDefault(): T;
|
|
561
548
|
}
|
|
562
549
|
export declare const ZodDefault: core.$constructor<ZodDefault>;
|
|
563
|
-
export declare function _default<T extends core
|
|
564
|
-
export interface
|
|
565
|
-
|
|
550
|
+
export declare function _default<T extends core.SomeType>(innerType: T, defaultValue: util.NoUndefined<core.output<T>> | (() => util.NoUndefined<core.output<T>>)): ZodDefault<T>;
|
|
551
|
+
export interface ZodPrefault<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodPrefaultInternals<T>>, core.$ZodPrefault<T> {
|
|
552
|
+
unwrap(): T;
|
|
553
|
+
}
|
|
554
|
+
export declare const ZodPrefault: core.$constructor<ZodPrefault>;
|
|
555
|
+
export declare function prefault<T extends core.SomeType>(innerType: T, defaultValue: core.input<T> | (() => core.input<T>)): ZodPrefault<T>;
|
|
556
|
+
export interface ZodNonOptional<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodNonOptionalInternals<T>>, core.$ZodNonOptional<T> {
|
|
566
557
|
unwrap(): T;
|
|
567
558
|
}
|
|
568
559
|
export declare const ZodNonOptional: core.$constructor<ZodNonOptional>;
|
|
569
|
-
export declare function nonoptional<T extends core
|
|
570
|
-
export interface ZodSuccess<T extends core
|
|
571
|
-
_zod: core.$ZodSuccessInternals<T>;
|
|
560
|
+
export declare function nonoptional<T extends core.SomeType>(innerType: T, params?: string | core.$ZodNonOptionalParams): ZodNonOptional<T>;
|
|
561
|
+
export interface ZodSuccess<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodSuccessInternals<T>>, core.$ZodSuccess<T> {
|
|
572
562
|
unwrap(): T;
|
|
573
563
|
}
|
|
574
564
|
export declare const ZodSuccess: core.$constructor<ZodSuccess>;
|
|
575
|
-
export declare function success<T extends core
|
|
576
|
-
export interface ZodCatch<T extends core
|
|
577
|
-
_zod: core.$ZodCatchInternals<T>;
|
|
565
|
+
export declare function success<T extends core.SomeType>(innerType: T): ZodSuccess<T>;
|
|
566
|
+
export interface ZodCatch<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodCatchInternals<T>>, core.$ZodCatch<T> {
|
|
578
567
|
unwrap(): T;
|
|
579
568
|
/** @deprecated Use `.unwrap()` instead. */
|
|
580
569
|
removeCatch(): T;
|
|
581
570
|
}
|
|
582
571
|
export declare const ZodCatch: core.$constructor<ZodCatch>;
|
|
583
|
-
declare function _catch<T extends core
|
|
572
|
+
declare function _catch<T extends core.SomeType>(innerType: T, catchValue: core.output<T> | ((ctx: core.$ZodCatchCtx) => core.output<T>)): ZodCatch<T>;
|
|
584
573
|
export { _catch as catch };
|
|
585
|
-
export interface ZodNaN extends
|
|
586
|
-
_zod: core.$ZodNaNInternals;
|
|
574
|
+
export interface ZodNaN extends _ZodType<core.$ZodNaNInternals>, core.$ZodNaN {
|
|
587
575
|
}
|
|
588
576
|
export declare const ZodNaN: core.$constructor<ZodNaN>;
|
|
589
577
|
export declare function nan(params?: string | core.$ZodNaNParams): ZodNaN;
|
|
590
|
-
export interface ZodPipe<A extends core
|
|
591
|
-
_zod: core.$ZodPipeInternals<A, B>;
|
|
578
|
+
export interface ZodPipe<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodPipeInternals<A, B>>, core.$ZodPipe<A, B> {
|
|
592
579
|
in: A;
|
|
593
580
|
out: B;
|
|
594
581
|
}
|
|
595
582
|
export declare const ZodPipe: core.$constructor<ZodPipe>;
|
|
596
|
-
export declare function pipe<const A extends core
|
|
597
|
-
export interface ZodReadonly<T extends core
|
|
598
|
-
_zod: core.$ZodReadonlyInternals<T>;
|
|
583
|
+
export declare function pipe<const A extends core.SomeType, B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>>(in_: A, out: B | core.$ZodType<unknown, core.output<A>>): ZodPipe<A, B>;
|
|
584
|
+
export interface ZodReadonly<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodReadonlyInternals<T>>, core.$ZodReadonly<T> {
|
|
599
585
|
}
|
|
600
586
|
export declare const ZodReadonly: core.$constructor<ZodReadonly>;
|
|
601
|
-
export declare function readonly<T extends core
|
|
602
|
-
export interface ZodTemplateLiteral<Template extends string = string> extends
|
|
603
|
-
_zod: core.$ZodTemplateLiteralInternals<Template>;
|
|
587
|
+
export declare function readonly<T extends core.SomeType>(innerType: T): ZodReadonly<T>;
|
|
588
|
+
export interface ZodTemplateLiteral<Template extends string = string> extends _ZodType<core.$ZodTemplateLiteralInternals<Template>>, core.$ZodTemplateLiteral<Template> {
|
|
604
589
|
}
|
|
605
590
|
export declare const ZodTemplateLiteral: core.$constructor<ZodTemplateLiteral>;
|
|
606
|
-
export declare function templateLiteral<const Parts extends core.$
|
|
607
|
-
export interface ZodLazy<T extends core
|
|
608
|
-
_zod: core.$ZodLazyInternals<T>;
|
|
591
|
+
export declare function templateLiteral<const Parts extends core.$ZodTemplateLiteralPart[]>(parts: Parts, params?: string | core.$ZodTemplateLiteralParams): ZodTemplateLiteral<core.$PartsToTemplateLiteral<Parts>>;
|
|
592
|
+
export interface ZodLazy<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodLazyInternals<T>>, core.$ZodLazy<T> {
|
|
609
593
|
unwrap(): T;
|
|
610
594
|
}
|
|
611
595
|
export declare const ZodLazy: core.$constructor<ZodLazy>;
|
|
612
|
-
export declare function lazy<T extends core
|
|
613
|
-
export interface ZodPromise<T extends core
|
|
614
|
-
_zod: core.$ZodPromiseInternals<T>;
|
|
596
|
+
export declare function lazy<T extends core.SomeType>(getter: () => T): ZodLazy<T>;
|
|
597
|
+
export interface ZodPromise<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodPromiseInternals<T>>, core.$ZodPromise<T> {
|
|
615
598
|
unwrap(): T;
|
|
616
599
|
}
|
|
617
600
|
export declare const ZodPromise: core.$constructor<ZodPromise>;
|
|
618
|
-
export declare function promise<T extends core
|
|
619
|
-
export interface ZodCustom<O = unknown, I = unknown> extends
|
|
620
|
-
_zod: core.$ZodCustomInternals<O, I>;
|
|
601
|
+
export declare function promise<T extends core.SomeType>(innerType: T): ZodPromise<T>;
|
|
602
|
+
export interface ZodCustom<O = unknown, I = unknown> extends _ZodType<core.$ZodCustomInternals<O, I>>, core.$ZodCustom<O, I> {
|
|
621
603
|
}
|
|
622
604
|
export declare const ZodCustom: core.$constructor<ZodCustom>;
|
|
623
|
-
export declare function check<O = unknown>(fn: core.CheckFn<O
|
|
624
|
-
export declare function custom<O
|
|
605
|
+
export declare function check<O = unknown>(fn: core.CheckFn<O>): core.$ZodCheck<O>;
|
|
606
|
+
export declare function custom<O>(fn?: (data: unknown) => unknown, _params?: string | core.$ZodCustomParams | undefined): ZodCustom<O, O>;
|
|
625
607
|
export declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
|
|
626
|
-
export declare function superRefine<T>(fn: (arg: T, payload: RefinementCtx<T>) => void | Promise<void
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
}
|
|
630
|
-
type ZodInstanceOfParams = util.Params<ZodCustom, core.$ZodIssueCustom, "type" | "check" | "checks" | "fn" | "abort" | "error" | "params" | "path">;
|
|
631
|
-
declare function _instanceof<T extends typeof Class>(cls: T, params?: ZodInstanceOfParams): ZodCustom<InstanceType<T>>;
|
|
608
|
+
export declare function superRefine<T>(fn: (arg: T, payload: RefinementCtx<T>) => void | Promise<void>): core.$ZodCheck<T>;
|
|
609
|
+
type ZodInstanceOfParams = core.Params<ZodCustom, core.$ZodIssueCustom, "type" | "check" | "checks" | "fn" | "abort" | "error" | "params" | "path">;
|
|
610
|
+
declare function _instanceof<T extends typeof util.Class>(cls: T, params?: ZodInstanceOfParams): ZodCustom<InstanceType<T>, InstanceType<T>>;
|
|
632
611
|
export { _instanceof as instanceof };
|
|
633
|
-
export declare const stringbool: (_params?: string | core.$ZodStringBoolParams) => ZodPipe<
|
|
634
|
-
|
|
612
|
+
export declare const stringbool: (_params?: string | core.$ZodStringBoolParams) => ZodPipe<ZodPipe<ZodString, ZodTransform<boolean, string>>, ZodBoolean>;
|
|
613
|
+
type _ZodJSONSchema = ZodUnion<[
|
|
635
614
|
ZodString,
|
|
636
615
|
ZodNumber,
|
|
637
616
|
ZodBoolean,
|
|
638
617
|
ZodNull,
|
|
639
618
|
ZodArray<ZodJSONSchema>,
|
|
640
619
|
ZodRecord<ZodString, ZodJSONSchema>
|
|
641
|
-
]
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
}
|
|
647
|
-
export
|
|
648
|
-
|
|
620
|
+
]>;
|
|
621
|
+
type _ZodJSONSchemaInternals = _ZodJSONSchema["_zod"];
|
|
622
|
+
export interface ZodJSONSchemaInternals extends _ZodJSONSchemaInternals {
|
|
623
|
+
output: util.JSONType;
|
|
624
|
+
input: util.JSONType;
|
|
625
|
+
}
|
|
626
|
+
export interface ZodJSONSchema extends _ZodJSONSchema {
|
|
627
|
+
_zod: ZodJSONSchemaInternals;
|
|
649
628
|
}
|
|
650
|
-
export declare function
|
|
629
|
+
export declare function json(params?: string | core.$ZodCustomParams): ZodJSONSchema;
|
|
630
|
+
export declare function preprocess<A, U extends core.SomeType, B = unknown>(fn: (arg: B, ctx: RefinementCtx) => A, schema: U): ZodPipe<ZodTransform<A, B>, U>;
|