{"repo":"zod","file":".claude/skills/triage/scripts/reindex.mjs","line":24,"symbol":"frontmatter","kind":"function","lang":"javascript","doc":"Minimal frontmatter reader: flat `key: value` pairs only, which is all the format uses.","code":"function frontmatter(file) {\n const text = readFileSync(file, \"utf8\");\n const m = text.match(/^---\\r?\\n([\\s\\S]*?)\\r?\\n---/);\n if (!m) return null;\n const out = {};\n for (const line of m[1].split(/\\r?\\n/)) {\n const kv = line.match(/^([A-Za-z_][\\w-]*):\\s*(.*)$/);\n if (kv) out[kv[1]] = kv[2].trim().replace(/^[\"'](.*)[\"']$/, \"$1\");\n }\n return out;\n}"} {"repo":"zod","file":".editorconfig","line":4,"symbol":"root","kind":"field","lang":"editorconfig","code":"root = true"} {"repo":"zod","file":".editorconfig","line":7,"symbol":"[*]\n","kind":"section","lang":"editorconfig","code":"[*]\nend_of_line = lf\ninsert_final_newline = true\nindent_style = space\nindent_size = 2\ncharset = utf-8"} {"repo":"zod","file":".editorconfig","line":8,"symbol":"end_of_line","kind":"field","lang":"editorconfig","code":"end_of_line = lf"} {"repo":"zod","file":".editorconfig","line":9,"symbol":"insert_final_newline","kind":"field","lang":"editorconfig","code":"insert_final_newline = true"} {"repo":"zod","file":".editorconfig","line":10,"symbol":"indent_style","kind":"field","lang":"editorconfig","code":"indent_style = space"} {"repo":"zod","file":".editorconfig","line":11,"symbol":"indent_size","kind":"field","lang":"editorconfig","code":"indent_size = 2"} {"repo":"zod","file":".editorconfig","line":12,"symbol":"charset","kind":"field","lang":"editorconfig","code":"charset = utf-8"} {"repo":"zod","file":".github/scripts/npm-stage-publish.sh","line":15,"symbol":"dir","kind":"variable","lang":"bash","code":"dir=\"${1:?usage: npm-stage-publish.sh [npm stage publish flags...]}\""} {"repo":"zod","file":".github/scripts/npm-stage-publish.sh","line":17,"symbol":"version","kind":"variable","lang":"bash","code":"version=\"${VERSION:?VERSION must name the version being staged}\""} {"repo":"zod","file":".github/scripts/npm-stage-publish.sh","line":19,"symbol":"name","kind":"variable","lang":"bash","code":"name=\"$(nub --node -p \"require('./$dir/package.json').name\")\""} {"repo":"zod","file":".github/scripts/npm-stage-publish.sh","line":21,"symbol":"encoded","kind":"variable","lang":"bash","doc":"registry.npmjs.org wants the scope separator percent-encoded: @zod/mini -> @zod%2fmini.","code":"encoded=\"${name/\\//%2f}\""} {"repo":"zod","file":".github/scripts/npm-stage-publish.sh","line":29,"symbol":"out","kind":"variable","lang":"bash","code":"out=\"$(mktemp)\""} {"repo":"zod","file":"packages/bench/arktype-morph-test.ts","line":4,"symbol":"noMorph","kind":"constant","lang":"typescript","doc":"Schema WITHOUT morph","code":"const noMorph = type({\n name: \"string\",\n age: \"number\",\n});"} {"repo":"zod","file":"packages/bench/arktype-morph-test.ts","line":10,"symbol":"withMorph","kind":"constant","lang":"typescript","doc":"Schema WITH morph (trim the string)","code":"const withMorph = type({\n name: \"string.trim\",\n age: \"number\",\n});"} {"repo":"zod","file":"packages/bench/arktype-morph-test.ts","line":16,"symbol":"withPipeMorph","kind":"constant","lang":"typescript","doc":"Schema with pipe morph","code":"const withPipeMorph = type({\n name: type(\"string\").pipe((s) => s.toUpperCase()),\n age: \"number\",\n});"} {"repo":"zod","file":"packages/bench/arktype-morph-test.ts","line":21,"symbol":"testData","kind":"constant","lang":"typescript","code":"const testData = { name: \" Alice \", age: 30 };"} {"repo":"zod","file":"packages/bench/arktype-morph-test.ts","line":22,"symbol":"cleanData","kind":"constant","lang":"typescript","code":"const cleanData = { name: \"Alice\", age: 30 };"} {"repo":"zod","file":"packages/bench/arktype-morph-test.ts","line":27,"symbol":"noMorphResult","kind":"constant","lang":"typescript","doc":"Test without morph","code":"const noMorphResult = noMorph(cleanData);"} {"repo":"zod","file":"packages/bench/arktype-morph-test.ts","line":34,"symbol":"withMorphResult","kind":"constant","lang":"typescript","doc":"Test with built-in morph (trim)","code":"const withMorphResult = withMorph(testData);"} {"repo":"zod","file":"packages/bench/arktype-morph-test.ts","line":45,"symbol":"pipeMorphResult","kind":"constant","lang":"typescript","doc":"Test with pipe morph","code":"const pipeMorphResult = withPipeMorph(testData);"} {"repo":"zod","file":"packages/bench/arktype-morph-test.ts","line":56,"symbol":"nestedWithMorph","kind":"constant","lang":"typescript","doc":"Test nested object with morph","code":"const nestedWithMorph = type({\n user: {\n name: \"string.trim\",\n email: \"string.lower\",\n },\n});"} {"repo":"zod","file":"packages/bench/arktype-morph-test.ts","line":63,"symbol":"nestedData","kind":"constant","lang":"typescript","code":"const nestedData = { user: { name: \" Bob \", email: \"BOB@EXAMPLE.COM\" } };"} {"repo":"zod","file":"packages/bench/arktype-morph-test.ts","line":64,"symbol":"nestedResult","kind":"constant","lang":"typescript","code":"const nestedResult = nestedWithMorph(nestedData);"} {"repo":"zod","file":"packages/bench/array.ts","line":5,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = makeData(1000, () => Array.from({ length: 3 }, () => randomString(10)));"} {"repo":"zod","file":"packages/bench/array.ts","line":11,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"z.array() parsing\", {\n zod3() {\n for (const _ of DATA) zod3.parse(_);\n },\n zod4() {\n for (const _ of DATA) zod4.parse(_);\n },\n});"} {"repo":"zod","file":"packages/bench/array.ts","line":12,"symbol":"zod3","kind":"method","lang":"typescript","code":"zod3() {\n for (const _ of DATA) zod3.parse(_);\n }"} {"repo":"zod","file":"packages/bench/array.ts","line":15,"symbol":"zod4","kind":"method","lang":"typescript","code":"zod4() {\n for (const _ of DATA) zod4.parse(_);\n }"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":5,"symbol":"$ZodError","kind":"class","lang":"typescript","doc":"Simulated pre-instantiated $ZodError","code":"class $ZodError extends Error {\n issues: unknown[] = [];\n}"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":8,"symbol":"INVALID","kind":"constant","lang":"typescript","code":"const INVALID = new $ZodError();"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":10,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = Array.from({ length: 1000 }, () =>\n Object.freeze({\n number: 1,\n negNumber: -1,\n maxNumber: Number.MAX_VALUE,\n string: \"string\",\n longString: \"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\",\n boolean: true,\n deeplyNested: Object.freeze({\n foo: \"bar\",\n num: 1,\n bool: false,\n }),\n })\n);"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":27,"symbol":"_run","kind":"function","lang":"typescript","doc":"Core _run function - returns T | $ZodError","code":"function _run(input: any) {\n if (typeof input !== \"object\" || input === null) return INVALID;\n if (typeof input.number !== \"number\") return INVALID;\n if (typeof input.negNumber !== \"number\") return INVALID;\n if (typeof input.maxNumber !== \"number\") return INVALID;\n if (typeof input.string !== \"string\") return INVALID;\n if (typeof input.longString !== \"string\") return INVALID;\n if (typeof input.boolean !== \"boolean\") return INVALID;\n const dn = input.deeplyNested;\n if (typeof dn !== \"object\" || dn === null) return INVALID;\n if (typeof dn.foo !== \"string\") return INVALID;\n if (typeof dn.num !== \"number\") return INVALID;\n if (typeof dn.bool !== \"boolean\") return INVALID;\n return {\n number: input.number,\n negNumber: input.negNumber,\n maxNumber: input.maxNumber,\n string: input.string,\n longString: input.longString,\n boolean: input.boolean,\n deeplyNested: { foo: dn.foo, num: dn.num, bool: dn.bool },\n };\n}"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":35,"symbol":"dn","kind":"constant","lang":"typescript","code":"const dn = input.deeplyNested;"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":52,"symbol":"safeParse","kind":"function","lang":"typescript","doc":"safeParse() - wraps result","code":"function safeParse(input: any) {\n const result = _run(input);\n if (result === INVALID) return { success: false as const, error: INVALID };\n return { success: true as const, data: result };\n}"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":53,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = _run(input);"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":59,"symbol":"arkSchema","kind":"constant","lang":"typescript","doc":"ArkType schema for comparison","code":"const arkSchema = type({\n number: \"number\",\n negNumber: \"number\",\n maxNumber: \"number\",\n string: \"string\",\n longString: \"string\",\n boolean: \"boolean\",\n deeplyNested: {\n foo: \"string\",\n num: \"number\",\n bool: \"boolean\",\n },\n});"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":78,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = _run(item);"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":85,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = _run(item);"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":90,"symbol":"safeParse","kind":"method","lang":"typescript","code":"safeParse() {\n for (const item of DATA) {\n const r = safeParse(item);\n if (!r.success) sink = null;\n else sink = r.data;\n }\n }"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":92,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = safeParse(item);"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":99,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = arkSchema(item);"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":107,"symbol":"INVALID_DATA","kind":"constant","lang":"typescript","doc":"Invalid data - wrong type on first check","code":"const INVALID_DATA = Array.from({ length: 1000 }, () =>\n Object.freeze({\n number: \"not a number\", // wrong type - fails fast\n negNumber: -1,\n maxNumber: Number.MAX_VALUE,\n string: \"string\",\n longString: \"Lorem ipsum dolor sit amet.\",\n boolean: true,\n deeplyNested: Object.freeze({ foo: \"bar\", num: 1, bool: false }),\n })\n);"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":122,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = _run(item);"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":129,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = _run(item);"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":134,"symbol":"safeParse","kind":"method","lang":"typescript","code":"safeParse() {\n for (const item of INVALID_DATA) {\n const r = safeParse(item);\n if (!r.success) sink = null;\n else sink = r.data;\n }\n }"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":136,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = safeParse(item);"} {"repo":"zod","file":"packages/bench/bench-invalid.ts","line":143,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = arkSchema(item);"} {"repo":"zod","file":"packages/bench/benchUtil.ts","line":5,"symbol":"zod4","kind":"constant","lang":"typescript","doc":"load the published build regardless of the workspace's source condition","code":"const zod4: typeof import(\"zod4\") = await import(new URL(\"index.js\", import.meta.resolve(\"zod4/package.json\")).href);"} {"repo":"zod","file":"packages/bench/benchUtil.ts","line":8,"symbol":"makeSchema","kind":"function","lang":"typescript","code":"function makeSchema(factory: (z: typeof zod4) => T) {\n return {\n zod3: factory(zod3 as any) as T,\n zod4: factory(zod4 as any) as T,\n // zod4Ts: factory(zodNewTs as any),\n };\n}"} {"repo":"zod","file":"packages/bench/benchUtil.ts","line":16,"symbol":"randomString","kind":"function","lang":"typescript","code":"function randomString(length: number): string {\n const characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n let result = \"\";\n for (let i = 0; i < length; i++) {\n result += characters.charAt(Math.floor(Math.random() * characters.length));\n }\n return result;\n}"} {"repo":"zod","file":"packages/bench/benchUtil.ts","line":17,"symbol":"characters","kind":"constant","lang":"typescript","code":"const characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";"} {"repo":"zod","file":"packages/bench/benchUtil.ts","line":25,"symbol":"randomPick","kind":"function","lang":"typescript","code":"function randomPick(options: any[]): any {\n return options[Math.floor(Math.random() * options.length)];\n}"} {"repo":"zod","file":"packages/bench/benchUtil.ts","line":29,"symbol":"makeData","kind":"function","lang":"typescript","code":"function makeData(count: number, factory: object | (() => any)): any[] {\n return Array.from({ length: count }, () => {\n // clone non primitive data\n if (typeof factory === \"object\") return { ...factory };\n if (typeof factory === \"function\") return factory();\n throw new Error(\"Invalid factory\");\n });\n}"} {"repo":"zod","file":"packages/bench/benchUtil.ts","line":38,"symbol":"formatNumber","kind":"function","lang":"typescript","code":"function formatNumber(val: number): string {\n if (val >= 1e12) {\n return `${toFixed(val / 1e12)}T`;\n }\n if (val >= 1e9) {\n return `${toFixed(val / 1e9)}B`;\n }\n if (val >= 1e6) {\n return `${toFixed(val / 1e6)}M`;\n }\n if (val >= 1e3) {\n return `${toFixed(val / 1e3)}k`;\n }\n if (val >= 1) {\n return val.toString();\n }\n if (val >= 1e-3) {\n return `${toFixed(val * 1e3)}m`;\n }\n if (val >= 1e-6) {\n return `${toFixed(val * 1e6)}µ`;\n }\n if (val >= 1e-9) {\n return `${toFixed(val * 1e9)}n`;\n }\n if (val >= 1e-12) {\n return `${toFixed(val * 1e12)}p`;\n }\n return val.toString();\n}"} {"repo":"zod","file":"packages/bench/benchUtil.ts","line":69,"symbol":"toFixed","kind":"function","lang":"typescript","code":"function toFixed(val: number) {\n return val.toPrecision(3);\n}"} {"repo":"zod","file":"packages/bench/boolean.ts","line":5,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = makeData(10000, () => Math.random() > 0.5);"} {"repo":"zod","file":"packages/bench/boolean.ts","line":7,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"z.boolean().parse\", {\n zod3() {\n for (const _ of DATA) zod3.parse(_);\n },\n zod4() {\n for (const _ of DATA) zod4.parse(_);\n },\n});"} {"repo":"zod","file":"packages/bench/boolean.ts","line":8,"symbol":"zod3","kind":"method","lang":"typescript","code":"zod3() {\n for (const _ of DATA) zod3.parse(_);\n }"} {"repo":"zod","file":"packages/bench/boolean.ts","line":11,"symbol":"zod4","kind":"method","lang":"typescript","code":"zod4() {\n for (const _ of DATA) zod4.parse(_);\n }"} {"repo":"zod","file":"packages/bench/compile-array-build.ts","line":8,"symbol":"DATA_SMALL","kind":"constant","lang":"typescript","doc":"Small arrays (3 elements)","code":"const DATA_SMALL = Array.from({ length: 1000 }, () => [\"hello\", \"world\", \"test\"]);"} {"repo":"zod","file":"packages/bench/compile-array-build.ts","line":11,"symbol":"DATA_MEDIUM","kind":"constant","lang":"typescript","doc":"Medium arrays (10 elements)","code":"const DATA_MEDIUM = Array.from({ length: 1000 }, () => [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\"]);"} {"repo":"zod","file":"packages/bench/compile-array-build.ts","line":14,"symbol":"DATA_LARGE","kind":"constant","lang":"typescript","doc":"Large arrays (25 elements)","code":"const DATA_LARGE = Array.from({ length: 1000 }, () => Array.from({ length: 25 }, (_, i) => `item${i}`));"} {"repo":"zod","file":"packages/bench/compile-array-build.ts","line":20,"symbol":"arrayReturnInput","kind":"function","lang":"typescript","code":"function arrayReturnInput(input: T[]): T[] {\n return input;\n}"} {"repo":"zod","file":"packages/bench/compile-array-build.ts","line":24,"symbol":"arrayBuildIndex","kind":"function","lang":"typescript","code":"function arrayBuildIndex(input: T[]): T[] {\n const out: T[] = new Array(input.length);\n for (let i = 0; i < input.length; i++) {\n out[i] = input[i]!;\n }\n return out;\n}"} {"repo":"zod","file":"packages/bench/compile-array-build.ts","line":25,"symbol":"out","kind":"constant","lang":"typescript","code":"const out: T[] = new Array(input.length);"} {"repo":"zod","file":"packages/bench/compile-array-build.ts","line":32,"symbol":"arraySlice","kind":"function","lang":"typescript","code":"function arraySlice(input: T[]): T[] {\n return input.slice();\n}"} {"repo":"zod","file":"packages/bench/compile-array-build.ts","line":38,"symbol":"benchPureSmall","kind":"constant","lang":"typescript","code":"const benchPureSmall = metabench(\"pure construction (3 elements)\", {\n \"return input\"() {\n for (const d of DATA_SMALL) arrayReturnInput(d);\n },\n \"index assignment\"() {\n for (const d of DATA_SMALL) arrayBuildIndex(d);\n },\n slice() {\n for (const d of DATA_SMALL) arraySlice(d);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-array-build.ts","line":45,"symbol":"slice","kind":"method","lang":"typescript","code":"slice() {\n for (const d of DATA_SMALL) arraySlice(d);\n }"} {"repo":"zod","file":"packages/bench/compile-array-build.ts","line":52,"symbol":"benchPureLarge","kind":"constant","lang":"typescript","code":"const benchPureLarge = metabench(\"pure construction (25 elements)\", {\n \"return input\"() {\n for (const d of DATA_LARGE) arrayReturnInput(d);\n },\n \"index assignment\"() {\n for (const d of DATA_LARGE) arrayBuildIndex(d);\n },\n slice() {\n for (const d of DATA_LARGE) arraySlice(d);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-array-build.ts","line":59,"symbol":"slice","kind":"method","lang":"typescript","code":"slice() {\n for (const d of DATA_LARGE) arraySlice(d);\n }"} {"repo":"zod","file":"packages/bench/compile-array-build.ts","line":70,"symbol":"validateReturnInput","kind":"function","lang":"typescript","code":"function validateReturnInput(input: unknown[]): unknown[] | undefined {\n if (!Array.isArray(input)) return undefined;\n for (let i = 0; i < input.length; i++) {\n if (typeof input[i] !== \"string\") return undefined;\n }\n return input;\n}"} {"repo":"zod","file":"packages/bench/compile-array-build.ts","line":78,"symbol":"validateBuildIndex","kind":"function","lang":"typescript","code":"function validateBuildIndex(input: unknown[]): string[] | undefined {\n if (!Array.isArray(input)) return undefined;\n const out: string[] = new Array(input.length);\n for (let i = 0; i < input.length; i++) {\n const elem = input[i];\n if (typeof elem !== \"string\") return undefined;\n out[i] = elem;\n }\n return out;\n}"} {"repo":"zod","file":"packages/bench/compile-array-build.ts","line":80,"symbol":"out","kind":"constant","lang":"typescript","code":"const out: string[] = new Array(input.length);"} {"repo":"zod","file":"packages/bench/compile-array-build.ts","line":82,"symbol":"elem","kind":"constant","lang":"typescript","code":"const elem = input[i];"} {"repo":"zod","file":"packages/bench/compile-array-build.ts","line":91,"symbol":"benchValSmall","kind":"constant","lang":"typescript","code":"const benchValSmall = metabench(\"validate + construct (3 elements)\", {\n \"validate + return\"() {\n for (const d of DATA_SMALL) validateReturnInput(d);\n },\n \"validate + build\"() {\n for (const d of DATA_SMALL) validateBuildIndex(d);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-array-build.ts","line":102,"symbol":"benchValMedium","kind":"constant","lang":"typescript","code":"const benchValMedium = metabench(\"validate + construct (10 elements)\", {\n \"validate + return\"() {\n for (const d of DATA_MEDIUM) validateReturnInput(d);\n },\n \"validate + build\"() {\n for (const d of DATA_MEDIUM) validateBuildIndex(d);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-array-build.ts","line":113,"symbol":"benchValLarge","kind":"constant","lang":"typescript","code":"const benchValLarge = metabench(\"validate + construct (25 elements)\", {\n \"validate + return\"() {\n for (const d of DATA_LARGE) validateReturnInput(d);\n },\n \"validate + build\"() {\n for (const d of DATA_LARGE) validateBuildIndex(d);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-base64-inline-vs-hoist.ts","line":6,"symbol":"INVALID","kind":"constant","lang":"typescript","code":"const INVALID = Symbol(\"invalid\");"} {"repo":"zod","file":"packages/bench/compile-base64-inline-vs-hoist.ts","line":7,"symbol":"VALID","kind":"constant","lang":"typescript","code":"const VALID = \"SGVsbG8gV29ybGQ=\";"} {"repo":"zod","file":"packages/bench/compile-base64-inline-vs-hoist.ts","line":8,"symbol":"INVALID_LENGTH","kind":"constant","lang":"typescript","code":"const INVALID_LENGTH = \"12345\";"} {"repo":"zod","file":"packages/bench/compile-base64-inline-vs-hoist.ts","line":9,"symbol":"INVALID_WHITESPACE","kind":"constant","lang":"typescript","code":"const INVALID_WHITESPACE = \"SGVsbG8gV29ybGQ= \";"} {"repo":"zod","file":"packages/bench/compile-base64-inline-vs-hoist.ts","line":11,"symbol":"base64","kind":"constant","lang":"typescript","code":"const base64 = z.base64();"} {"repo":"zod","file":"packages/bench/compile-base64-inline-vs-hoist.ts","line":12,"symbol":"compiled","kind":"constant","lang":"typescript","code":"const compiled = zcore.compile(base64);"} {"repo":"zod","file":"packages/bench/compile-base64-inline-vs-hoist.ts","line":13,"symbol":"compiledFn","kind":"constant","lang":"typescript","code":"const compiledFn = zcore.compileFn(base64);"} {"repo":"zod","file":"packages/bench/compile-base64-inline-vs-hoist.ts","line":15,"symbol":"F","kind":"constant","lang":"typescript","code":"const F = Function;"} {"repo":"zod","file":"packages/bench/compile-base64-inline-vs-hoist.ts","line":17,"symbol":"manualHoisted","kind":"constant","lang":"typescript","code":"const manualHoisted = new F(\n \"INVALID\",\n \"isValidBase64\",\n `return (input) => {\n if (typeof input !== \"string\") return INVALID;\n if (!isValidBase64(input)) return INVALID;\n return input;\n };`\n)(INVALID, isValidBase64) as (input: unknown) => unknown;"} {"repo":"zod","file":"packages/bench/compile-base64-inline-vs-hoist.ts","line":27,"symbol":"manualInline","kind":"constant","lang":"typescript","code":"const manualInline = new F(\n \"INVALID\",\n `return (input) => {\n if (typeof input !== \"string\") return INVALID;\n if (input === \"\") return input;\n if (/\\\\s/.test(input)) return INVALID;\n if (input.length % 4 !== 0) return INVALID;\n try {\n atob(input);\n return input;\n } catch {\n return INVALID;\n }\n };`\n)(INVALID) as (input: unknown) => unknown;"} {"repo":"zod","file":"packages/bench/compile-base64-inline-vs-hoist.ts","line":43,"symbol":"ws","kind":"constant","lang":"typescript","code":"const ws = /\\s/;"} {"repo":"zod","file":"packages/bench/compile-base64-inline-vs-hoist.ts","line":44,"symbol":"manualInlineHoistedRegex","kind":"constant","lang":"typescript","code":"const manualInlineHoistedRegex = new F(\n \"INVALID\",\n \"ws\",\n `return (input) => {\n if (typeof input !== \"string\") return INVALID;\n if (input === \"\") return input;\n if (ws.test(input)) return INVALID;\n if (input.length % 4 !== 0) return INVALID;\n try {\n atob(input);\n return input;\n } catch {\n return INVALID;\n }\n };`\n)(INVALID, ws) as (input: unknown) => unknown;"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":5,"symbol":"INVALID","kind":"constant","lang":"typescript","code":"const INVALID = Symbol(\"invalid\");"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":7,"symbol":"inputSchema","kind":"constant","lang":"typescript","code":"const inputSchema = z.object({\n id: z.string(),\n count: z.number(),\n active: z.boolean(),\n nested: z.object({\n label: z.string(),\n score: z.number(),\n }),\n});"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":17,"symbol":"outputSchema","kind":"constant","lang":"typescript","code":"const outputSchema = z.object({\n id: z.string(),\n count: z.number(),\n active: z.boolean(),\n nested: z.object({\n label: z.string(),\n score: z.number(),\n }),\n encoded: z.boolean(),\n});"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":28,"symbol":"codec","kind":"constant","lang":"typescript","code":"const codec = z.codec(inputSchema, outputSchema, {\n decode: (input) => ({ ...input, encoded: true }),\n encode: (output) => ({\n id: output.id,\n count: output.count,\n active: output.active,\n nested: output.nested,\n }),\n});"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":38,"symbol":"compiled","kind":"constant","lang":"typescript","code":"const compiled = zcore.compile(codec);"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":39,"symbol":"forward","kind":"constant","lang":"typescript","code":"const forward = zcore.compileFn(codec);"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":41,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = {\n id: \"abc\",\n count: 123,\n active: true,\n nested: { label: \"nested\", score: 456 },\n};"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":48,"symbol":"output","kind":"constant","lang":"typescript","code":"const output = { ...input, encoded: true };"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":50,"symbol":"validateInput","kind":"function","lang":"typescript","code":"function validateInput(value: any) {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return INVALID;\n if (!(\"id\" in value) || typeof value.id !== \"string\") return INVALID;\n if (!(\"count\" in value) || typeof value.count !== \"number\" || !Number.isFinite(value.count)) return INVALID;\n if (!(\"active\" in value) || typeof value.active !== \"boolean\") return INVALID;\n const nested = value.nested;\n if (typeof nested !== \"object\" || nested === null || Array.isArray(nested)) return INVALID;\n if (!(\"label\" in nested) || typeof nested.label !== \"string\") return INVALID;\n if (!(\"score\" in nested) || typeof nested.score !== \"number\" || !Number.isFinite(nested.score)) return INVALID;\n return {\n id: value.id,\n count: value.count,\n active: value.active,\n nested: { label: nested.label, score: nested.score },\n };\n}"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":55,"symbol":"nested","kind":"constant","lang":"typescript","code":"const nested = value.nested;"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":67,"symbol":"validateOutput","kind":"function","lang":"typescript","code":"function validateOutput(value: any) {\n const base = validateInput(value);\n if (base === INVALID) return INVALID;\n if (!(\"encoded\" in value) || typeof value.encoded !== \"boolean\") return INVALID;\n return { ...base, encoded: value.encoded };\n}"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":68,"symbol":"base","kind":"constant","lang":"typescript","code":"const base = validateInput(value);"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":74,"symbol":"forwardBranchless","kind":"function","lang":"typescript","code":"function forwardBranchless(value: unknown) {\n const parsed = validateInput(value);\n if (parsed === INVALID) return INVALID;\n return { ...parsed, encoded: true };\n}"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":75,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = validateInput(value);"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":80,"symbol":"backwardBranchless","kind":"function","lang":"typescript","code":"function backwardBranchless(value: unknown) {\n const parsed = validateOutput(value);\n if (parsed === INVALID) return INVALID;\n return {\n id: parsed.id,\n count: parsed.count,\n active: parsed.active,\n nested: parsed.nested,\n };\n}"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":81,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = validateOutput(value);"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":91,"symbol":"unifiedTopLevel","kind":"function","lang":"typescript","code":"function unifiedTopLevel(value: unknown, direction: \"forward\" | \"backward\") {\n return direction === \"backward\" ? backwardBranchless(value) : forwardBranchless(value);\n}"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":95,"symbol":"unifiedNestedBranch","kind":"function","lang":"typescript","code":"function unifiedNestedBranch(value: unknown, direction: \"forward\" | \"backward\") {\n if (direction === \"backward\") {\n const parsed = validateOutput(value);\n if (parsed === INVALID) return INVALID;\n return {\n id: parsed.id,\n count: parsed.count,\n active: parsed.active,\n nested: parsed.nested,\n };\n }\n\n const parsed = validateInput(value);\n if (parsed === INVALID) return INVALID;\n return { ...parsed, encoded: true };\n}"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":97,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = validateOutput(value);"} {"repo":"zod","file":"packages/bench/compile-codec-direction.ts","line":107,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = validateInput(value);"} {"repo":"zod","file":"packages/bench/compile-endswith.ts","line":5,"symbol":"SUFFIX","kind":"constant","lang":"typescript","code":"const SUFFIX = \"world\";"} {"repo":"zod","file":"packages/bench/compile-endswith.ts","line":8,"symbol":"DATA","kind":"constant","lang":"typescript","doc":"Test data - mix of matching and non-matching strings","code":"const DATA = Array.from({ length: 1000 }, (_, i) => (i % 2 === 0 ? `hello beautiful world` : `hello there`));"} {"repo":"zod","file":"packages/bench/compile-endswith.ts","line":11,"symbol":"endsWithNative","kind":"constant","lang":"typescript","doc":"Approach 1: String.prototype.endsWith","code":"const endsWithNative = (s: string) => s.endsWith(SUFFIX);"} {"repo":"zod","file":"packages/bench/compile-endswith.ts","line":14,"symbol":"pattern","kind":"constant","lang":"typescript","doc":"Approach 2: Regex pattern","code":"const pattern = new RegExp(`.*${SUFFIX}$`);"} {"repo":"zod","file":"packages/bench/compile-endswith.ts","line":15,"symbol":"endsWithRegex","kind":"constant","lang":"typescript","code":"const endsWithRegex = (s: string) => {\n pattern.lastIndex = 0;\n return pattern.test(s);\n};"} {"repo":"zod","file":"packages/bench/compile-endswith.ts","line":21,"symbol":"endsWithSlice","kind":"constant","lang":"typescript","doc":"Approach 3: Slice comparison","code":"const endsWithSlice = (s: string) => s.slice(-SUFFIX.length) === SUFFIX;"} {"repo":"zod","file":"packages/bench/compile-endswith.ts","line":24,"symbol":"endsWithSubstring","kind":"constant","lang":"typescript","doc":"Approach 4: Substring comparison","code":"const endsWithSubstring = (s: string) => s.substring(s.length - SUFFIX.length) === SUFFIX;"} {"repo":"zod","file":"packages/bench/compile-endswith.ts","line":34,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"endsWith implementations\", {\n \"String.endsWith()\"() {\n for (const s of DATA) endsWithNative(s);\n },\n \"Regex pattern\"() {\n for (const s of DATA) endsWithRegex(s);\n },\n \"String.slice()\"() {\n for (const s of DATA) endsWithSlice(s);\n },\n \"String.substring()\"() {\n for (const s of DATA) endsWithSubstring(s);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":6,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = Array.from({ length: 1000 }, () => \"SGVsbG8gV29ybGQ\");"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":7,"symbol":"JWT_DATA","kind":"constant","lang":"typescript","code":"const JWT_DATA = Array.from({ length: 1000 }, () => \"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.signature\");"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":8,"symbol":"URL_DATA","kind":"constant","lang":"typescript","code":"const URL_DATA = Array.from({ length: 1000 }, () => \" https://example.com/path?x=1 \");"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":10,"symbol":"base64url","kind":"constant","lang":"typescript","code":"const base64url = z.string().base64url();"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":11,"symbol":"compiledBase64url","kind":"constant","lang":"typescript","code":"const compiledBase64url = zcore.compile(base64url);"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":12,"symbol":"fastBase64url","kind":"constant","lang":"typescript","code":"const fastBase64url = zcore.compileFn(base64url);"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":14,"symbol":"jwt","kind":"constant","lang":"typescript","code":"const jwt = z.jwt();"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":15,"symbol":"compiledJwt","kind":"constant","lang":"typescript","code":"const compiledJwt = zcore.compile(jwt);"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":16,"symbol":"fastJwt","kind":"constant","lang":"typescript","code":"const fastJwt = zcore.compileFn(jwt);"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":18,"symbol":"url","kind":"constant","lang":"typescript","code":"const url = z.url();"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":19,"symbol":"compiledUrl","kind":"constant","lang":"typescript","code":"const compiledUrl = zcore.compile(url);"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":20,"symbol":"fastUrl","kind":"constant","lang":"typescript","code":"const fastUrl = zcore.compileFn(url);"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":22,"symbol":"makeScopedValidator","kind":"function","lang":"typescript","code":"function makeScopedValidator(extraConstants: number) {\n const names = [\"helper\"];\n const values: unknown[] = [isValidBase64URL];\n for (let i = 0; i < extraConstants; i++) {\n names.push(`unused${i}`);\n values.push({ i });\n }\n const F = Function;\n const factory = new F(...names, `return (input) => helper(input);`);\n return factory(...values) as (input: string) => boolean;\n}"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":23,"symbol":"names","kind":"constant","lang":"typescript","code":"const names = [\"helper\"];"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":24,"symbol":"values","kind":"constant","lang":"typescript","code":"const values: unknown[] = [isValidBase64URL];"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":29,"symbol":"F","kind":"constant","lang":"typescript","code":"const F = Function;"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":30,"symbol":"factory","kind":"constant","lang":"typescript","code":"const factory = new F(...names, `return (input) => helper(input);`);"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":34,"symbol":"scoped1","kind":"constant","lang":"typescript","code":"const scoped1 = makeScopedValidator(0);"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":35,"symbol":"scoped10","kind":"constant","lang":"typescript","code":"const scoped10 = makeScopedValidator(10);"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":36,"symbol":"scoped50","kind":"constant","lang":"typescript","code":"const scoped50 = makeScopedValidator(50);"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":75,"symbol":"def","kind":"constant","lang":"typescript","doc":"the runtime's own sequence: trim, parse, then the hostname and protocol predicates","code":"const def = url._zod.def;"} {"repo":"zod","file":"packages/bench/compile-helper-scope.ts","line":77,"symbol":"u","kind":"constant","lang":"typescript","code":"const u = parseURLObject(d.trim(), def);"} {"repo":"zod","file":"packages/bench/compile-includes.ts","line":5,"symbol":"NEEDLE","kind":"constant","lang":"typescript","code":"const NEEDLE = \"beautiful\";"} {"repo":"zod","file":"packages/bench/compile-includes.ts","line":8,"symbol":"DATA","kind":"constant","lang":"typescript","doc":"Test data - mix of matching and non-matching strings","code":"const DATA = Array.from({ length: 1000 }, (_, i) => (i % 2 === 0 ? `hello beautiful world` : `hello world`));"} {"repo":"zod","file":"packages/bench/compile-includes.ts","line":11,"symbol":"includesNative","kind":"constant","lang":"typescript","doc":"Approach 1: String.prototype.includes","code":"const includesNative = (s: string) => s.includes(NEEDLE);"} {"repo":"zod","file":"packages/bench/compile-includes.ts","line":14,"symbol":"pattern","kind":"constant","lang":"typescript","doc":"Approach 2: Regex pattern","code":"const pattern = new RegExp(NEEDLE);"} {"repo":"zod","file":"packages/bench/compile-includes.ts","line":15,"symbol":"includesRegex","kind":"constant","lang":"typescript","code":"const includesRegex = (s: string) => {\n pattern.lastIndex = 0;\n return pattern.test(s);\n};"} {"repo":"zod","file":"packages/bench/compile-includes.ts","line":21,"symbol":"includesIndexOf","kind":"constant","lang":"typescript","doc":"Approach 3: indexOf check","code":"const includesIndexOf = (s: string) => s.indexOf(NEEDLE) !== -1;"} {"repo":"zod","file":"packages/bench/compile-includes.ts","line":30,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"includes implementations\", {\n \"String.includes()\"() {\n for (const s of DATA) includesNative(s);\n },\n \"Regex pattern\"() {\n for (const s of DATA) includesRegex(s);\n },\n \"String.indexOf()\"() {\n for (const s of DATA) includesIndexOf(s);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":9,"symbol":"Case","kind":"interface","lang":"typescript","code":"interface Case {\n group: string;\n name: string;\n schema: z.ZodType;\n input: unknown;\n}"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":16,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases: Case[] = [];"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":17,"symbol":"add","kind":"constant","lang":"typescript","code":"const add = (group: string, name: string, schema: z.ZodType, input: unknown) =>\n cases.push({ group, name, schema, input });"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":55,"symbol":"flat","kind":"constant","lang":"typescript","doc":"--- objects ---","code":"const flat = { a: \"x\", b: 1, c: true, d: \"y\", e: 2 };"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":71,"symbol":"moltar","kind":"constant","lang":"typescript","code":"const moltar = z.object({\n number: z.number(),\n negNumber: z.number(),\n maxNumber: z.number(),\n string: z.string(),\n longString: z.string(),\n boolean: z.boolean(),\n deeplyNested: z.object({ foo: z.string(), num: z.number(), bool: z.boolean() }),\n});"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":138,"symbol":"rec20","kind":"constant","lang":"typescript","doc":"--- records (the key-schema path) ---","code":"const rec20 = Object.fromEntries(Array.from({ length: 20 }, (_, i) => [`k${i}`, i]));"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":169,"symbol":"du","kind":"constant","lang":"typescript","code":"const du = (n: number) =>\n z.discriminatedUnion(\n \"kind\",\n Array.from({ length: n }, (_, i) => z.object({ kind: z.literal(`k${i}`), v: z.number() }))\n ) as z.ZodType;"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":218,"symbol":"tree","kind":"constant","lang":"typescript","doc":"--- known fallbacks (expect ~1x; here to prove they aren't slower) ---","code":"const tree: z.ZodType = z.object({\n v: z.number(),\n get kids() {\n return z.array(tree);\n },\n}) as z.ZodType;"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":220,"symbol":"kids","kind":"method","lang":"typescript","code":"get kids() {\n return z.array(tree);\n }"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":229,"symbol":"deepEq","kind":"function","lang":"typescript","code":"function deepEq(a: unknown, b: unknown): boolean {\n if (a === b) return true;\n if (typeof a !== typeof b || a === null || b === null || typeof a !== \"object\") {\n return Number.isNaN(a) && Number.isNaN(b);\n }\n if (a instanceof Set && b instanceof Set) return a.size === b.size && [...a].every((v) => b.has(v));\n if (a instanceof Map && b instanceof Map) return a.size === b.size && [...a].every(([k, v]) => deepEq(b.get(k), v));\n if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();\n if (Array.isArray(a) !== Array.isArray(b)) return false;\n const ka = Object.keys(a as object);\n const kb = Object.keys(b as object);\n if (ka.length !== kb.length) return false;\n return ka.every((k) => deepEq((a as any)[k], (b as any)[k]));\n}"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":238,"symbol":"ka","kind":"constant","lang":"typescript","code":"const ka = Object.keys(a as object);"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":239,"symbol":"kb","kind":"constant","lang":"typescript","code":"const kb = Object.keys(b as object);"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":244,"symbol":"ROUNDS","kind":"constant","lang":"typescript","code":"const ROUNDS = 15;"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":246,"symbol":"timed","kind":"function","lang":"typescript","code":"function timed(fn: () => void, iters: number): number {\n const start = process.hrtime.bigint();\n for (let i = 0; i < iters; i++) fn();\n return Number(process.hrtime.bigint() - start) / 1e6; // ms\n}"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":247,"symbol":"start","kind":"constant","lang":"typescript","code":"const start = process.hrtime.bigint();"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":253,"symbol":"calibrate","kind":"function","lang":"typescript","doc":"Iterations that put one measurement near ~40ms, so a round is short but not noise.","code":"function calibrate(fn: () => void): number {\n let iters = 64;\n for (;;) {\n const ms = timed(fn, iters);\n if (ms > 25 || iters > 4_000_000) return iters;\n iters = Math.max(iters * 2, Math.ceil((iters * 40) / Math.max(ms, 0.05)));\n }\n}"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":256,"symbol":"ms","kind":"constant","lang":"typescript","code":"const ms = timed(fn, iters);"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":262,"symbol":"Row","kind":"interface","lang":"typescript","code":"interface Row {\n group: string;\n name: string;\n runtime: number;\n compiled: number;\n raw: number | null;\n status: string;\n}"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":271,"symbol":"fmt","kind":"constant","lang":"typescript","code":"const fmt = (n: number) =>\n n >= 1e6 ? `${(n / 1e6).toFixed(2)}M` : n >= 1e3 ? `${(n / 1e3).toFixed(1)}k` : n.toFixed(0);"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":273,"symbol":"pad","kind":"constant","lang":"typescript","code":"const pad = (s: string, n: number) => s.padEnd(n);"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":274,"symbol":"padL","kind":"constant","lang":"typescript","code":"const padL = (s: string, n: number) => s.padStart(n);"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":276,"symbol":"report","kind":"function","lang":"typescript","code":"function report(rows: Row[], problems: string[]): void {\n console.log();\n console.log(\n `compiled vs runtime — best of ${ROUNDS} interleaved rounds, ops/sec (${isolate ? \"one process per schema\" : \"one shared process\"})`\n );\n console.log();\n console.log(\n `${pad(\"group\", 11)}${pad(\"schema\", 24)}${padL(\"runtime\", 10)}${padL(\"compiled\", 10)}${padL(\"raw fast\", 10)}${padL(\"speedup\", 10)} status`\n );\n console.log(\"-\".repeat(88));\n\n let lastGroup = \"\";\n for (const r of rows) {\n const speedup = r.compiled / r.runtime;\n console.log(\n `${pad(r.group === lastGroup ? \"\" : r.group, 11)}${pad(r.name, 24)}${padL(fmt(r.runtime), 10)}${padL(fmt(r.compiled), 10)}${padL(r.raw ? fmt(r.raw) : \"-\", 10)}${padL(`${speedup.toFixed(2)}x`, 10)} ${r.status}`\n );\n lastGroup = r.group;\n }\n\n const compiledRows = rows.filter((r) => r.status === \"compiled\");\n const speedups = compiledRows.map((r) => r.compiled / r.runtime).sort((a, b) => a - b);\n console.log(\"-\".repeat(88));\n if (speedups.length) {\n console.log(\n `${compiledRows.length}/${rows.length} compiled — speedup median ${speedups[Math.floor(speedups.length / 2)].toFixed(2)}x, range ${speedups[0].toFixed(2)}x–"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":289,"symbol":"speedup","kind":"constant","lang":"typescript","code":"const speedup = r.compiled / r.runtime;"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":296,"symbol":"compiledRows","kind":"constant","lang":"typescript","code":"const compiledRows = rows.filter((r) => r.status === \"compiled\");"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":297,"symbol":"speedups","kind":"constant","lang":"typescript","code":"const speedups = compiledRows.map((r) => r.compiled / r.runtime).sort((a, b) => a - b);"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":303,"symbol":"slower","kind":"constant","lang":"typescript","code":"const slower = compiledRows.filter((r) => r.compiled < r.runtime);"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":321,"symbol":"arg","kind":"constant","lang":"typescript","doc":"Every case shares one `safeParse` call site, and so do zod's own internal dispatch sites. Run all 55 in one process and those caches go megamorphic, which taxes the interpreter more than it taxes a single generated function, so the same schema reads faster compiled that way (median 2.4x) than it does measured alone (1.6x). Neither is wrong; they answer different questions, and the default is the shared one because an application holds many schemas at once and that is the number its users will see. `--isolate` runs one child process per case, which is what to use when tuning a single schema.","code":"const arg = process.argv[2];"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":322,"symbol":"isolate","kind":"constant","lang":"typescript","code":"const isolate = arg === \"--isolate\";"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":323,"symbol":"filter","kind":"constant","lang":"typescript","code":"const filter = isolate ? undefined : arg;"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":324,"symbol":"match","kind":"constant","lang":"typescript","code":"const match = (c: Case) => {\n const id = `${c.group}/${c.name}`;\n return filter!.includes(\"/\") ? id === filter : id.includes(filter!);\n};"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":325,"symbol":"id","kind":"constant","lang":"typescript","code":"const id = `${c.group}/${c.name}`;"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":328,"symbol":"selected","kind":"constant","lang":"typescript","code":"const selected = filter ? cases.filter(match) : cases;"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":330,"symbol":"rows","kind":"constant","lang":"typescript","code":"const rows: Row[] = [];"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":331,"symbol":"problems","kind":"constant","lang":"typescript","code":"const problems: string[] = [];"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":336,"symbol":"id","kind":"constant","lang":"typescript","code":"const id = `${c.group}/${c.name}`;"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":337,"symbol":"child","kind":"constant","lang":"typescript","code":"const child = spawnSync(process.argv[0], [...process.execArgv, process.argv[1], id], {\n encoding: \"utf8\",\n env: { ...process.env, ZOD_BENCH_CHILD: \"1\" },\n });"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":341,"symbol":"line","kind":"constant","lang":"typescript","code":"const line = child.stdout?.split(\"\\n\").find((l) => l.startsWith(\"ROW \"));"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":362,"symbol":"pool","kind":"constant","lang":"typescript","doc":"Feed the input through an array load. Passed as a constant the whole call is loop-invariant and V8 hoists it out of the timing loop — plain interpreter code far more readily than an opaque `new Function` closure, which flatters the runtime by ~1.9x on cheap schemas. An array read is enough to stop it; the values do not need to differ (measured: identical either way).","code":"const pool = Array.from({ length: 64 }, () => c.input);"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":364,"symbol":"runtimeParse","kind":"constant","lang":"typescript","code":"const runtimeParse = () => {\n const r = c.schema.safeParse(pool[idx++ & 63]);\n sink += r.success ? 1 : 0;\n escaped = r;\n };"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":365,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = c.schema.safeParse(pool[idx++ & 63]);"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":380,"symbol":"expected","kind":"constant","lang":"typescript","doc":"Correctness gate. Benchmarking a fast path that disagrees with the runtime measures the wrong thing, so a mismatch is reported instead of timed.","code":"const expected = c.schema.safeParse(c.input);"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":386,"symbol":"got","kind":"constant","lang":"typescript","code":"const got = compiledSchema.safeParse(c.input);"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":397,"symbol":"fp","kind":"constant","lang":"typescript","code":"const fp = compileFn(c.schema);"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":401,"symbol":"v","kind":"constant","lang":"typescript","code":"const v = fp(pool[idx++ & 63]);"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":410,"symbol":"compiledParse","kind":"constant","lang":"typescript","code":"const compiledParse = compiledSchema\n ? () => {\n const r = compiledSchema.safeParse(pool[idx++ & 63]);\n sink += r.success ? 1 : 0;\n escaped = r;\n }\n : runtimeParse;"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":412,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = compiledSchema.safeParse(pool[idx++ & 63]);"} {"repo":"zod","file":"packages/bench/compile-matrix.ts","line":418,"symbol":"iters","kind":"constant","lang":"typescript","code":"const iters = calibrate(runtimeParse);"} {"repo":"zod","file":"packages/bench/compile-object-build.ts","line":7,"symbol":"DATA_LARGE","kind":"constant","lang":"typescript","code":"const DATA_LARGE = Array.from({ length: 1000 }, () => ({\n a: \"1\",\n b: \"2\",\n c: \"3\",\n d: \"4\",\n e: \"5\",\n f: \"6\",\n g: \"7\",\n h: \"8\",\n i: \"9\",\n j: \"10\",\n k: \"11\",\n l: \"12\",\n m: \"13\",\n n: \"14\",\n o: \"15\",\n p: \"16\",\n q: \"17\",\n r: \"18\",\n s: \"19\",\n t: \"20\",\n u: \"21\",\n v: \"22\",\n w: \"23\",\n x: \"24\",\n y: \"25\",\n}));"} {"repo":"zod","file":"packages/bench/compile-object-build.ts","line":36,"symbol":"justReturn","kind":"function","lang":"typescript","doc":"Just return input - no construction","code":"function justReturn(input: Record) {\n return input;\n}"} {"repo":"zod","file":"packages/bench/compile-object-build.ts","line":41,"symbol":"buildLiteral","kind":"function","lang":"typescript","doc":"Build object literal all at once","code":"function buildLiteral(input: Record) {\n return {\n a: input.a,\n b: input.b,\n c: input.c,\n d: input.d,\n e: input.e,\n f: input.f,\n g: input.g,\n h: input.h,\n i: input.i,\n j: input.j,\n k: input.k,\n l: input.l,\n m: input.m,\n n: input.n,\n o: input.o,\n p: input.p,\n q: input.q,\n r: input.r,\n s: input.s,\n t: input.t,\n u: input.u,\n v: input.v,\n w: input.w,\n x: input.x,\n y: input.y,\n };\n}"} {"repo":"zod","file":"packages/bench/compile-object-build.ts","line":72,"symbol":"buildIncremental","kind":"function","lang":"typescript","doc":"Build incrementally (property by property)","code":"function buildIncremental(input: Record) {\n const out: Record = {};\n out.a = input.a;\n out.b = input.b;\n out.c = input.c;\n out.d = input.d;\n out.e = input.e;\n out.f = input.f;\n out.g = input.g;\n out.h = input.h;\n out.i = input.i;\n out.j = input.j;\n out.k = input.k;\n out.l = input.l;\n out.m = input.m;\n out.n = input.n;\n out.o = input.o;\n out.p = input.p;\n out.q = input.q;\n out.r = input.r;\n out.s = input.s;\n out.t = input.t;\n out.u = input.u;\n out.v = input.v;\n out.w = input.w;\n out.x = input.x;\n out.y = input.y;\n return out;\n}"} {"repo":"zod","file":"packages/bench/compile-object-build.ts","line":73,"symbol":"out","kind":"constant","lang":"typescript","code":"const out: Record = {};"} {"repo":"zod","file":"packages/bench/compile-object-build.ts","line":103,"symbol":"buildSpread","kind":"function","lang":"typescript","doc":"Spread","code":"function buildSpread(input: Record) {\n return { ...input };\n}"} {"repo":"zod","file":"packages/bench/compile-object-build.ts","line":108,"symbol":"buildAssign","kind":"function","lang":"typescript","doc":"Object.assign","code":"function buildAssign(input: Record) {\n return Object.assign({}, input);\n}"} {"repo":"zod","file":"packages/bench/compile-object-build.ts","line":116,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"object construction only (25 props)\", {\n \"just return input\"() {\n for (const d of DATA_LARGE) justReturn(d);\n },\n \"object literal\"() {\n for (const d of DATA_LARGE) buildLiteral(d);\n },\n \"incremental assignment\"() {\n for (const d of DATA_LARGE) buildIncremental(d);\n },\n spread() {\n for (const d of DATA_LARGE) buildSpread(d);\n },\n \"Object.assign\"() {\n for (const d of DATA_LARGE) buildAssign(d);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-object-build.ts","line":126,"symbol":"spread","kind":"method","lang":"typescript","code":"spread() {\n for (const d of DATA_LARGE) buildSpread(d);\n }"} {"repo":"zod","file":"packages/bench/compile-object-build.ts","line":140,"symbol":"validateAndReturn","kind":"function","lang":"typescript","code":"function validateAndReturn(input: Record) {\n if (typeof input.a !== \"string\") return undefined;\n if (typeof input.b !== \"string\") return undefined;\n if (typeof input.c !== \"string\") return undefined;\n if (typeof input.d !== \"string\") return undefined;\n if (typeof input.e !== \"string\") return undefined;\n if (typeof input.f !== \"string\") return undefined;\n if (typeof input.g !== \"string\") return undefined;\n if (typeof input.h !== \"string\") return undefined;\n if (typeof input.i !== \"string\") return undefined;\n if (typeof input.j !== \"string\") return undefined;\n if (typeof input.k !== \"string\") return undefined;\n if (typeof input.l !== \"string\") return undefined;\n if (typeof input.m !== \"string\") return undefined;\n if (typeof input.n !== \"string\") return undefined;\n if (typeof input.o !== \"string\") return undefined;\n if (typeof input.p !== \"string\") return undefined;\n if (typeof input.q !== \"string\") return undefined;\n if (typeof input.r !== \"string\") return undefined;\n if (typeof input.s !== \"string\") return undefined;\n if (typeof input.t !== \"string\") return undefined;\n if (typeof input.u !== \"string\") return undefined;\n if (typeof input.v !== \""} {"repo":"zod","file":"packages/bench/compile-object-build.ts","line":169,"symbol":"validateAndBuildLiteral","kind":"function","lang":"typescript","code":"function validateAndBuildLiteral(input: Record) {\n if (typeof input.a !== \"string\") return undefined;\n if (typeof input.b !== \"string\") return undefined;\n if (typeof input.c !== \"string\") return undefined;\n if (typeof input.d !== \"string\") return undefined;\n if (typeof input.e !== \"string\") return undefined;\n if (typeof input.f !== \"string\") return undefined;\n if (typeof input.g !== \"string\") return undefined;\n if (typeof input.h !== \"string\") return undefined;\n if (typeof input.i !== \"string\") return undefined;\n if (typeof input.j !== \"string\") return undefined;\n if (typeof input.k !== \"string\") return undefined;\n if (typeof input.l !== \"string\") return undefined;\n if (typeof input.m !== \"string\") return undefined;\n if (typeof input.n !== \"string\") return undefined;\n if (typeof input.o !== \"string\") return undefined;\n if (typeof input.p !== \"string\") return undefined;\n if (typeof input.q !== \"string\") return undefined;\n if (typeof input.r !== \"string\") return undefined;\n if (typeof input.s !== \"string\") return undefined;\n if (typeof input.t !== \"string\") return undefined;\n if (typeof input.u !== \"string\") return undefined;\n if (typeof input.v"} {"repo":"zod","file":"packages/bench/compile-object-build.ts","line":226,"symbol":"bench2","kind":"constant","lang":"typescript","code":"const bench2 = metabench(\"validate + construct (25 props)\", {\n \"validate + return input\"() {\n for (const d of DATA_LARGE) validateAndReturn(d);\n },\n \"validate + object literal\"() {\n for (const d of DATA_LARGE) validateAndBuildLiteral(d);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":7,"symbol":"DATA_SIMPLE","kind":"constant","lang":"typescript","code":"const DATA_SIMPLE = Array.from({ length: 1000 }, () => ({\n name: \"hello\",\n age: 42,\n active: true,\n}));"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":13,"symbol":"validateOnly","kind":"function","lang":"typescript","code":"function validateOnly(input: unknown): boolean {\n if (typeof input !== \"object\" || input === null) return false;\n const obj = input as Record;\n if (typeof obj.name !== \"string\") return false;\n if (typeof obj.age !== \"number\") return false;\n if (typeof obj.active !== \"boolean\") return false;\n return true;\n}"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":15,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = input as Record;"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":22,"symbol":"validateAndReturn","kind":"function","lang":"typescript","code":"function validateAndReturn(input: unknown): object | undefined {\n if (typeof input !== \"object\" || input === null) return undefined;\n const obj = input as Record;\n if (typeof obj.name !== \"string\") return undefined;\n if (typeof obj.age !== \"number\") return undefined;\n if (typeof obj.active !== \"boolean\") return undefined;\n return obj;\n}"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":24,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = input as Record;"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":36,"symbol":"bench1","kind":"constant","lang":"typescript","code":"const bench1 = metabench(\"non-transforming object\", {\n \"return boolean\"() {\n for (const d of DATA_SIMPLE) validateOnly(d);\n },\n \"return input\"() {\n for (const d of DATA_SIMPLE) validateAndReturn(d);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":51,"symbol":"DATA_EXTRA_KEYS","kind":"constant","lang":"typescript","code":"const DATA_EXTRA_KEYS = Array.from({ length: 1000 }, () => ({\n name: \"hello\",\n age: 42,\n extra1: \"remove me\",\n extra2: 123,\n extra3: true,\n extra4: null,\n}));"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":60,"symbol":"KNOWN_KEYS","kind":"constant","lang":"typescript","code":"const KNOWN_KEYS = new Set([\"name\", \"age\"]);"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":62,"symbol":"stripDelete","kind":"function","lang":"typescript","code":"function stripDelete(input: Record): Record {\n for (const k in input) {\n if (!KNOWN_KEYS.has(k)) delete input[k];\n }\n return input;\n}"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":69,"symbol":"stripBuildNew","kind":"function","lang":"typescript","code":"function stripBuildNew(input: Record): Record {\n return {\n name: input.name,\n age: input.age,\n };\n}"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":76,"symbol":"stripFromEntries","kind":"function","lang":"typescript","code":"function stripFromEntries(input: Record): Record {\n return Object.fromEntries(Object.entries(input).filter(([k]) => KNOWN_KEYS.has(k)));\n}"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":81,"symbol":"freshCopies","kind":"constant","lang":"typescript","doc":"Need fresh copies for delete test","code":"const freshCopies = () => DATA_EXTRA_KEYS.map((d) => ({ ...d }));"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":84,"symbol":"testCopy","kind":"constant","lang":"typescript","code":"const testCopy = { ...DATA_EXTRA_KEYS[0] };"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":91,"symbol":"bench2","kind":"constant","lang":"typescript","code":"const bench2 = metabench(\"strip object (4 unknown keys)\", {\n \"delete keys (mutate)\"() {\n const copies = freshCopies();\n for (const d of copies) stripDelete(d);\n },\n \"build new object\"() {\n for (const d of DATA_EXTRA_KEYS) stripBuildNew(d);\n },\n \"Object.fromEntries\"() {\n for (const d of DATA_EXTRA_KEYS) stripFromEntries(d);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":93,"symbol":"copies","kind":"constant","lang":"typescript","code":"const copies = freshCopies();"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":110,"symbol":"DATA_NEEDS_TRIM","kind":"constant","lang":"typescript","code":"const DATA_NEEDS_TRIM = Array.from({ length: 1000 }, () => ({\n name: \" hello \",\n age: 42,\n}));"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":115,"symbol":"trim","kind":"constant","lang":"typescript","code":"const trim = (s: string) => s.trim();"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":117,"symbol":"transformMutate","kind":"function","lang":"typescript","code":"function transformMutate(input: Record): Record {\n input.name = trim(input.name as string);\n return input;\n}"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":122,"symbol":"transformClone","kind":"function","lang":"typescript","code":"function transformClone(input: Record): Record {\n const output = { ...input };\n output.name = trim(input.name as string);\n return output;\n}"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":123,"symbol":"output","kind":"constant","lang":"typescript","code":"const output = { ...input };"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":128,"symbol":"transformBuildNew","kind":"function","lang":"typescript","code":"function transformBuildNew(input: Record): Record {\n return {\n name: trim(input.name as string),\n age: input.age,\n };\n}"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":136,"symbol":"freshTrimCopies","kind":"constant","lang":"typescript","doc":"Need fresh copies for mutate test","code":"const freshTrimCopies = () => DATA_NEEDS_TRIM.map((d) => ({ ...d }));"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":139,"symbol":"trimTest","kind":"constant","lang":"typescript","code":"const trimTest = { ...DATA_NEEDS_TRIM[0] };"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":146,"symbol":"bench3","kind":"constant","lang":"typescript","code":"const bench3 = metabench(\"single property transform (trim)\", {\n \"mutate in place\"() {\n const copies = freshTrimCopies();\n for (const d of copies) transformMutate(d);\n },\n \"clone with spread\"() {\n for (const d of DATA_NEEDS_TRIM) transformClone(d);\n },\n \"build new object\"() {\n for (const d of DATA_NEEDS_TRIM) transformBuildNew(d);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":148,"symbol":"copies","kind":"constant","lang":"typescript","code":"const copies = freshTrimCopies();"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":165,"symbol":"DATA_NESTED","kind":"constant","lang":"typescript","code":"const DATA_NESTED = Array.from({ length: 1000 }, () => ({\n user: {\n name: \" hello \",\n email: \"test@example.com\",\n },\n meta: {\n created: 12345,\n },\n}));"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":175,"symbol":"NestedData","kind":"type","lang":"typescript","code":"type NestedData = { user: { name: string; email: string }; meta: { created: number } };"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":177,"symbol":"nestedMutate","kind":"function","lang":"typescript","code":"function nestedMutate(input: NestedData): NestedData {\n input.user.name = trim(input.user.name);\n return input;\n}"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":182,"symbol":"nestedClonePath","kind":"function","lang":"typescript","code":"function nestedClonePath(input: NestedData): NestedData {\n return {\n ...input,\n user: {\n ...input.user,\n name: trim(input.user.name),\n },\n };\n}"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":192,"symbol":"nestedDeepClone","kind":"function","lang":"typescript","code":"function nestedDeepClone(input: NestedData): NestedData {\n const output = JSON.parse(JSON.stringify(input));\n output.user.name = trim(output.user.name);\n return output;\n}"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":193,"symbol":"output","kind":"constant","lang":"typescript","code":"const output = JSON.parse(JSON.stringify(input));"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":198,"symbol":"freshNestedCopies","kind":"constant","lang":"typescript","code":"const freshNestedCopies = () =>\n DATA_NESTED.map((d) => ({\n user: { ...d.user },\n meta: { ...d.meta },\n }));"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":205,"symbol":"nestedTest","kind":"constant","lang":"typescript","code":"const nestedTest = { user: { ...DATA_NESTED[0].user }, meta: { ...DATA_NESTED[0].meta } };"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":211,"symbol":"bench4","kind":"constant","lang":"typescript","code":"const bench4 = metabench(\"nested object transform\", {\n \"mutate nested\"() {\n const copies = freshNestedCopies();\n for (const d of copies) nestedMutate(d);\n },\n \"clone path to transform\"() {\n for (const d of DATA_NESTED) nestedClonePath(d);\n },\n \"JSON deep clone\"() {\n for (const d of DATA_NESTED) nestedDeepClone(d);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":213,"symbol":"copies","kind":"constant","lang":"typescript","code":"const copies = freshNestedCopies();"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":230,"symbol":"DATA_MULTI","kind":"constant","lang":"typescript","code":"const DATA_MULTI = Array.from({ length: 1000 }, () => ({\n firstName: \" JOHN \",\n lastName: \" DOE \",\n email: \" TEST@EXAMPLE.COM \",\n unchanged: 42,\n}));"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":237,"symbol":"toLowerCase","kind":"constant","lang":"typescript","code":"const toLowerCase = (s: string) => s.toLowerCase();"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":239,"symbol":"multiMutate","kind":"function","lang":"typescript","code":"function multiMutate(input: Record): Record {\n input.firstName = trim(input.firstName as string);\n input.lastName = trim(input.lastName as string);\n input.email = toLowerCase(trim(input.email as string));\n return input;\n}"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":246,"symbol":"multiBuildNew","kind":"function","lang":"typescript","code":"function multiBuildNew(input: Record): Record {\n return {\n firstName: trim(input.firstName as string),\n lastName: trim(input.lastName as string),\n email: toLowerCase(trim(input.email as string)),\n unchanged: input.unchanged,\n };\n}"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":255,"symbol":"freshMultiCopies","kind":"constant","lang":"typescript","code":"const freshMultiCopies = () => DATA_MULTI.map((d) => ({ ...d }));"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":258,"symbol":"multiTest","kind":"constant","lang":"typescript","code":"const multiTest = { ...DATA_MULTI[0] };"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":264,"symbol":"bench5","kind":"constant","lang":"typescript","code":"const bench5 = metabench(\"multiple transforms (3 props)\", {\n \"mutate in place\"() {\n const copies = freshMultiCopies();\n for (const d of copies) multiMutate(d);\n },\n \"build new object\"() {\n for (const d of DATA_MULTI) multiBuildNew(d);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-output.ts","line":266,"symbol":"copies","kind":"constant","lang":"typescript","code":"const copies = freshMultiCopies();"} {"repo":"zod","file":"packages/bench/compile-overwrite.ts","line":5,"symbol":"testData","kind":"constant","lang":"typescript","code":"const testData = Array.from({ length: 1000 }, (_, i) => (i % 2 === 0 ? \" HELLO WORLD \" : \" TEST STRING \"));"} {"repo":"zod","file":"packages/bench/compile-overwrite.ts","line":8,"symbol":"withLetReassign","kind":"function","lang":"typescript","doc":"Approach 1: Use let and reassign","code":"function withLetReassign(input: unknown): boolean {\n if (typeof input !== \"string\") return false;\n let v0 = input;\n v0 = v0.trim();\n v0 = v0.toLowerCase();\n if (v0.length < 3) return false;\n return true;\n}"} {"repo":"zod","file":"packages/bench/compile-overwrite.ts","line":18,"symbol":"withConstChain","kind":"function","lang":"typescript","doc":"Approach 2: Create new const for each transform","code":"function withConstChain(input: unknown): boolean {\n if (typeof input !== \"string\") return false;\n const v0 = input;\n const v1 = v0.trim();\n const v2 = v1.toLowerCase();\n if (v2.length < 3) return false;\n return true;\n}"} {"repo":"zod","file":"packages/bench/compile-overwrite.ts","line":20,"symbol":"v0","kind":"constant","lang":"typescript","code":"const v0 = input;"} {"repo":"zod","file":"packages/bench/compile-overwrite.ts","line":21,"symbol":"v1","kind":"constant","lang":"typescript","code":"const v1 = v0.trim();"} {"repo":"zod","file":"packages/bench/compile-overwrite.ts","line":22,"symbol":"v2","kind":"constant","lang":"typescript","code":"const v2 = v1.toLowerCase();"} {"repo":"zod","file":"packages/bench/compile-overwrite.ts","line":28,"symbol":"withInline","kind":"function","lang":"typescript","doc":"Approach 3: Inline transforms (no intermediate vars)","code":"function withInline(input: unknown): boolean {\n if (typeof input !== \"string\") return false;\n if (input.trim().toLowerCase().length < 3) return false;\n return true;\n}"} {"repo":"zod","file":"packages/bench/compile-overwrite.ts","line":41,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"overwrite handling\", {\n \"let with reassign\"() {\n for (const s of testData) withLetReassign(s);\n },\n \"const chain\"() {\n for (const s of testData) withConstChain(s);\n },\n \"inline (no vars)\"() {\n for (const s of testData) withInline(s);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-passthrough.ts","line":8,"symbol":"DATA_SMALL","kind":"constant","lang":"typescript","doc":"Small object (3 props)","code":"const DATA_SMALL = Array.from({ length: 1000 }, () => ({\n name: \"hello\",\n age: 42,\n active: true,\n}));"} {"repo":"zod","file":"packages/bench/compile-passthrough.ts","line":14,"symbol":"smallReturnInput","kind":"function","lang":"typescript","code":"function smallReturnInput(input: Record) {\n if (typeof input !== \"object\") return undefined;\n if (typeof input.name !== \"string\") return undefined;\n if (typeof input.age !== \"number\") return undefined;\n if (typeof input.active !== \"boolean\") return undefined;\n return input;\n}"} {"repo":"zod","file":"packages/bench/compile-passthrough.ts","line":22,"symbol":"smallBuildNew","kind":"function","lang":"typescript","code":"function smallBuildNew(input: Record) {\n if (typeof input !== \"object\") return undefined;\n if (typeof input.name !== \"string\") return undefined;\n if (typeof input.age !== \"number\") return undefined;\n if (typeof input.active !== \"boolean\") return undefined;\n return {\n name: input.name,\n age: input.age,\n active: input.active,\n };\n}"} {"repo":"zod","file":"packages/bench/compile-passthrough.ts","line":34,"symbol":"smallSpread","kind":"function","lang":"typescript","code":"function smallSpread(input: Record) {\n if (typeof input !== \"object\") return undefined;\n if (typeof input.name !== \"string\") return undefined;\n if (typeof input.age !== \"number\") return undefined;\n if (typeof input.active !== \"boolean\") return undefined;\n return { ...input };\n}"} {"repo":"zod","file":"packages/bench/compile-passthrough.ts","line":48,"symbol":"benchSmall","kind":"constant","lang":"typescript","code":"const benchSmall = metabench(\"small object (3 props) - no transform\", {\n \"return input\"() {\n for (const d of DATA_SMALL) smallReturnInput(d);\n },\n \"build new object\"() {\n for (const d of DATA_SMALL) smallBuildNew(d);\n },\n \"spread clone\"() {\n for (const d of DATA_SMALL) smallSpread(d);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-passthrough.ts","line":63,"symbol":"DATA_MEDIUM","kind":"constant","lang":"typescript","doc":"Medium object (10 props)","code":"const DATA_MEDIUM = Array.from({ length: 1000 }, () => ({\n id: \"abc123\",\n name: \"hello\",\n email: \"test@example.com\",\n age: 42,\n score: 99.5,\n active: true,\n verified: false,\n role: \"admin\",\n level: 5,\n count: 100,\n}));"} {"repo":"zod","file":"packages/bench/compile-passthrough.ts","line":76,"symbol":"mediumReturnInput","kind":"function","lang":"typescript","code":"function mediumReturnInput(input: Record) {\n if (typeof input !== \"object\") return undefined;\n if (typeof input.id !== \"string\") return undefined;\n if (typeof input.name !== \"string\") return undefined;\n if (typeof input.email !== \"string\") return undefined;\n if (typeof input.age !== \"number\") return undefined;\n if (typeof input.score !== \"number\") return undefined;\n if (typeof input.active !== \"boolean\") return undefined;\n if (typeof input.verified !== \"boolean\") return undefined;\n if (typeof input.role !== \"string\") return undefined;\n if (typeof input.level !== \"number\") return undefined;\n if (typeof input.count !== \"number\") return undefined;\n return input;\n}"} {"repo":"zod","file":"packages/bench/compile-passthrough.ts","line":91,"symbol":"mediumBuildNew","kind":"function","lang":"typescript","code":"function mediumBuildNew(input: Record) {\n if (typeof input !== \"object\") return undefined;\n if (typeof input.id !== \"string\") return undefined;\n if (typeof input.name !== \"string\") return undefined;\n if (typeof input.email !== \"string\") return undefined;\n if (typeof input.age !== \"number\") return undefined;\n if (typeof input.score !== \"number\") return undefined;\n if (typeof input.active !== \"boolean\") return undefined;\n if (typeof input.verified !== \"boolean\") return undefined;\n if (typeof input.role !== \"string\") return undefined;\n if (typeof input.level !== \"number\") return undefined;\n if (typeof input.count !== \"number\") return undefined;\n return {\n id: input.id,\n name: input.name,\n email: input.email,\n age: input.age,\n score: input.score,\n active: input.active,\n verified: input.verified,\n role: input.role,\n level: input.level,\n count: input.count,\n };\n}"} {"repo":"zod","file":"packages/bench/compile-passthrough.ts","line":117,"symbol":"mediumSpread","kind":"function","lang":"typescript","code":"function mediumSpread(input: Record) {\n if (typeof input !== \"object\") return undefined;\n if (typeof input.id !== \"string\") return undefined;\n if (typeof input.name !== \"string\") return undefined;\n if (typeof input.email !== \"string\") return undefined;\n if (typeof input.age !== \"number\") return undefined;\n if (typeof input.score !== \"number\") return undefined;\n if (typeof input.active !== \"boolean\") return undefined;\n if (typeof input.verified !== \"boolean\") return undefined;\n if (typeof input.role !== \"string\") return undefined;\n if (typeof input.level !== \"number\") return undefined;\n if (typeof input.count !== \"number\") return undefined;\n return { ...input };\n}"} {"repo":"zod","file":"packages/bench/compile-passthrough.ts","line":136,"symbol":"benchMedium","kind":"constant","lang":"typescript","code":"const benchMedium = metabench(\"medium object (10 props) - no transform\", {\n \"return input\"() {\n for (const d of DATA_MEDIUM) mediumReturnInput(d);\n },\n \"build new object\"() {\n for (const d of DATA_MEDIUM) mediumBuildNew(d);\n },\n \"spread clone\"() {\n for (const d of DATA_MEDIUM) mediumSpread(d);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-passthrough.ts","line":151,"symbol":"DATA_LARGE","kind":"constant","lang":"typescript","doc":"Large object (25 props)","code":"const DATA_LARGE = Array.from({ length: 1000 }, () => ({\n id: \"abc123\",\n name: \"hello\",\n email: \"test@example.com\",\n age: 42,\n score: 99.5,\n active: true,\n verified: false,\n role: \"admin\",\n level: 5,\n count: 100,\n firstName: \"John\",\n lastName: \"Doe\",\n phone: \"555-1234\",\n address: \"123 Main St\",\n city: \"Springfield\",\n state: \"IL\",\n zip: \"62701\",\n country: \"USA\",\n company: \"Acme Inc\",\n title: \"Engineer\",\n department: \"R&D\",\n salary: 100000,\n bonus: 10000,\n startDate: \"2020-01-01\",\n endDate: null,\n}));"} {"repo":"zod","file":"packages/bench/compile-passthrough.ts","line":179,"symbol":"largeReturnInput","kind":"function","lang":"typescript","code":"function largeReturnInput(input: Record) {\n if (typeof input !== \"object\") return undefined;\n // Validate all 25 props\n if (typeof input.id !== \"string\") return undefined;\n if (typeof input.name !== \"string\") return undefined;\n if (typeof input.email !== \"string\") return undefined;\n if (typeof input.age !== \"number\") return undefined;\n if (typeof input.score !== \"number\") return undefined;\n if (typeof input.active !== \"boolean\") return undefined;\n if (typeof input.verified !== \"boolean\") return undefined;\n if (typeof input.role !== \"string\") return undefined;\n if (typeof input.level !== \"number\") return undefined;\n if (typeof input.count !== \"number\") return undefined;\n if (typeof input.firstName !== \"string\") return undefined;\n if (typeof input.lastName !== \"string\") return undefined;\n if (typeof input.phone !== \"string\") return undefined;\n if (typeof input.address !== \"string\") return undefined;\n if (typeof input.city !== \"string\") return undefined;\n if (typeof input.state !== \"string\") return undefined;\n if (typeof input.zip !== \"string\") return undefined;\n if (typeof input.country !== \"string\") return undefined;\n if (typeof input.company !="} {"repo":"zod","file":"packages/bench/compile-passthrough.ts","line":210,"symbol":"largeBuildNew","kind":"function","lang":"typescript","code":"function largeBuildNew(input: Record) {\n if (typeof input !== \"object\") return undefined;\n if (typeof input.id !== \"string\") return undefined;\n if (typeof input.name !== \"string\") return undefined;\n if (typeof input.email !== \"string\") return undefined;\n if (typeof input.age !== \"number\") return undefined;\n if (typeof input.score !== \"number\") return undefined;\n if (typeof input.active !== \"boolean\") return undefined;\n if (typeof input.verified !== \"boolean\") return undefined;\n if (typeof input.role !== \"string\") return undefined;\n if (typeof input.level !== \"number\") return undefined;\n if (typeof input.count !== \"number\") return undefined;\n if (typeof input.firstName !== \"string\") return undefined;\n if (typeof input.lastName !== \"string\") return undefined;\n if (typeof input.phone !== \"string\") return undefined;\n if (typeof input.address !== \"string\") return undefined;\n if (typeof input.city !== \"string\") return undefined;\n if (typeof input.state !== \"string\") return undefined;\n if (typeof input.zip !== \"string\") return undefined;\n if (typeof input.country !== \"string\") return undefined;\n if (typeof input.company !== \"string\") return undefined;\n"} {"repo":"zod","file":"packages/bench/compile-passthrough.ts","line":265,"symbol":"largeSpread","kind":"function","lang":"typescript","code":"function largeSpread(input: Record) {\n if (typeof input !== \"object\") return undefined;\n if (typeof input.id !== \"string\") return undefined;\n if (typeof input.name !== \"string\") return undefined;\n if (typeof input.email !== \"string\") return undefined;\n if (typeof input.age !== \"number\") return undefined;\n if (typeof input.score !== \"number\") return undefined;\n if (typeof input.active !== \"boolean\") return undefined;\n if (typeof input.verified !== \"boolean\") return undefined;\n if (typeof input.role !== \"string\") return undefined;\n if (typeof input.level !== \"number\") return undefined;\n if (typeof input.count !== \"number\") return undefined;\n if (typeof input.firstName !== \"string\") return undefined;\n if (typeof input.lastName !== \"string\") return undefined;\n if (typeof input.phone !== \"string\") return undefined;\n if (typeof input.address !== \"string\") return undefined;\n if (typeof input.city !== \"string\") return undefined;\n if (typeof input.state !== \"string\") return undefined;\n if (typeof input.zip !== \"string\") return undefined;\n if (typeof input.country !== \"string\") return undefined;\n if (typeof input.company !== \"string\") return undefined;\n "} {"repo":"zod","file":"packages/bench/compile-passthrough.ts","line":298,"symbol":"benchLarge","kind":"constant","lang":"typescript","code":"const benchLarge = metabench(\"large object (25 props) - no transform\", {\n \"return input\"() {\n for (const d of DATA_LARGE) largeReturnInput(d);\n },\n \"build new object\"() {\n for (const d of DATA_LARGE) largeBuildNew(d);\n },\n \"spread clone\"() {\n for (const d of DATA_LARGE) largeSpread(d);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-scaling.ts","line":4,"symbol":"Row","kind":"type","lang":"typescript","code":"type Row = { label: string; runtime: z.ZodType; input: unknown };"} {"repo":"zod","file":"packages/bench/compile-scaling.ts","line":5,"symbol":"rows","kind":"constant","lang":"typescript","code":"const rows: Row[] = [];"} {"repo":"zod","file":"packages/bench/compile-scaling.ts","line":7,"symbol":"shape","kind":"constant","lang":"typescript","code":"const shape = Object.fromEntries(Array.from({ length: n }, (_, i) => [`k${i}`, z.string()]));"} {"repo":"zod","file":"packages/bench/compile-scaling.ts","line":31,"symbol":"sink","kind":"constant","lang":"typescript","code":"const sink: unknown[] = [];"} {"repo":"zod","file":"packages/bench/compile-scaling.ts","line":32,"symbol":"time","kind":"function","lang":"typescript","code":"function time(fn: () => unknown, iters: number): number {\n let best = Number.POSITIVE_INFINITY;\n for (let r = 0; r < 7; r++) {\n const t = process.hrtime.bigint();\n for (let i = 0; i < iters; i++) sink[i & 7] = fn();\n best = Math.min(best, Number(process.hrtime.bigint() - t));\n }\n return best / iters;\n}"} {"repo":"zod","file":"packages/bench/compile-scaling.ts","line":35,"symbol":"t","kind":"constant","lang":"typescript","code":"const t = process.hrtime.bigint();"} {"repo":"zod","file":"packages/bench/compile-scaling.ts","line":42,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases = rows.map((r) => ({ ...r, compiled: z.compile(r.runtime), inputs: [r.input, structuredClone(r.input)] }));"} {"repo":"zod","file":"packages/bench/compile-scaling.ts","line":50,"symbol":"iters","kind":"constant","lang":"typescript","code":"const iters = 20_000;"} {"repo":"zod","file":"packages/bench/compile-startswith.ts","line":5,"symbol":"PREFIX","kind":"constant","lang":"typescript","code":"const PREFIX = \"hello\";"} {"repo":"zod","file":"packages/bench/compile-startswith.ts","line":8,"symbol":"DATA","kind":"constant","lang":"typescript","doc":"Test data - mix of matching and non-matching strings","code":"const DATA = Array.from({ length: 1000 }, (_, i) => (i % 2 === 0 ? `hello beautiful world` : `goodbye world`));"} {"repo":"zod","file":"packages/bench/compile-startswith.ts","line":11,"symbol":"startsWithNative","kind":"constant","lang":"typescript","doc":"Approach 1: String.prototype.startsWith","code":"const startsWithNative = (s: string) => s.startsWith(PREFIX);"} {"repo":"zod","file":"packages/bench/compile-startswith.ts","line":14,"symbol":"pattern","kind":"constant","lang":"typescript","doc":"Approach 2: Regex pattern","code":"const pattern = new RegExp(`^${PREFIX}.*`);"} {"repo":"zod","file":"packages/bench/compile-startswith.ts","line":15,"symbol":"startsWithRegex","kind":"constant","lang":"typescript","code":"const startsWithRegex = (s: string) => {\n pattern.lastIndex = 0;\n return pattern.test(s);\n};"} {"repo":"zod","file":"packages/bench/compile-startswith.ts","line":21,"symbol":"startsWithSlice","kind":"constant","lang":"typescript","doc":"Approach 3: Slice comparison","code":"const startsWithSlice = (s: string) => s.slice(0, PREFIX.length) === PREFIX;"} {"repo":"zod","file":"packages/bench/compile-startswith.ts","line":24,"symbol":"startsWithSubstring","kind":"constant","lang":"typescript","doc":"Approach 4: Substring comparison","code":"const startsWithSubstring = (s: string) => s.substring(0, PREFIX.length) === PREFIX;"} {"repo":"zod","file":"packages/bench/compile-startswith.ts","line":27,"symbol":"startsWithIndex","kind":"constant","lang":"typescript","doc":"Approach 5: Index check","code":"const startsWithIndex = (s: string) => s.indexOf(PREFIX) === 0;"} {"repo":"zod","file":"packages/bench/compile-startswith.ts","line":38,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"startsWith implementations\", {\n \"String.startsWith()\"() {\n for (const s of DATA) startsWithNative(s);\n },\n \"Regex pattern\"() {\n for (const s of DATA) startsWithRegex(s);\n },\n \"String.slice()\"() {\n for (const s of DATA) startsWithSlice(s);\n },\n \"String.substring()\"() {\n for (const s of DATA) startsWithSubstring(s);\n },\n \"String.indexOf()\"() {\n for (const s of DATA) startsWithIndex(s);\n },\n});"} {"repo":"zod","file":"packages/bench/compile-tuple.ts","line":6,"symbol":"tupleNoRest","kind":"constant","lang":"typescript","doc":"Tuple without rest","code":"const tupleNoRest = z4.tuple([z4.string(), z4.number(), z4.boolean()]);"} {"repo":"zod","file":"packages/bench/compile-tuple.ts","line":7,"symbol":"aotNoRest","kind":"constant","lang":"typescript","code":"const aotNoRest = z4core.compileFn(tupleNoRest, { debug: true });"} {"repo":"zod","file":"packages/bench/compile-tuple.ts","line":10,"symbol":"tupleWithRest","kind":"constant","lang":"typescript","doc":"Tuple with rest","code":"const tupleWithRest = z4.tuple([z4.string(), z4.number()]).rest(z4.boolean());"} {"repo":"zod","file":"packages/bench/compile-tuple.ts","line":11,"symbol":"aotWithRest","kind":"constant","lang":"typescript","code":"const aotWithRest = z4core.compileFn(tupleWithRest, { debug: true });"} {"repo":"zod","file":"packages/bench/compile-tuple.ts","line":14,"symbol":"validNoRest","kind":"constant","lang":"typescript","doc":"Test data","code":"const validNoRest = Array.from({ length: 1000 }, () => [\"hello\", 42, true]);"} {"repo":"zod","file":"packages/bench/compile-tuple.ts","line":15,"symbol":"invalidNoRest","kind":"constant","lang":"typescript","code":"const invalidNoRest = Array.from({ length: 1000 }, () => [\"hello\", \"not a number\", true]);"} {"repo":"zod","file":"packages/bench/compile-tuple.ts","line":17,"symbol":"validWithRest","kind":"constant","lang":"typescript","code":"const validWithRest = Array.from({ length: 1000 }, () => [\"hello\", 42, true, false, true, false]);"} {"repo":"zod","file":"packages/bench/compile-tuple.ts","line":18,"symbol":"invalidWithRest","kind":"constant","lang":"typescript","code":"const invalidWithRest = Array.from({ length: 1000 }, () => [\"hello\", 42, true, false, \"not bool\", false]);"} {"repo":"zod","file":"packages/bench/compile-tuple.ts","line":46,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"tuple benchmarks\", {\n \"no rest (valid) - AOT\"() {\n for (const d of validNoRest) aotNoRest(d);\n },\n \"no rest (valid) - JIT\"() {\n for (const d of validNoRest) tupleNoRest.safeParse(d);\n },\n \"no rest (valid) - non-JIT\"() {\n for (const d of validNoRest) tupleNoRest.safeParse(d, { jitless: true });\n },\n \"with rest (valid) - AOT\"() {\n for (const d of validWithRest) aotWithRest(d);\n },\n \"with rest (valid) - JIT\"() {\n for (const d of validWithRest) tupleWithRest.safeParse(d);\n },\n \"with rest (valid) - non-JIT\"() {\n for (const d of validWithRest) tupleWithRest.safeParse(d, { jitless: true });\n },\n});"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":4,"symbol":"simpleObject","kind":"constant","lang":"typescript","doc":"Test data","code":"const simpleObject = { name: \"Alice\", age: 30 };"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":5,"symbol":"objectWithExtra","kind":"constant","lang":"typescript","code":"const objectWithExtra = { name: \"Alice\", age: 30, extra: true, foo: \"bar\" };"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":6,"symbol":"nestedObject","kind":"constant","lang":"typescript","code":"const nestedObject = {\n user: {\n name: \"Alice\",\n profile: {\n email: \"alice@example.com\",\n settings: { theme: \"dark\", notifications: true },\n },\n },\n};"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":15,"symbol":"smallArray","kind":"constant","lang":"typescript","code":"const smallArray = [1, 2, 3, 4, 5];"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":16,"symbol":"mediumArray","kind":"constant","lang":"typescript","code":"const mediumArray = Array.from({ length: 100 }, (_, i) => i);"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":17,"symbol":"arrayOfObjects","kind":"constant","lang":"typescript","code":"const arrayOfObjects = Array.from({ length: 50 }, (_, i) => ({ id: i, name: `Item ${i}` }));"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":23,"symbol":"validateSimpleObject","kind":"function","lang":"typescript","code":"function validateSimpleObject(input: unknown): boolean {\n if (typeof input !== \"object\" || input === null || Array.isArray(input)) return false;\n const obj = input as Record;\n if (typeof obj.name !== \"string\") return false;\n if (typeof obj.age !== \"number\" || Number.isNaN(obj.age)) return false;\n return true;\n}"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":25,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = input as Record;"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":31,"symbol":"validateNestedObject","kind":"function","lang":"typescript","code":"function validateNestedObject(input: unknown): boolean {\n if (typeof input !== \"object\" || input === null || Array.isArray(input)) return false;\n const obj = input as Record;\n const user = obj.user;\n if (typeof user !== \"object\" || user === null || Array.isArray(user)) return false;\n const userObj = user as Record;\n if (typeof userObj.name !== \"string\") return false;\n const profile = userObj.profile;\n if (typeof profile !== \"object\" || profile === null || Array.isArray(profile)) return false;\n const profileObj = profile as Record;\n if (typeof profileObj.email !== \"string\") return false;\n const settings = profileObj.settings;\n if (typeof settings !== \"object\" || settings === null || Array.isArray(settings)) return false;\n const settingsObj = settings as Record;\n if (typeof settingsObj.theme !== \"string\") return false;\n if (typeof settingsObj.notifications !== \"boolean\") return false;\n return true;\n}"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":33,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = input as Record;"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":34,"symbol":"user","kind":"constant","lang":"typescript","code":"const user = obj.user;"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":36,"symbol":"userObj","kind":"constant","lang":"typescript","code":"const userObj = user as Record;"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":38,"symbol":"profile","kind":"constant","lang":"typescript","code":"const profile = userObj.profile;"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":40,"symbol":"profileObj","kind":"constant","lang":"typescript","code":"const profileObj = profile as Record;"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":42,"symbol":"settings","kind":"constant","lang":"typescript","code":"const settings = profileObj.settings;"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":44,"symbol":"settingsObj","kind":"constant","lang":"typescript","code":"const settingsObj = settings as Record;"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":50,"symbol":"validateNumberArray","kind":"function","lang":"typescript","code":"function validateNumberArray(input: unknown): boolean {\n if (!Array.isArray(input)) return false;\n for (let i = 0; i < input.length; i++) {\n if (typeof input[i] !== \"number\" || Number.isNaN(input[i])) return false;\n }\n return true;\n}"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":58,"symbol":"validateObjectArray","kind":"function","lang":"typescript","code":"function validateObjectArray(input: unknown): boolean {\n if (!Array.isArray(input)) return false;\n for (let i = 0; i < input.length; i++) {\n const item = input[i];\n if (typeof item !== \"object\" || item === null || Array.isArray(item)) return false;\n const obj = item as Record;\n if (typeof obj.id !== \"number\") return false;\n if (typeof obj.name !== \"string\") return false;\n }\n return true;\n}"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":61,"symbol":"item","kind":"constant","lang":"typescript","code":"const item = input[i];"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":63,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = item as Record;"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":74,"symbol":"INVALID","kind":"constant","lang":"typescript","code":"const INVALID = Symbol(\"invalid\");"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":76,"symbol":"parseSimpleObject","kind":"function","lang":"typescript","code":"function parseSimpleObject(input: unknown): { name: string; age: number } | typeof INVALID {\n if (typeof input !== \"object\" || input === null || Array.isArray(input)) return INVALID;\n const obj = input as Record;\n if (typeof obj.name !== \"string\") return INVALID;\n if (typeof obj.age !== \"number\" || Number.isNaN(obj.age)) return INVALID;\n return { name: obj.name, age: obj.age };\n}"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":78,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = input as Record;"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":84,"symbol":"parseNestedObject","kind":"function","lang":"typescript","code":"function parseNestedObject(input: unknown): any | typeof INVALID {\n if (typeof input !== \"object\" || input === null || Array.isArray(input)) return INVALID;\n const obj = input as Record;\n const user = obj.user;\n if (typeof user !== \"object\" || user === null || Array.isArray(user)) return INVALID;\n const userObj = user as Record;\n if (typeof userObj.name !== \"string\") return INVALID;\n const profile = userObj.profile;\n if (typeof profile !== \"object\" || profile === null || Array.isArray(profile)) return INVALID;\n const profileObj = profile as Record;\n if (typeof profileObj.email !== \"string\") return INVALID;\n const settings = profileObj.settings;\n if (typeof settings !== \"object\" || settings === null || Array.isArray(settings)) return INVALID;\n const settingsObj = settings as Record;\n if (typeof settingsObj.theme !== \"string\") return INVALID;\n if (typeof settingsObj.notifications !== \"boolean\") return INVALID;\n return {\n user: {\n name: userObj.name,\n profile: {\n email: profileObj.email,\n settings: {\n theme: settingsObj.theme,\n notifications: settingsObj.not"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":86,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = input as Record;"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":87,"symbol":"user","kind":"constant","lang":"typescript","code":"const user = obj.user;"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":89,"symbol":"userObj","kind":"constant","lang":"typescript","code":"const userObj = user as Record;"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":91,"symbol":"profile","kind":"constant","lang":"typescript","code":"const profile = userObj.profile;"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":93,"symbol":"profileObj","kind":"constant","lang":"typescript","code":"const profileObj = profile as Record;"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":95,"symbol":"settings","kind":"constant","lang":"typescript","code":"const settings = profileObj.settings;"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":97,"symbol":"settingsObj","kind":"constant","lang":"typescript","code":"const settingsObj = settings as Record;"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":114,"symbol":"parseNumberArray","kind":"function","lang":"typescript","code":"function parseNumberArray(input: unknown): number[] | typeof INVALID {\n if (!Array.isArray(input)) return INVALID;\n const result = new Array(input.length);\n for (let i = 0; i < input.length; i++) {\n if (typeof input[i] !== \"number\" || Number.isNaN(input[i])) return INVALID;\n result[i] = input[i];\n }\n return result;\n}"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":116,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = new Array(input.length);"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":124,"symbol":"parseObjectArray","kind":"function","lang":"typescript","code":"function parseObjectArray(input: unknown): Array<{ id: number; name: string }> | typeof INVALID {\n if (!Array.isArray(input)) return INVALID;\n const result = new Array(input.length);\n for (let i = 0; i < input.length; i++) {\n const item = input[i];\n if (typeof item !== \"object\" || item === null || Array.isArray(item)) return INVALID;\n const obj = item as Record;\n if (typeof obj.id !== \"number\") return INVALID;\n if (typeof obj.name !== \"string\") return INVALID;\n result[i] = { id: obj.id, name: obj.name };\n }\n return result;\n}"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":126,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = new Array(input.length);"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":128,"symbol":"item","kind":"constant","lang":"typescript","code":"const item = input[i];"} {"repo":"zod","file":"packages/bench/compile-validate-vs-parse.ts","line":130,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = item as Record;"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":6,"symbol":"caseOrder","kind":"constant","lang":"typescript","code":"const caseOrder = [\"simple\", \"nested\", \"array\", \"array-objects\", \"du\", \"intersection\", \"xor\"] as const;"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":7,"symbol":"BenchmarkCase","kind":"type","lang":"typescript","code":"type BenchmarkCase = (typeof caseOrder)[number];"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":9,"symbol":"caseLabels","kind":"constant","lang":"typescript","code":"const caseLabels: Record = {\n simple: \"simple object\",\n nested: \"nested object\",\n array: \"array of numbers\",\n \"array-objects\": \"array of objects\",\n du: \"discriminated union\",\n intersection: \"intersection\",\n xor: \"xor\",\n};"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":19,"symbol":"caseAliases","kind":"constant","lang":"typescript","code":"const caseAliases: Record = {\n all: \"all\",\n simple: \"simple\",\n nested: \"nested\",\n array: \"array\",\n \"array-objects\": \"array-objects\",\n du: \"du\",\n \"discriminated-union\": \"du\",\n intersection: \"intersection\",\n xor: \"xor\",\n};"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":31,"symbol":"ParsedArgs","kind":"type","lang":"typescript","code":"type ParsedArgs = {\n cases: BenchmarkCase[];\n list: boolean;\n};"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":36,"symbol":"printAvailableCases","kind":"function","lang":"typescript","code":"function printAvailableCases(): void {\n console.log(\"Available benchmark cases:\");\n for (const caseName of caseOrder) {\n const alias = caseName === \"du\" ? \" (alias: discriminated-union)\" : \"\";\n console.log(` ${caseName}${alias} - ${caseLabels[caseName]}`);\n }\n console.log(\" all - run every benchmark case\");\n}"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":39,"symbol":"alias","kind":"constant","lang":"typescript","code":"const alias = caseName === \"du\" ? \" (alias: discriminated-union)\" : \"\";"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":45,"symbol":"parseCaseValue","kind":"function","lang":"typescript","code":"function parseCaseValue(value: string): string[] {\n const cases = value\n .split(\",\")\n .map((caseName) => caseName.trim())\n .filter(Boolean);\n if (cases.length === 0) {\n throw new Error(\"--case requires a non-empty case name\");\n }\n return cases;\n}"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":46,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases = value\n .split(\",\")\n .map((caseName) => caseName.trim())\n .filter(Boolean);"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":56,"symbol":"parseArgs","kind":"function","lang":"typescript","code":"function parseArgs(argv: string[]): ParsedArgs {\n const requestedCases: string[] = [];\n let list = false;\n\n for (let i = 0; i < argv.length; i++) {\n const arg = argv[i];\n if (arg === \"--\") continue;\n if (arg === \"--list\") {\n list = true;\n continue;\n }\n if (arg === \"--case\") {\n const value = argv[++i];\n if (!value || value.startsWith(\"--\")) {\n throw new Error(\"--case requires a value, e.g. --case simple\");\n }\n requestedCases.push(...parseCaseValue(value));\n continue;\n }\n if (arg.startsWith(\"--case=\")) {\n requestedCases.push(...parseCaseValue(arg.slice(\"--case=\".length)));\n continue;\n }\n throw new Error(`Unknown argument \"${arg}\". Use --case or --list.`);\n }\n\n if (requestedCases.length === 0) {\n return { cases: [...caseOrder], list };\n }\n\n const selectedCases = new Set();\n for (const requestedCase of requestedCases) {\n const caseName = caseAliases[requestedCase];\n if (!caseName) {\n throw new Error(`Unknown benchmark case \"${requestedCase}\".`);\n }\n if (caseName === \"all\") {\n return { cases: [...caseOrder], list };\n }\n selectedCases.add(caseName);\n"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":57,"symbol":"requestedCases","kind":"constant","lang":"typescript","code":"const requestedCases: string[] = [];"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":61,"symbol":"arg","kind":"constant","lang":"typescript","code":"const arg = argv[i];"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":68,"symbol":"value","kind":"constant","lang":"typescript","code":"const value = argv[++i];"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":86,"symbol":"selectedCases","kind":"constant","lang":"typescript","code":"const selectedCases = new Set();"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":88,"symbol":"caseName","kind":"constant","lang":"typescript","code":"const caseName = caseAliases[requestedCase];"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":101,"symbol":"parseArgsOrExit","kind":"function","lang":"typescript","code":"function parseArgsOrExit(): ParsedArgs {\n try {\n return parseArgs(process.argv.slice(2));\n } catch (error) {\n console.error(error instanceof Error ? error.message : String(error));\n printAvailableCases();\n process.exit(1);\n }\n}"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":111,"symbol":"parsedArgs","kind":"constant","lang":"typescript","code":"const parsedArgs = parseArgsOrExit();"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":117,"symbol":"selectedCases","kind":"constant","lang":"typescript","code":"const selectedCases = parsedArgs.cases;"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":118,"symbol":"selectedCaseSet","kind":"constant","lang":"typescript","code":"const selectedCaseSet = new Set(selectedCases);"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":128,"symbol":"zodSimple","kind":"constant","lang":"typescript","doc":"Simple object schema","code":"const zodSimple = z.object({\n name: z.string(),\n age: z.number(),\n});"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":133,"symbol":"arktypeSimple","kind":"constant","lang":"typescript","code":"const arktypeSimple = type({\n name: \"string\",\n age: \"number\",\n});"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":139,"symbol":"zodNested","kind":"constant","lang":"typescript","doc":"Nested object schema (matches moltar benchmark)","code":"const zodNested = z.strictObject({\n number: z.number(),\n negNumber: z.number(),\n maxNumber: z.number(),\n string: z.string(),\n longString: z.string(),\n boolean: z.boolean(),\n deeplyNested: z.strictObject({\n foo: z.string(),\n num: z.number(),\n bool: z.boolean(),\n }),\n});"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":153,"symbol":"arktypeNested","kind":"constant","lang":"typescript","code":"const arktypeNested = type({\n number: \"number\",\n negNumber: \"number\",\n maxNumber: \"number\",\n string: \"string\",\n longString: \"string\",\n boolean: \"boolean\",\n deeplyNested: {\n foo: \"string\",\n num: \"number\",\n bool: \"boolean\",\n },\n});"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":168,"symbol":"zodArray","kind":"constant","lang":"typescript","doc":"Array schema","code":"const zodArray = z.array(z.number());"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":169,"symbol":"arktypeArray","kind":"constant","lang":"typescript","code":"const arktypeArray = type(\"number[]\");"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":172,"symbol":"zodArrayOfObjects","kind":"constant","lang":"typescript","doc":"Array of objects","code":"const zodArrayOfObjects = z.array(z.object({ id: z.number(), name: z.string() }));"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":173,"symbol":"arktypeArrayOfObjects","kind":"constant","lang":"typescript","code":"const arktypeArrayOfObjects = type({ id: \"number\", name: \"string\" }).array();"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":176,"symbol":"zodDiscriminated","kind":"constant","lang":"typescript","doc":"Discriminated union","code":"const zodDiscriminated = z.discriminatedUnion(\"kind\", [\n z.object({ kind: z.literal(\"text\"), value: z.string() }),\n z.object({ kind: z.literal(\"count\"), value: z.number() }),\n z.object({ kind: z.literal(\"flag\"), value: z.boolean() }),\n]);"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":182,"symbol":"arktypeDiscriminated","kind":"constant","lang":"typescript","code":"const arktypeDiscriminated = type({\n kind: \"'text'\",\n value: \"string\",\n})\n .or({ kind: \"'count'\", value: \"number\" })\n .or({ kind: \"'flag'\", value: \"boolean\" });"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":190,"symbol":"zodIntersection","kind":"constant","lang":"typescript","doc":"Intersection / deep merge","code":"const zodIntersection = z.intersection(\n z.object({ nested: z.object({ a: z.string() }) }),\n z.object({ nested: z.object({ b: z.number() }) })\n);"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":195,"symbol":"zodXor","kind":"constant","lang":"typescript","code":"const zodXor = z.xor([z.string(), z.number(), z.boolean()]);"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":198,"symbol":"zodSimpleCompiled","kind":"constant","lang":"typescript","doc":"Compiled Zod schemas (public API) + raw fast paths (lower-level primitive)","code":"const zodSimpleCompiled = zcore.compile(zodSimple);"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":199,"symbol":"zodNestedCompiled","kind":"constant","lang":"typescript","code":"const zodNestedCompiled = zcore.compile(zodNested);"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":200,"symbol":"zodArrayCompiled","kind":"constant","lang":"typescript","code":"const zodArrayCompiled = zcore.compile(zodArray);"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":201,"symbol":"zodArrayOfObjectsCompiled","kind":"constant","lang":"typescript","code":"const zodArrayOfObjectsCompiled = zcore.compile(zodArrayOfObjects);"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":202,"symbol":"zodDiscriminatedCompiled","kind":"constant","lang":"typescript","code":"const zodDiscriminatedCompiled = zcore.compile(zodDiscriminated);"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":203,"symbol":"zodIntersectionCompiled","kind":"constant","lang":"typescript","code":"const zodIntersectionCompiled = zcore.compile(zodIntersection);"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":205,"symbol":"zodXorCompiled","kind":"constant","lang":"typescript","doc":"z.xor forces a fallback by design, so compiling it throws. Keep the case runnable: measure the runtime path the fallback would have used.","code":"const zodXorCompiled = (() => {\n try {\n return zcore.compile(zodXor);\n } catch {\n return zodXor;\n }\n})();"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":213,"symbol":"zodSimpleFn","kind":"constant","lang":"typescript","code":"const zodSimpleFn = zcore.compileFn(zodSimple);"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":214,"symbol":"zodNestedFn","kind":"constant","lang":"typescript","code":"const zodNestedFn = zcore.compileFn(zodNested);"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":215,"symbol":"zodArrayFn","kind":"constant","lang":"typescript","code":"const zodArrayFn = zcore.compileFn(zodArray);"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":216,"symbol":"zodArrayOfObjectsFn","kind":"constant","lang":"typescript","code":"const zodArrayOfObjectsFn = zcore.compileFn(zodArrayOfObjects);"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":217,"symbol":"zodDiscriminatedFn","kind":"constant","lang":"typescript","code":"const zodDiscriminatedFn = zcore.compileFn(zodDiscriminated);"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":218,"symbol":"zodIntersectionFn","kind":"constant","lang":"typescript","code":"const zodIntersectionFn = zcore.compileFn(zodIntersection);"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":219,"symbol":"zodXorFn","kind":"constant","lang":"typescript","code":"const zodXorFn = (() => {\n try {\n return zcore.compileFn(zodXor);\n } catch {\n return (d: unknown) => zodXor.safeParse(d);\n }\n})() as any;"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":231,"symbol":"simpleData","kind":"constant","lang":"typescript","code":"const simpleData = { name: \"Alice\", age: 30 };"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":233,"symbol":"nestedData","kind":"constant","lang":"typescript","code":"const nestedData = {\n number: 1,\n negNumber: -1,\n maxNumber: Number.MAX_VALUE,\n string: \"string\",\n longString:\n \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\",\n boolean: true,\n deeplyNested: {\n foo: \"bar\",\n num: 1,\n bool: false,\n },\n};"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":248,"symbol":"arrayData","kind":"constant","lang":"typescript","code":"const arrayData = Array.from({ length: 100 }, (_, i) => i);"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":249,"symbol":"arrayOfObjectsData","kind":"constant","lang":"typescript","code":"const arrayOfObjectsData = Array.from({ length: 50 }, (_, i) => ({ id: i, name: `Item ${i}` }));"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":250,"symbol":"discriminatedData","kind":"constant","lang":"typescript","code":"const discriminatedData = { kind: \"count\", value: 123 };"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":251,"symbol":"intersectionData","kind":"constant","lang":"typescript","code":"const intersectionData = { nested: { a: \"x\", b: 123 } };"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":252,"symbol":"xorData","kind":"constant","lang":"typescript","code":"const xorData = \"hello\";"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":258,"symbol":"INVALID","kind":"constant","lang":"typescript","code":"const INVALID = Symbol(\"invalid\");"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":260,"symbol":"handwrittenSimple","kind":"function","lang":"typescript","code":"function handwrittenSimple(input: unknown): { name: string; age: number } | typeof INVALID {\n if (typeof input !== \"object\" || input === null || Array.isArray(input)) return INVALID;\n const obj = input as Record;\n if (typeof obj.name !== \"string\") return INVALID;\n if (typeof obj.age !== \"number\" || Number.isNaN(obj.age)) return INVALID;\n return { name: obj.name, age: obj.age };\n}"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":262,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = input as Record;"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":268,"symbol":"handwrittenNested","kind":"function","lang":"typescript","code":"function handwrittenNested(input: unknown): any | typeof INVALID {\n if (typeof input !== \"object\" || input === null || Array.isArray(input)) return INVALID;\n const obj = input as Record;\n if (typeof obj.number !== \"number\" || Number.isNaN(obj.number)) return INVALID;\n if (typeof obj.negNumber !== \"number\" || Number.isNaN(obj.negNumber)) return INVALID;\n if (typeof obj.maxNumber !== \"number\" || Number.isNaN(obj.maxNumber)) return INVALID;\n if (typeof obj.string !== \"string\") return INVALID;\n if (typeof obj.longString !== \"string\") return INVALID;\n if (typeof obj.boolean !== \"boolean\") return INVALID;\n const dn = obj.deeplyNested;\n if (typeof dn !== \"object\" || dn === null || Array.isArray(dn)) return INVALID;\n const dnObj = dn as Record;\n if (typeof dnObj.foo !== \"string\") return INVALID;\n if (typeof dnObj.num !== \"number\" || Number.isNaN(dnObj.num)) return INVALID;\n if (typeof dnObj.bool !== \"boolean\") return INVALID;\n return {\n number: obj.number,\n negNumber: obj.negNumber,\n maxNumber: obj.maxNumber,\n string: obj.string,\n longString: obj.longString,\n boolean: obj.boolean,\n deeplyNested: { foo: dnObj.foo, num: dn"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":270,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = input as Record;"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":277,"symbol":"dn","kind":"constant","lang":"typescript","code":"const dn = obj.deeplyNested;"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":279,"symbol":"dnObj","kind":"constant","lang":"typescript","code":"const dnObj = dn as Record;"} {"repo":"zod","file":"packages/bench/compile-vs-arktype.ts","line":294,"symbol":"handwrittenArray","kind":"function","lang":"typescript","code":"function handwrittenArray(input: unknown): number[] | typeof INVALID {\n if (!Array.isArray(input)) return INVALID;\n const result = new Array(input.length);\n for (let i = 0; i < input.length; i++) {\n if (typeof input[i] !== \"number\" || Number.isNaN(input[i])) return INVALID;\n result[i] = input[i];\n }\n return result;\n}"} {"repo":"zod","file":"packages/bench/compile-wrapper-cost.ts","line":13,"symbol":"ERROR","kind":"constant","lang":"typescript","code":"const ERROR = Symbol(\"error\");"} {"repo":"zod","file":"packages/bench/compile-wrapper-cost.ts","line":19,"symbol":"STR_DATA","kind":"constant","lang":"typescript","doc":"----- primitive: string -----","code":"const STR_DATA = Array.from({ length: 1000 }, (_, i) => (i % 7 === 0 ? 42 : \"hello\"));"} {"repo":"zod","file":"packages/bench/compile-wrapper-cost.ts","line":21,"symbol":"strSentinel","kind":"function","lang":"typescript","code":"function strSentinel(input: unknown) {\n if (typeof input !== \"string\") return ERROR;\n return input;\n}"} {"repo":"zod","file":"packages/bench/compile-wrapper-cost.ts","line":26,"symbol":"strTagged","kind":"function","lang":"typescript","code":"function strTagged(input: unknown) {\n if (typeof input !== \"string\") return { success: false as const, error: ERROR };\n return { success: true as const, data: input };\n}"} {"repo":"zod","file":"packages/bench/compile-wrapper-cost.ts","line":31,"symbol":"strPlain","kind":"function","lang":"typescript","code":"function strPlain(input: unknown) {\n if (typeof input !== \"string\") return undefined;\n return input;\n}"} {"repo":"zod","file":"packages/bench/compile-wrapper-cost.ts","line":49,"symbol":"OBJ_DATA","kind":"constant","lang":"typescript","doc":"----- flat object -----","code":"const OBJ_DATA = Array.from({ length: 1000 }, (_, i) =>\n i % 7 === 0 ? null : { name: \"alice\", age: 30, active: true }\n);"} {"repo":"zod","file":"packages/bench/compile-wrapper-cost.ts","line":53,"symbol":"objSentinel","kind":"function","lang":"typescript","code":"function objSentinel(input: any) {\n if (typeof input !== \"object\" || input === null) return ERROR;\n if (typeof input.name !== \"string\") return ERROR;\n if (typeof input.age !== \"number\") return ERROR;\n if (typeof input.active !== \"boolean\") return ERROR;\n return { name: input.name, age: input.age, active: input.active };\n}"} {"repo":"zod","file":"packages/bench/compile-wrapper-cost.ts","line":61,"symbol":"objTagged","kind":"function","lang":"typescript","code":"function objTagged(input: any) {\n if (typeof input !== \"object\" || input === null) return { success: false as const, error: ERROR };\n if (typeof input.name !== \"string\") return { success: false as const, error: ERROR };\n if (typeof input.age !== \"number\") return { success: false as const, error: ERROR };\n if (typeof input.active !== \"boolean\") return { success: false as const, error: ERROR };\n return { success: true as const, data: { name: input.name, age: input.age, active: input.active } };\n}"} {"repo":"zod","file":"packages/bench/compile-wrapper-cost.ts","line":69,"symbol":"objPlain","kind":"function","lang":"typescript","code":"function objPlain(input: any) {\n if (typeof input !== \"object\" || input === null) return undefined;\n if (typeof input.name !== \"string\") return undefined;\n if (typeof input.age !== \"number\") return undefined;\n if (typeof input.active !== \"boolean\") return undefined;\n return { name: input.name, age: input.age, active: input.active };\n}"} {"repo":"zod","file":"packages/bench/compile-wrapper-cost.ts","line":90,"symbol":"NESTED_DATA","kind":"constant","lang":"typescript","doc":"----- nested object -----","code":"const NESTED_DATA = Array.from({ length: 1000 }, (_, i) =>\n i % 7 === 0\n ? null\n : {\n number: 1,\n negNumber: -1,\n maxNumber: Number.MAX_VALUE,\n string: \"hello\",\n longString: \"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\",\n boolean: true,\n deeplyNested: { foo: \"bar\", num: 1, bool: false },\n }\n);"} {"repo":"zod","file":"packages/bench/compile-wrapper-cost.ts","line":104,"symbol":"nestedSentinel","kind":"function","lang":"typescript","code":"function nestedSentinel(input: any) {\n if (typeof input !== \"object\" || input === null) return ERROR;\n if (typeof input.number !== \"number\") return ERROR;\n if (typeof input.negNumber !== \"number\") return ERROR;\n if (typeof input.maxNumber !== \"number\") return ERROR;\n if (typeof input.string !== \"string\") return ERROR;\n if (typeof input.longString !== \"string\") return ERROR;\n if (typeof input.boolean !== \"boolean\") return ERROR;\n const dn = input.deeplyNested;\n if (typeof dn !== \"object\" || dn === null) return ERROR;\n if (typeof dn.foo !== \"string\") return ERROR;\n if (typeof dn.num !== \"number\") return ERROR;\n if (typeof dn.bool !== \"boolean\") return ERROR;\n return {\n number: input.number,\n negNumber: input.negNumber,\n maxNumber: input.maxNumber,\n string: input.string,\n longString: input.longString,\n boolean: input.boolean,\n deeplyNested: { foo: dn.foo, num: dn.num, bool: dn.bool },\n };\n}"} {"repo":"zod","file":"packages/bench/compile-wrapper-cost.ts","line":112,"symbol":"dn","kind":"constant","lang":"typescript","code":"const dn = input.deeplyNested;"} {"repo":"zod","file":"packages/bench/compile-wrapper-cost.ts","line":128,"symbol":"nestedTagged","kind":"function","lang":"typescript","code":"function nestedTagged(input: any) {\n const r = nestedSentinel(input);\n if (r === ERROR) return { success: false as const, error: ERROR };\n return { success: true as const, data: r };\n}"} {"repo":"zod","file":"packages/bench/compile-wrapper-cost.ts","line":129,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = nestedSentinel(input);"} {"repo":"zod","file":"packages/bench/compile-wrapper-cost.ts","line":134,"symbol":"nestedPlain","kind":"function","lang":"typescript","code":"function nestedPlain(input: any) {\n const r = nestedSentinel(input);\n if (r === ERROR) return undefined;\n return r;\n}"} {"repo":"zod","file":"packages/bench/compile-wrapper-cost.ts","line":135,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = nestedSentinel(input);"} {"repo":"zod","file":"packages/bench/compile.ts","line":6,"symbol":"schema","kind":"constant","lang":"typescript","doc":"Schema for benchmarking - same as moltar benchmark","code":"const schema = z4.strictObject({\n number: z4.number(),\n negNumber: z4.number(),\n maxNumber: z4.number(),\n string: z4.string(),\n longString: z4.string(),\n boolean: z4.boolean(),\n deeplyNested: z4.strictObject({\n foo: z4.string(),\n num: z4.number(),\n bool: z4.boolean(),\n }),\n});"} {"repo":"zod","file":"packages/bench/compile.ts","line":21,"symbol":"compiledSchema","kind":"constant","lang":"typescript","doc":"AOT compiled schema (wraps fast path + runtime fallback)","code":"const compiledSchema = z4core.compile(schema);"} {"repo":"zod","file":"packages/bench/compile.ts","line":23,"symbol":"aotValidator","kind":"constant","lang":"typescript","doc":"Raw fast-path function (no fallback wrapper) for direct comparison","code":"const aotValidator = z4core.compileFn(schema);"} {"repo":"zod","file":"packages/bench/compile.ts","line":26,"symbol":"DATA","kind":"constant","lang":"typescript","doc":"Test data","code":"const DATA = Array.from({ length: 1000 }, () =>\n Object.freeze({\n number: 1,\n negNumber: -1,\n maxNumber: Number.MAX_VALUE,\n string: \"string\",\n longString:\n \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Vivendum intellegat et qui, ei denique consequuntur vix. Semper aeterno percipit ut his, sea ex utinam referrentur repudiandae. No epicuri hendrerit consetetur sit, sit dicta adipiscing ex, in facete detracto deterruisset duo. Quot populo ad qui. Sit fugit nostrum et. Ad per diam dicant interesset, lorem iusto sensibus ut sed. No dicam aperiam vis. Pri posse graeco definitiones cu, id eam populo quaestio adipiscing, usu quod malorum te. Ex nam agam veri, dicunt efficiantur ad qui, ad legere adversarium sit. Commune platonem mel id, brute adipiscing duo an. Vivendum inte"} {"repo":"zod","file":"packages/bench/compile.ts","line":51,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"z.compile() vs z.safeParse()\", {\n \"AOT raw fast path\"() {\n for (const d of DATA) aotValidator(d);\n },\n \"Compiled schema.safeParse (wrapped)\"() {\n for (const d of DATA) compiledSchema.safeParse(d);\n },\n \"Zod JIT\"() {\n for (const d of DATA) schema.safeParse(d);\n },\n \"Zod non-JIT\"() {\n for (const d of DATA) schema.safeParse(d, { jitless: true });\n },\n});"} {"repo":"zod","file":"packages/bench/datetime-regex.ts","line":3,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"datetime regex\");"} {"repo":"zod","file":"packages/bench/datetime-regex.ts","line":5,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = \"2021-01-01\";"} {"repo":"zod","file":"packages/bench/datetime-regex.ts","line":6,"symbol":"MONTHS_31","kind":"constant","lang":"typescript","code":"const MONTHS_31 = new Set([1, 3, 5, 7, 8, 10, 12]);"} {"repo":"zod","file":"packages/bench/datetime-regex.ts","line":7,"symbol":"MONTHS_30","kind":"constant","lang":"typescript","code":"const MONTHS_30 = new Set([4, 6, 9, 11]);"} {"repo":"zod","file":"packages/bench/datetime-regex.ts","line":9,"symbol":"simpleDatetimeRegex","kind":"constant","lang":"typescript","code":"const simpleDatetimeRegex = /^(\\d{4})-(\\d{2})-(\\d{2})$/;"} {"repo":"zod","file":"packages/bench/datetime-regex.ts","line":10,"symbol":"datetimeRegexNoLeapYearValidation","kind":"constant","lang":"typescript","code":"const datetimeRegexNoLeapYearValidation =\n /^\\d{4}-((0[13578]|10|12)-31|(0[13-9]|1[0-2])-30|(0[1-9]|1[0-2])-(0[1-9]|1\\d|2\\d))$/;"} {"repo":"zod","file":"packages/bench/datetime-regex.ts","line":12,"symbol":"datetimeRegexWithLeapYearValidation","kind":"constant","lang":"typescript","code":"const datetimeRegexWithLeapYearValidation =\n /^((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))$/;"} {"repo":"zod","file":"packages/bench/datetime-regex.ts","line":29,"symbol":"match","kind":"constant","lang":"typescript","code":"const match = DATA.match(simpleDatetimeRegex);"} {"repo":"zod","file":"packages/bench/datetime-regex.ts","line":33,"symbol":"year","kind":"constant","lang":"typescript","doc":"Extract year, month, and day from the capture groups","code":"const year = Number.parseInt(match[1], 10);"} {"repo":"zod","file":"packages/bench/datetime-regex.ts","line":34,"symbol":"month","kind":"constant","lang":"typescript","code":"const month = Number.parseInt(match[2], 10);"} {"repo":"zod","file":"packages/bench/datetime-regex.ts","line":35,"symbol":"day","kind":"constant","lang":"typescript","code":"const day = Number.parseInt(match[3], 10);"} {"repo":"zod","file":"packages/bench/datetime.ts","line":5,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = makeData(10000, () => new Date().toISOString());"} {"repo":"zod","file":"packages/bench/datetime.ts","line":7,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"z.string().datetime().parse\", {\n zod3() {\n for (const _ of DATA) zod3.parse(_);\n },\n zod4() {\n for (const _ of DATA) zod4.parse(_);\n },\n});"} {"repo":"zod","file":"packages/bench/datetime.ts","line":8,"symbol":"zod3","kind":"method","lang":"typescript","code":"zod3() {\n for (const _ of DATA) zod3.parse(_);\n }"} {"repo":"zod","file":"packages/bench/datetime.ts","line":11,"symbol":"zod4","kind":"method","lang":"typescript","code":"zod4() {\n for (const _ of DATA) zod4.parse(_);\n }"} {"repo":"zod","file":"packages/bench/discriminated-union.ts","line":7,"symbol":"z3fields","kind":"constant","lang":"typescript","code":"const z3fields = {\n data1: z3.string(),\n data2: z3.string(),\n data3: z3.string(),\n // data4: z3.string(),\n // data5: z3.string(),\n // data6: z3.string(),\n // data7: z3.string(),\n // data8: z3.string(),\n // data9: z3.string(),\n // data10: z3.string(),\n};"} {"repo":"zod","file":"packages/bench/discriminated-union.ts","line":19,"symbol":"z3Union","kind":"constant","lang":"typescript","code":"const z3Union = z3.union([\n z3.object({\n type: z3.literal(\"a\"),\n ...z3fields,\n }),\n z3.object({\n type: z3.literal(\"b\"),\n ...z3fields,\n }),\n z3.object({\n type: z3.literal(\"c\"),\n ...z3fields,\n }),\n z3.object({\n type: z3.literal(\"d\"),\n ...z3fields,\n }),\n z3.object({\n type: z3.literal(\"e\"),\n ...z3fields,\n }),\n z3.object({\n type: z3.literal(\"f\"),\n ...z3fields,\n }),\n z3.object({\n type: z3.literal(\"g\"),\n ...z3fields,\n }),\n]);"} {"repo":"zod","file":"packages/bench/discriminated-union.ts","line":50,"symbol":"z3DiscUnion","kind":"constant","lang":"typescript","code":"const z3DiscUnion = z3.discriminatedUnion(\"type\", z3Union._def.options);"} {"repo":"zod","file":"packages/bench/discriminated-union.ts","line":52,"symbol":"makeSchema","kind":"function","lang":"typescript","code":"function makeSchema(z: typeof z4) {\n const z4fields = {\n data1: z.string(),\n data2: z.string(),\n data3: z.string(),\n // data4: z.string(),\n // data5: z.string(),\n // data6: z.string(),\n // data7: z.string(),\n // data8: z.string(),\n // data9: z.string(),\n // data10: z.string(),\n };\n const z4Union = z.union([\n z.object({\n type: z.literal(\"a\"),\n ...z4fields,\n }),\n z.object({\n type: z.literal(\"b\"),\n ...z4fields,\n }),\n z.object({\n type: z.literal(\"c\"),\n ...z4fields,\n }),\n z.object({\n type: z.literal(\"d\"),\n ...z4fields,\n }),\n z.object({\n type: z.literal(\"e\"),\n ...z4fields,\n }),\n z.object({\n type: z.literal(\"f\"),\n ...z4fields,\n }),\n z.object({\n type: z.literal(\"g\"),\n ...z4fields,\n }),\n ]);\n return z4Union;\n}"} {"repo":"zod","file":"packages/bench/discriminated-union.ts","line":53,"symbol":"z4fields","kind":"constant","lang":"typescript","code":"const z4fields = {\n data1: z.string(),\n data2: z.string(),\n data3: z.string(),\n // data4: z.string(),\n // data5: z.string(),\n // data6: z.string(),\n // data7: z.string(),\n // data8: z.string(),\n // data9: z.string(),\n // data10: z.string(),\n };"} {"repo":"zod","file":"packages/bench/discriminated-union.ts","line":65,"symbol":"z4Union","kind":"constant","lang":"typescript","code":"const z4Union = z.union([\n z.object({\n type: z.literal(\"a\"),\n ...z4fields,\n }),\n z.object({\n type: z.literal(\"b\"),\n ...z4fields,\n }),\n z.object({\n type: z.literal(\"c\"),\n ...z4fields,\n }),\n z.object({\n type: z.literal(\"d\"),\n ...z4fields,\n }),\n z.object({\n type: z.literal(\"e\"),\n ...z4fields,\n }),\n z.object({\n type: z.literal(\"f\"),\n ...z4fields,\n }),\n z.object({\n type: z.literal(\"g\"),\n ...z4fields,\n }),\n ]);"} {"repo":"zod","file":"packages/bench/discriminated-union.ts","line":98,"symbol":"z4Union","kind":"constant","lang":"typescript","code":"const z4Union = makeSchema(z4);"} {"repo":"zod","file":"packages/bench/discriminated-union.ts","line":99,"symbol":"z4LibUnion","kind":"constant","lang":"typescript","code":"const z4LibUnion = makeSchema(z4lib as any);"} {"repo":"zod","file":"packages/bench/discriminated-union.ts","line":100,"symbol":"z4LibDiscUnion","kind":"constant","lang":"typescript","code":"const z4LibDiscUnion = z4lib.discriminatedUnion(\"type\", z4LibUnion._def.options as any);"} {"repo":"zod","file":"packages/bench/discriminated-union.ts","line":101,"symbol":"z4DiscUnion","kind":"constant","lang":"typescript","code":"const z4DiscUnion = z4.discriminatedUnion(\"type\", z4Union.def.options);"} {"repo":"zod","file":"packages/bench/discriminated-union.ts","line":103,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = makeData(100, () => ({\n type: randomPick([\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\"]),\n data1: randomString(10),\n data2: randomString(10),\n data3: randomString(10),\n // data4: randomString(10),\n // data5: randomString(10),\n // data6: randomString(10),\n // data7: randomString(10),\n // data8: randomString(10),\n // data9: randomString(10),\n // data10: randomString(10),\n}));"} {"repo":"zod","file":"packages/bench/discriminated-union.ts","line":125,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"z.discriminatedUnion().parse\", {\n // z3() {\n // for (const item of DATA) {\n // z3Union.parse(item);\n // }\n // },\n \"zod 3\"() {\n for (const item of DATA) {\n z3DiscUnion.parse(item);\n }\n },\n // z4() {\n // for (const item of DATA) {\n // z4Union.parse(item);\n // }\n // },\n // z4jitless() {\n // for (const item of DATA) {\n // z4Union.parse(item, args);\n // }\n // },\n \"zod 4 (after)\"() {\n for (const item of DATA) {\n z4DiscUnion.parse(item);\n }\n },\n \"zod 4 (before)\"() {\n for (const item of DATA) {\n z4LibDiscUnion.parse(item);\n }\n },\n});"} {"repo":"zod","file":"packages/bench/error-construction-breakdown.ts","line":14,"symbol":"inst","kind":"constant","lang":"typescript","code":"const inst = z.string();"} {"repo":"zod","file":"packages/bench/error-construction-breakdown.ts","line":15,"symbol":"raw","kind":"constant","lang":"typescript","code":"const raw = () => ({ code: \"invalid_type\", expected: \"string\", input: 42, inst }) as unknown as core.$ZodRawIssue;"} {"repo":"zod","file":"packages/bench/error-construction-breakdown.ts","line":16,"symbol":"ctx","kind":"constant","lang":"typescript","code":"const ctx = { async: false } as core.ParseContextInternal;"} {"repo":"zod","file":"packages/bench/error-construction-breakdown.ts","line":17,"symbol":"finalized","kind":"constant","lang":"typescript","code":"const finalized = util.finalizeIssue(raw(), ctx, core.config());"} {"repo":"zod","file":"packages/bench/error-construction-breakdown.ts","line":18,"symbol":"finalizedList","kind":"constant","lang":"typescript","code":"const finalizedList = [finalized];"} {"repo":"zod","file":"packages/bench/error-construction-breakdown.ts","line":21,"symbol":"sample","kind":"function","lang":"typescript","code":"function sample(fn: () => unknown, iters: number): number {\n globalThis.gc!();\n const t0 = process.hrtime.bigint();\n for (let i = 0; i < iters; i++) if (fn()) sink++;\n return Number(process.hrtime.bigint() - t0) / iters;\n}"} {"repo":"zod","file":"packages/bench/error-construction-breakdown.ts","line":23,"symbol":"t0","kind":"constant","lang":"typescript","code":"const t0 = process.hrtime.bigint();"} {"repo":"zod","file":"packages/bench/error-construction-breakdown.ts","line":29,"symbol":"SKIP","kind":"constant","lang":"typescript","doc":"candidate finalizeIssue bodies, same output: object rest (main before #6567) vs a for-in copy loop; the shipped body walks Object.keys so inherited keys stay out","code":"const SKIP = new Set([\"inst\", \"schema\", \"continue\", \"input\"]);"} {"repo":"zod","file":"packages/bench/error-construction-breakdown.ts","line":30,"symbol":"finalizeLoop","kind":"function","lang":"typescript","code":"function finalizeLoop(iss: any, c: any, cfg: any): any {\n const traits: Set | undefined = iss.inst?._zod?.traits;\n if (traits?.has(\"$ZodType\")) {\n if (traits.has(\"$ZodCheck\")) iss.schema ??= iss.inst;\n else iss.schema = iss.inst;\n }\n const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : undefined;\n const message = iss.message\n ? iss.message\n : (util.unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ??\n util.unwrapMessage(schemaError?.(iss)) ??\n util.unwrapMessage(c?.error?.(iss)) ??\n util.unwrapMessage(cfg.customError?.(iss)) ??\n util.unwrapMessage(cfg.localeError?.(iss)) ??\n \"Invalid input\");\n const out: any = {};\n for (const k in iss) if (!SKIP.has(k)) out[k] = iss[k];\n out.path ??= [];\n out.message = message;\n if (c?.reportInput) out.input = iss.input;\n return out;\n}"} {"repo":"zod","file":"packages/bench/error-construction-breakdown.ts","line":31,"symbol":"traits","kind":"constant","lang":"typescript","code":"const traits: Set | undefined = iss.inst?._zod?.traits;"} {"repo":"zod","file":"packages/bench/error-construction-breakdown.ts","line":36,"symbol":"schemaError","kind":"constant","lang":"typescript","code":"const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : undefined;"} {"repo":"zod","file":"packages/bench/error-construction-breakdown.ts","line":37,"symbol":"message","kind":"constant","lang":"typescript","code":"const message = iss.message\n ? iss.message\n : (util.unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ??\n util.unwrapMessage(schemaError?.(iss)) ??\n util.unwrapMessage(c?.error?.(iss)) ??\n util.unwrapMessage(cfg.customError?.(iss)) ??\n util.unwrapMessage(cfg.localeError?.(iss)) ??\n \"Invalid input\");"} {"repo":"zod","file":"packages/bench/error-construction-breakdown.ts","line":45,"symbol":"out","kind":"constant","lang":"typescript","code":"const out: any = {};"} {"repo":"zod","file":"packages/bench/error-construction-breakdown.ts","line":52,"symbol":"localeError","kind":"constant","lang":"typescript","code":"const localeError = core.config().localeError!;"} {"repo":"zod","file":"packages/bench/error-construction-breakdown.ts","line":54,"symbol":"variants","kind":"constant","lang":"typescript","code":"const variants: Array<[string, () => unknown]> = [\n [\"finalizeIssue: copy loop variant\", () => finalizeLoop(raw(), ctx, core.config())],\n [\"localeError(raw) alone\", () => localeError(raw() as never)],\n [\n \"object rest of a raw issue\",\n () => {\n const { inst: _i, schema: _s, continue: _c, input: _n, ...rest } = raw() as any;\n return rest;\n },\n ],\n [\"finalizeIssue(one raw issue)\", () => util.finalizeIssue(raw(), ctx, core.config())],\n [\"config() alone\", () => core.config()],\n [\"new Error('x')\", () => new Error(\"x\")],\n [\"new core.$ZodRealError([issue])\", () => new core.$ZodRealError(finalizedList)],\n [\"new z.ZodError([issue]) (classic)\", () => new z.ZodError(finalizedList)],\n [\"new z.ZodError + read .issues\", () => new z.ZodError(finalizedList).issues],\n [\"new z.ZodError + read .message\", () => new z.ZodError(finalizedList).message.length],\n [\"safeParse(42).error.issues.length\", () => (inst.safeParse(42) as any).error.issues.length],\n];"} {"repo":"zod","file":"packages/bench/error-construction-breakdown.ts","line":73,"symbol":"ITERS","kind":"constant","lang":"typescript","code":"const ITERS = 300_000;"} {"repo":"zod","file":"packages/bench/error-construction-breakdown.ts","line":74,"symbol":"mins","kind":"constant","lang":"typescript","code":"const mins = new Map();"} {"repo":"zod","file":"packages/bench/error-construction-breakdown.ts","line":78,"symbol":"v","kind":"constant","lang":"typescript","code":"const v = sample(fn, ITERS);"} {"repo":"zod","file":"packages/bench/error-handling.ts","line":7,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z4.object({ a: z4.string() });"} {"repo":"zod","file":"packages/bench/error-handling.ts","line":8,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.object({ a: z.string() });"} {"repo":"zod","file":"packages/bench/error-handling.ts","line":10,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = makeData(10000, () => ({ b: `${Math.random()}` }));"} {"repo":"zod","file":"packages/bench/error-handling.ts","line":12,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"safeparse error\", {\n zod4() {\n for (const _ of DATA) {\n try {\n a.safeParse(_);\n } catch (_e) {\n _e;\n }\n }\n },\n zod4new() {\n for (const _ of DATA) {\n try {\n b.safeParse(_);\n } catch (_e) {\n _e;\n }\n }\n },\n});"} {"repo":"zod","file":"packages/bench/error-handling.ts","line":13,"symbol":"zod4","kind":"method","lang":"typescript","code":"zod4() {\n for (const _ of DATA) {\n try {\n a.safeParse(_);\n } catch (_e) {\n _e;\n }\n }\n }"} {"repo":"zod","file":"packages/bench/error-handling.ts","line":22,"symbol":"zod4new","kind":"method","lang":"typescript","code":"zod4new() {\n for (const _ of DATA) {\n try {\n b.safeParse(_);\n } catch (_e) {\n _e;\n }\n }\n }"} {"repo":"zod","file":"packages/bench/failing-safeparse.ts","line":7,"symbol":"require","kind":"constant","lang":"typescript","doc":"the built 4.4.3 package by absolute path: a bare \"zod443\" import would follow the @zod/source condition into its src, whose bare \"zod/…\" imports resolve to the workspace source and bench 4.5 against itself","code":"const require = createRequire(import.meta.url);"} {"repo":"zod","file":"packages/bench/failing-safeparse.ts","line":8,"symbol":"z44","kind":"constant","lang":"typescript","code":"const z44 = require(path.join(path.dirname(require.resolve(\"zod443/package.json\")), \"index.cjs\"));"} {"repo":"zod","file":"packages/bench/failing-safeparse.ts","line":10,"symbol":"gc","kind":"constant","lang":"typescript","code":"const gc: () => void;"} {"repo":"zod","file":"packages/bench/failing-safeparse.ts","line":19,"symbol":"shape","kind":"constant","lang":"typescript","code":"const shape = (z: any) => z.object({ username: z.string(), bio: z.string(), xp: z.number() });"} {"repo":"zod","file":"packages/bench/failing-safeparse.ts","line":20,"symbol":"P44","kind":"constant","lang":"typescript","code":"const P44 = shape(z44);"} {"repo":"zod","file":"packages/bench/failing-safeparse.ts","line":22,"symbol":"P45","kind":"constant","lang":"typescript","code":"const P45 = shape(z45);"} {"repo":"zod","file":"packages/bench/failing-safeparse.ts","line":23,"symbol":"bad","kind":"constant","lang":"typescript","code":"const bad = { username: 42, bio: \"hello\", xp: 12 };"} {"repo":"zod","file":"packages/bench/failing-safeparse.ts","line":27,"symbol":"N","kind":"constant","lang":"typescript","code":"const N = 200_000;"} {"repo":"zod","file":"packages/bench/failing-safeparse.ts","line":29,"symbol":"time","kind":"constant","lang":"typescript","code":"const time = (schema: any) => {\n gc();\n const t = process.hrtime.bigint();\n for (let i = 0; i < N; i++) sink += schema.safeParse(bad).success ? 1 : 0;\n return Number(process.hrtime.bigint() - t) / N;\n};"} {"repo":"zod","file":"packages/bench/failing-safeparse.ts","line":31,"symbol":"t","kind":"constant","lang":"typescript","code":"const t = process.hrtime.bigint();"} {"repo":"zod","file":"packages/bench/index.ts","line":3,"symbol":"$","kind":"constant","lang":"typescript","code":"const $ = execa({ stdout: \"inherit\", stderr: \"inherit\" });"} {"repo":"zod","file":"packages/bench/index.ts","line":5,"symbol":"run","kind":"function","lang":"typescript","code":"async function run() {\n const files = process.argv[2].split(\",\").map((file) => import.meta.resolve(`./${file}`).replace(\"file://\", \"\"));\n\n for (const file of files) {\n await $`nub --conditions @zod/source ${file}`;\n // await $`nub ${file}`;\n }\n}"} {"repo":"zod","file":"packages/bench/index.ts","line":6,"symbol":"files","kind":"constant","lang":"typescript","code":"const files = process.argv[2].split(\",\").map((file) => import.meta.resolve(`./${file}`).replace(\"file://\", \"\"));"} {"repo":"zod","file":"packages/bench/init.ts","line":6,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = Array.from({ length: 1000 }, () =>\n Object.freeze({\n number: 1,\n negNumber: -1,\n maxNumber: Number.MAX_VALUE,\n string: \"string\",\n longString:\n \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Vivendum intellegat et qui, ei denique consequuntur vix. Semper aeterno percipit ut his, sea ex utinam referrentur repudiandae. No epicuri hendrerit consetetur sit, sit dicta adipiscing ex, in facete detracto deterruisset duo. Quot populo ad qui. Sit fugit nostrum et. Ad per diam dicant interesset, lorem iusto sensibus ut sed. No dicam aperiam vis. Pri posse graeco definitiones cu, id eam populo quaestio adipiscing, usu quod malorum te. Ex nam agam veri, dicunt efficiantur ad qui, ad legere adversarium sit. Commune platonem mel id, brute adipiscing duo an. Vivendum inte"} {"repo":"zod","file":"packages/bench/init.ts","line":23,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"z.object() schema initialization (1000 schemas)\", {\n zod3() {\n const schemas = [];\n for (let i = 0; i < 1000; i++) {\n const z3Schema = z3.strictObject({\n number: z3.number(),\n negNumber: z3.number(),\n maxNumber: z3.number(),\n string: z3.string(),\n longString: z3.string(),\n boolean: z3.boolean(),\n deeplyNested: z3.strictObject({\n foo: z3.string(),\n num: z3.number(),\n bool: z3.boolean(),\n }),\n });\n schemas.push(z3Schema);\n }\n // Use the last schema to avoid dead code elimination\n schemas[999].parse(DATA[0]);\n },\n zod4lib() {\n const schemas = [];\n for (let i = 0; i < 1000; i++) {\n const z4LibSchema = z4lib.strictObject({\n number: z4lib.number(),\n negNumber: z4lib.number(),\n maxNumber: z4lib.number(),\n string: z4lib.string(),\n longString: z4lib.string(),\n boolean: z4lib.boolean(),\n deeplyNested: z4lib.strictObject({\n foo: z4lib.string(),\n num: z4lib.number(),\n bool: z4lib.boolean(),\n }),\n });\n schemas.push(z4LibSchema);\n }\n // Use the last"} {"repo":"zod","file":"packages/bench/init.ts","line":24,"symbol":"zod3","kind":"method","lang":"typescript","code":"zod3() {\n const schemas = [];\n for (let i = 0; i < 1000; i++) {\n const z3Schema = z3.strictObject({\n number: z3.number(),\n negNumber: z3.number(),\n maxNumber: z3.number(),\n string: z3.string(),\n longString: z3.string(),\n boolean: z3.boolean(),\n deeplyNested: z3.strictObject({\n foo: z3.string(),\n num: z3.number(),\n bool: z3.boolean(),\n }),\n });\n schemas.push(z3Schema);\n }\n // Use the last schema to avoid dead code elimination\n schemas[999].parse(DATA[0]);\n }"} {"repo":"zod","file":"packages/bench/init.ts","line":25,"symbol":"schemas","kind":"constant","lang":"typescript","code":"const schemas = [];"} {"repo":"zod","file":"packages/bench/init.ts","line":27,"symbol":"z3Schema","kind":"constant","lang":"typescript","code":"const z3Schema = z3.strictObject({\n number: z3.number(),\n negNumber: z3.number(),\n maxNumber: z3.number(),\n string: z3.string(),\n longString: z3.string(),\n boolean: z3.boolean(),\n deeplyNested: z3.strictObject({\n foo: z3.string(),\n num: z3.number(),\n bool: z3.boolean(),\n }),\n });"} {"repo":"zod","file":"packages/bench/init.ts","line":45,"symbol":"zod4lib","kind":"method","lang":"typescript","code":"zod4lib() {\n const schemas = [];\n for (let i = 0; i < 1000; i++) {\n const z4LibSchema = z4lib.strictObject({\n number: z4lib.number(),\n negNumber: z4lib.number(),\n maxNumber: z4lib.number(),\n string: z4lib.string(),\n longString: z4lib.string(),\n boolean: z4lib.boolean(),\n deeplyNested: z4lib.strictObject({\n foo: z4lib.string(),\n num: z4lib.number(),\n bool: z4lib.boolean(),\n }),\n });\n schemas.push(z4LibSchema);\n }\n // Use the last schema to avoid dead code elimination\n schemas[999].parse(DATA[0]);\n }"} {"repo":"zod","file":"packages/bench/init.ts","line":46,"symbol":"schemas","kind":"constant","lang":"typescript","code":"const schemas = [];"} {"repo":"zod","file":"packages/bench/init.ts","line":48,"symbol":"z4LibSchema","kind":"constant","lang":"typescript","code":"const z4LibSchema = z4lib.strictObject({\n number: z4lib.number(),\n negNumber: z4lib.number(),\n maxNumber: z4lib.number(),\n string: z4lib.string(),\n longString: z4lib.string(),\n boolean: z4lib.boolean(),\n deeplyNested: z4lib.strictObject({\n foo: z4lib.string(),\n num: z4lib.number(),\n bool: z4lib.boolean(),\n }),\n });"} {"repo":"zod","file":"packages/bench/init.ts","line":66,"symbol":"zod4","kind":"method","lang":"typescript","code":"zod4() {\n const schemas = [];\n for (let i = 0; i < 1000; i++) {\n const z4Schema = z4.strictObject({\n number: z4.number(),\n negNumber: z4.number(),\n maxNumber: z4.number(),\n string: z4.string(),\n longString: z4.string(),\n boolean: z4.boolean(),\n deeplyNested: z4.strictObject({\n foo: z4.string(),\n num: z4.number(),\n bool: z4.boolean(),\n }),\n });\n schemas.push(z4Schema);\n }\n // Use the last schema to avoid dead code elimination\n schemas[999].parse(DATA[0]);\n }"} {"repo":"zod","file":"packages/bench/init.ts","line":67,"symbol":"schemas","kind":"constant","lang":"typescript","code":"const schemas = [];"} {"repo":"zod","file":"packages/bench/init.ts","line":69,"symbol":"z4Schema","kind":"constant","lang":"typescript","code":"const z4Schema = z4.strictObject({\n number: z4.number(),\n negNumber: z4.number(),\n maxNumber: z4.number(),\n string: z4.string(),\n longString: z4.string(),\n boolean: z4.boolean(),\n deeplyNested: z4.strictObject({\n foo: z4.string(),\n num: z4.number(),\n bool: z4.boolean(),\n }),\n });"} {"repo":"zod","file":"packages/bench/instanceof.ts","line":4,"symbol":"ZOD_FAILURE","kind":"constant","lang":"typescript","code":"const ZOD_FAILURE = \"_~key~~\";"} {"repo":"zod","file":"packages/bench/instanceof.ts","line":6,"symbol":"ZodFailure","kind":"class","lang":"typescript","code":"class ZodFailure {\n [ZOD_FAILURE] = true;\n tag = ZOD_FAILURE;\n\n constructor(public value: string) {}\n}"} {"repo":"zod","file":"packages/bench/instanceof.ts","line":10,"symbol":"constructor","kind":"method","lang":"typescript","code":"constructor(public value: string) {}"} {"repo":"zod","file":"packages/bench/instanceof.ts","line":13,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = makeData(1000, () => {\n const random = Math.random();\n if (random > 0.75) return new ZodFailure(\"test\");\n if (random > 0.5) return { name: \"Colin\" };\n if (random > 0.25) return \"hello\";\n return Promise.resolve(\"hello\");\n});"} {"repo":"zod","file":"packages/bench/instanceof.ts","line":14,"symbol":"random","kind":"constant","lang":"typescript","code":"const random = Math.random();"} {"repo":"zod","file":"packages/bench/instanceof.ts","line":21,"symbol":"instanceofClass","kind":"constant","lang":"typescript","code":"const instanceofClass = (x: any) => x instanceof ZodFailure;"} {"repo":"zod","file":"packages/bench/instanceof.ts","line":22,"symbol":"instanceofPromise","kind":"constant","lang":"typescript","code":"const instanceofPromise = (x: any) => x instanceof Promise;"} {"repo":"zod","file":"packages/bench/instanceof.ts","line":23,"symbol":"keyin","kind":"constant","lang":"typescript","code":"const keyin = (x: any) => typeof x === \"object\" && x && ZOD_FAILURE in x;"} {"repo":"zod","file":"packages/bench/instanceof.ts","line":25,"symbol":"typeofThenCheckSymbol","kind":"constant","lang":"typescript","doc":"const typeofObject = (x: any) => typeof x === \"object\";","code":"const typeofThenCheckSymbol = (x: any) => typeof x === \"object\" && x?.[ZOD_FAILURE];"} {"repo":"zod","file":"packages/bench/instanceof.ts","line":26,"symbol":"typeofThenCheckTag","kind":"constant","lang":"typescript","code":"const typeofThenCheckTag = (x: any) => typeof x === \"object\" && x?.tag === ZOD_FAILURE;"} {"repo":"zod","file":"packages/bench/instanceof.ts","line":27,"symbol":"instanceofObjectThenCheckSymbol","kind":"constant","lang":"typescript","code":"const instanceofObjectThenCheckSymbol = (x: any) => x instanceof Object && x[ZOD_FAILURE];"} {"repo":"zod","file":"packages/bench/instanceof.ts","line":28,"symbol":"instanceofObjectThenCheckTag","kind":"constant","lang":"typescript","code":"const instanceofObjectThenCheckTag = (x: any) => x instanceof Object && x.tag === ZOD_FAILURE;"} {"repo":"zod","file":"packages/bench/instanceof.ts","line":29,"symbol":"falsyThenCheckTag","kind":"constant","lang":"typescript","code":"const falsyThenCheckTag = (x: any) => x && x.tag === ZOD_FAILURE;"} {"repo":"zod","file":"packages/bench/instanceof.ts","line":30,"symbol":"falsyThenCheckSymbol","kind":"constant","lang":"typescript","code":"const falsyThenCheckSymbol = (x: any) => x?.[ZOD_FAILURE];"} {"repo":"zod","file":"packages/bench/instanceof.ts","line":31,"symbol":"nullChainCheckSymbol","kind":"constant","lang":"typescript","code":"const nullChainCheckSymbol = (x: any) => x?.[ZOD_FAILURE];"} {"repo":"zod","file":"packages/bench/instanceof.ts","line":32,"symbol":"nullChainCheckTag","kind":"constant","lang":"typescript","code":"const nullChainCheckTag = (x: any) => x?.tag === ZOD_FAILURE;"} {"repo":"zod","file":"packages/bench/instanceof.ts","line":34,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"instanceof\")\n .add(\"instanceofClass\", () => {\n for (const _ of DATA) instanceofClass(_);\n })\n .add(\"instanceofPromise\", () => {\n for (const _ of DATA) instanceofPromise(_);\n })\n .add(\"keyin\", () => {\n for (const _ of DATA) keyin(_);\n })\n .add(\"typeofThenCheckSymbol\", () => {\n for (const _ of DATA) typeofThenCheckSymbol(_);\n })\n .add(\"typeofThenCheckTag\", () => {\n for (const _ of DATA) typeofThenCheckTag(_);\n })\n .add(\"instanceofObjectThenCheckSymbol\", () => {\n for (const _ of DATA) instanceofObjectThenCheckSymbol(_);\n })\n .add(\"instanceofObjectThenCheckTag\", () => {\n for (const _ of DATA) instanceofObjectThenCheckTag(_);\n })\n .add(\"falsyThenCheckTag\", () => {\n for (const _ of DATA) falsyThenCheckTag(_);\n })\n .add(\"falsyThenCheckSymbol\", () => {\n for (const _ of DATA) falsyThenCheckSymbol(_);\n })\n .add(\"nullChainCheckSymbol\", () => {\n for (const _ of DATA) nullChainCheckSymbol(_);\n })\n .add(\"nullChainCheckTag\", () => {\n for (const _ of DATA) nullChainCheckTag(_);\n });"} {"repo":"zod","file":"packages/bench/ipv4-regex.ts","line":3,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = \"127.0.0.1\";"} {"repo":"zod","file":"packages/bench/ipv4-regex.ts","line":4,"symbol":"ipv4RegexA","kind":"constant","lang":"typescript","code":"const ipv4RegexA =\n /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;"} {"repo":"zod","file":"packages/bench/ipv4-regex.ts","line":6,"symbol":"ipv4RegexB","kind":"constant","lang":"typescript","code":"const ipv4RegexB =\n /^(?:(?:(?=(25[0-5]))\\1|(?=(2[0-4][0-9]))\\2|(?=(1[0-9]{2}))\\3|(?=([0-9]{1,2}))\\4)\\.){3}(?:(?=(25[0-5]))\\5|(?=(2[0-4][0-9]))\\6|(?=(1[0-9]{2}))\\7|(?=([0-9]{1,2}))\\8)$/;"} {"repo":"zod","file":"packages/bench/ipv4-regex.ts","line":8,"symbol":"ipv4RegexC","kind":"constant","lang":"typescript","code":"const ipv4RegexC = /^(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)$/;"} {"repo":"zod","file":"packages/bench/ipv4-regex.ts","line":9,"symbol":"ipv4RegexD","kind":"constant","lang":"typescript","code":"const ipv4RegexD = /^(\\b25[0-5]|\\b2[0-4][0-9]|\\b[01]?[0-9][0-9]?)(\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/;"} {"repo":"zod","file":"packages/bench/ipv4-regex.ts","line":10,"symbol":"ipv4RegexE","kind":"constant","lang":"typescript","code":"const ipv4RegexE = /^((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.){3}(25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)$/;"} {"repo":"zod","file":"packages/bench/ipv4-regex.ts","line":11,"symbol":"ipv4RegexF","kind":"constant","lang":"typescript","code":"const ipv4RegexF = /^((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}$/;"} {"repo":"zod","file":"packages/bench/ipv4-regex.ts","line":12,"symbol":"ipv4RegexG","kind":"constant","lang":"typescript","code":"const ipv4RegexG = /^((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)(\\.(?!$)|$)){4}$/;"} {"repo":"zod","file":"packages/bench/ipv4-regex.ts","line":13,"symbol":"ipv4RegexH","kind":"constant","lang":"typescript","code":"const ipv4RegexH = /^((25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])(\\.(?!$)|$)){4}$/;"} {"repo":"zod","file":"packages/bench/ipv4-regex.ts","line":14,"symbol":"ipv4RegexI","kind":"constant","lang":"typescript","code":"const ipv4RegexI =\n /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;"} {"repo":"zod","file":"packages/bench/ipv4-regex.ts","line":17,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"ipv4 regex\")\n .add(\"A\", () => {\n return ipv4RegexA.test(DATA);\n })\n .add(\"B\", () => {\n return ipv4RegexB.test(DATA);\n })\n .add(\"C\", () => {\n return ipv4RegexC.test(DATA);\n })\n .add(\"D\", () => {\n return ipv4RegexD.test(DATA);\n })\n .add(\"E\", () => {\n return ipv4RegexE.test(DATA);\n })\n .add(\"F\", () => {\n return ipv4RegexF.test(DATA);\n })\n .add(\"G\", () => {\n return ipv4RegexG.test(DATA);\n })\n .add(\"H\", () => {\n return ipv4RegexH.test(DATA);\n })\n .add(\"I\", () => {\n return ipv4RegexI.test(DATA);\n });"} {"repo":"zod","file":"packages/bench/jit-union.ts","line":6,"symbol":"z4fields","kind":"constant","lang":"typescript","code":"const z4fields = {\n data1: z4.string(),\n data2: z4.string(),\n data3: z4.string(),\n data4: z4.string(),\n data5: z4.string(),\n data6: z4.string(),\n data7: z4.string(),\n data8: z4.string(),\n data9: z4.string(),\n data10: z4.string(),\n};"} {"repo":"zod","file":"packages/bench/jit-union.ts","line":18,"symbol":"z4Union","kind":"constant","lang":"typescript","code":"const z4Union = z4.union([\n z4.object({\n type: z4.literal(\"a\"),\n ...z4fields,\n }),\n z4.object({\n type: z4.literal(\"b\"),\n ...z4fields,\n }),\n z4.object({\n type: z4.literal(\"c\"),\n ...z4fields,\n }),\n z4.object({\n type: z4.literal(\"d\"),\n ...z4fields,\n }),\n z4.object({\n type: z4.literal(\"e\"),\n ...z4fields,\n }),\n z4.object({\n type: z4.literal(\"f\"),\n ...z4fields,\n }),\n z4.object({\n type: z4.literal(\"g\"),\n ...z4fields,\n }),\n]);"} {"repo":"zod","file":"packages/bench/jit-union.ts","line":49,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = makeData(100, () => ({\n type: randomPick([\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\"]),\n data1: randomString(10),\n data2: randomString(10),\n data3: randomString(10),\n data4: randomString(10),\n data5: randomString(10),\n data6: randomString(10),\n data7: randomString(10),\n data8: randomString(10),\n data9: randomString(10),\n data10: randomString(10),\n}));"} {"repo":"zod","file":"packages/bench/jit-union.ts","line":63,"symbol":"args","kind":"constant","lang":"typescript","code":"const args = { jitless: true };"} {"repo":"zod","file":"packages/bench/jit-union.ts","line":66,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"z.discriminatedUnion().parse\", {\n v4_jit() {\n for (const item of DATA) {\n z4Union.parse(item);\n }\n },\n v4_jitless() {\n for (const item of DATA) {\n z4Union.parse(item, args);\n }\n },\n});"} {"repo":"zod","file":"packages/bench/jit-union.ts","line":67,"symbol":"v4_jit","kind":"method","lang":"typescript","code":"v4_jit() {\n for (const item of DATA) {\n z4Union.parse(item);\n }\n }"} {"repo":"zod","file":"packages/bench/jit-union.ts","line":72,"symbol":"v4_jitless","kind":"method","lang":"typescript","code":"v4_jitless() {\n for (const item of DATA) {\n z4Union.parse(item, args);\n }\n }"} {"repo":"zod","file":"packages/bench/key-iteration.ts","line":3,"symbol":"DATA_WITH_SYMBOLS","kind":"constant","lang":"typescript","code":"const DATA_WITH_SYMBOLS = Array.from({ length: 1000 }, () => {\n return {\n [Symbol.for(\"comet\")]: 0,\n str: 0,\n 773: 0,\n 0: 0,\n \"-1\": 0,\n 8: 0,\n \"second str\": 0,\n };\n});"} {"repo":"zod","file":"packages/bench/key-iteration.ts","line":15,"symbol":"DATA_WITHOUT_SYMBOLS","kind":"constant","lang":"typescript","code":"const DATA_WITHOUT_SYMBOLS = Array.from({ length: 1000 }, () => {\n return {\n str: 0,\n 773: 0,\n 0: 0,\n \"-1\": 0,\n 8: 0,\n \"second str\": 0,\n };\n});"} {"repo":"zod","file":"packages/bench/key-iteration.ts","line":27,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"key iteration\", {\n for_in_no_symbols() {\n for (const d of DATA_WITHOUT_SYMBOLS) {\n for (const k in d) _temp = k;\n }\n },\n reflect_no_symbols() {\n for (const d of DATA_WITHOUT_SYMBOLS) {\n for (const k of Reflect.ownKeys(d)) _temp = k;\n }\n },\n for_in_with_symbols() {\n for (const d of DATA_WITH_SYMBOLS) {\n for (const k in d) _temp = k;\n }\n },\n reflect_with_symbols() {\n for (const d of DATA_WITH_SYMBOLS) {\n for (const k of Reflect.ownKeys(d)) _temp = k;\n }\n },\n});"} {"repo":"zod","file":"packages/bench/key-iteration.ts","line":28,"symbol":"for_in_no_symbols","kind":"method","lang":"typescript","code":"for_in_no_symbols() {\n for (const d of DATA_WITHOUT_SYMBOLS) {\n for (const k in d) _temp = k;\n }\n }"} {"repo":"zod","file":"packages/bench/key-iteration.ts","line":33,"symbol":"reflect_no_symbols","kind":"method","lang":"typescript","code":"reflect_no_symbols() {\n for (const d of DATA_WITHOUT_SYMBOLS) {\n for (const k of Reflect.ownKeys(d)) _temp = k;\n }\n }"} {"repo":"zod","file":"packages/bench/key-iteration.ts","line":38,"symbol":"for_in_with_symbols","kind":"method","lang":"typescript","code":"for_in_with_symbols() {\n for (const d of DATA_WITH_SYMBOLS) {\n for (const k in d) _temp = k;\n }\n }"} {"repo":"zod","file":"packages/bench/key-iteration.ts","line":43,"symbol":"reflect_with_symbols","kind":"method","lang":"typescript","code":"reflect_with_symbols() {\n for (const d of DATA_WITH_SYMBOLS) {\n for (const k of Reflect.ownKeys(d)) _temp = k;\n }\n }"} {"repo":"zod","file":"packages/bench/lazy-box.ts","line":4,"symbol":"lazyWithInternalProp","kind":"function","lang":"typescript","code":"function lazyWithInternalProp(getter: () => T) {\n return {\n __value: undefined as T,\n get value() {\n if (this.__value) return this.__value;\n const value = getter();\n this.__value = value;\n return value;\n },\n };\n}"} {"repo":"zod","file":"packages/bench/lazy-box.ts","line":7,"symbol":"value","kind":"method","lang":"typescript","code":"get value() {\n if (this.__value) return this.__value;\n const value = getter();\n this.__value = value;\n return value;\n }"} {"repo":"zod","file":"packages/bench/lazy-box.ts","line":9,"symbol":"value","kind":"constant","lang":"typescript","code":"const value = getter();"} {"repo":"zod","file":"packages/bench/lazy-box.ts","line":16,"symbol":"lazyWithScopeProp","kind":"function","lang":"typescript","code":"function lazyWithScopeProp(getter: () => T): {\n value: T;\n __value?: T;\n} {\n let __value: T;\n return {\n get value() {\n if (__value) return __value;\n const value = getter();\n __value = value;\n return value;\n },\n };\n}"} {"repo":"zod","file":"packages/bench/lazy-box.ts","line":22,"symbol":"value","kind":"method","lang":"typescript","code":"get value() {\n if (__value) return __value;\n const value = getter();\n __value = value;\n return value;\n }"} {"repo":"zod","file":"packages/bench/lazy-box.ts","line":24,"symbol":"value","kind":"constant","lang":"typescript","code":"const value = getter();"} {"repo":"zod","file":"packages/bench/lazy-box.ts","line":31,"symbol":"lazyWithGetterOverride","kind":"function","lang":"typescript","code":"function lazyWithGetterOverride(getter: () => T): {\n value: T;\n} {\n return {\n get value() {\n const value = getter();\n Object.defineProperty(this, \"value\", { value });\n return value;\n },\n };\n}"} {"repo":"zod","file":"packages/bench/lazy-box.ts","line":35,"symbol":"value","kind":"method","lang":"typescript","code":"get value() {\n const value = getter();\n Object.defineProperty(this, \"value\", { value });\n return value;\n }"} {"repo":"zod","file":"packages/bench/lazy-box.ts","line":36,"symbol":"value","kind":"constant","lang":"typescript","code":"const value = getter();"} {"repo":"zod","file":"packages/bench/lazy-box.ts","line":43,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = lazyWithInternalProp(() => randomString(1000));"} {"repo":"zod","file":"packages/bench/lazy-box.ts","line":44,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = lazyWithScopeProp(() => randomString(1000));"} {"repo":"zod","file":"packages/bench/lazy-box.ts","line":45,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = lazyWithGetterOverride(() => randomString(1000));"} {"repo":"zod","file":"packages/bench/lazy-box.ts","line":47,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"lazy box\", {\n internal_prop() {\n a.value;\n },\n scope_prop() {\n b.value;\n },\n getter_override() {\n c.value;\n },\n});"} {"repo":"zod","file":"packages/bench/lazy-box.ts","line":48,"symbol":"internal_prop","kind":"method","lang":"typescript","code":"internal_prop() {\n a.value;\n }"} {"repo":"zod","file":"packages/bench/lazy-box.ts","line":51,"symbol":"scope_prop","kind":"method","lang":"typescript","code":"scope_prop() {\n b.value;\n }"} {"repo":"zod","file":"packages/bench/lazy-box.ts","line":54,"symbol":"getter_override","kind":"method","lang":"typescript","code":"getter_override() {\n c.value;\n }"} {"repo":"zod","file":"packages/bench/libs.ts","line":8,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n a: z.string(),\n b: z.string(),\n c: z.string(),\n});"} {"repo":"zod","file":"packages/bench/libs.ts","line":14,"symbol":"atschema","kind":"constant","lang":"typescript","code":"const atschema = type({\n a: \"string\",\n b: \"string\",\n c: \"string\",\n});"} {"repo":"zod","file":"packages/bench/libs.ts","line":20,"symbol":"vschema","kind":"constant","lang":"typescript","code":"const vschema = v.object({\n a: v.string(),\n b: v.string(),\n c: v.string(),\n});"} {"repo":"zod","file":"packages/bench/libs.ts","line":26,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = makeData(1000, () => ({\n a: randomString(10),\n b: randomString(10),\n c: randomString(10),\n}));"} {"repo":"zod","file":"packages/bench/libs.ts","line":36,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"zod vs arktype\", {\n zod4() {\n for (const _ of DATA) z.parse(schema, _);\n },\n arktype() {\n for (const _ of DATA) atschema(_);\n },\n valibot() {\n for (const _ of DATA) v.parse(vschema, _);\n },\n // baseline() {\n // for (const _ of DATA) {\n // typeof _ === \"object\" &&\n // _ !== null &&\n // typeof _.a === \"string\" &&\n // typeof _.b === \"string\" &&\n // typeof _.c === \"string\";\n // }\n // },\n});"} {"repo":"zod","file":"packages/bench/libs.ts","line":37,"symbol":"zod4","kind":"method","lang":"typescript","code":"zod4() {\n for (const _ of DATA) z.parse(schema, _);\n }"} {"repo":"zod","file":"packages/bench/libs.ts","line":40,"symbol":"arktype","kind":"method","lang":"typescript","code":"arktype() {\n for (const _ of DATA) atschema(_);\n }"} {"repo":"zod","file":"packages/bench/libs.ts","line":43,"symbol":"valibot","kind":"method","lang":"typescript","code":"valibot() {\n for (const _ of DATA) v.parse(vschema, _);\n }"} {"repo":"zod","file":"packages/bench/memory/breakdown.ts","line":5,"symbol":"which","kind":"constant","lang":"typescript","code":"const which = process.argv[2] ?? \"string\";"} {"repo":"zod","file":"packages/bench/memory/breakdown.ts","line":7,"symbol":"factories","kind":"constant","lang":"typescript","code":"const factories: Record unknown> = {\n string: () => z.string(),\n number: () => z.number(),\n \"object-empty\": () => z.object({}),\n \"object-3\": () => z.object({ a: z.string(), b: z.number(), c: z.boolean() }),\n \"string-min\": () => z.string().min(1),\n optional: () => z.string().optional(),\n union: () => z.union([z.string(), z.number()]),\n array: () => z.array(z.string()),\n};"} {"repo":"zod","file":"packages/bench/memory/breakdown.ts","line":18,"symbol":"factory","kind":"constant","lang":"typescript","code":"const factory = factories[which];"} {"repo":"zod","file":"packages/bench/memory/breakdown.ts","line":24,"symbol":"rows","kind":"constant","lang":"typescript","code":"const rows = diffAllocation(factory, 2_000, 8_000);"} {"repo":"zod","file":"packages/bench/memory/breakdown.ts","line":25,"symbol":"total","kind":"constant","lang":"typescript","code":"const total = rows.reduce((sum, r) => sum + r.bytesEach, 0);"} {"repo":"zod","file":"packages/bench/memory/calibrate.ts","line":8,"symbol":"N","kind":"constant","lang":"typescript","code":"const N = 20_000;"} {"repo":"zod","file":"packages/bench/memory/calibrate.ts","line":10,"symbol":"controls","kind":"constant","lang":"typescript","code":"const controls: Array<[string, string, (i: number) => unknown]> = [\n [\"{}\", \"~32 B\", () => ({})],\n [\"{a:1,b:2,c:3}\", \"~56 B\", () => ({ a: 1, b: 2, c: 3 })],\n [\"new Array(10)\", \"~120 B\", () => new Array(10).fill(0)],\n [\"new Set()\", \"~100 B\", () => new Set()],\n [\"new Set(['a','b','c'])\", \"~200 B\", () => new Set([\"a\", \"b\", \"c\"])],\n [\"new Map()\", \"~100 B\", () => new Map()],\n [\"closure over 1 var\", \"~100 B\", (i) => () => i],\n [\"new Uint8Array(1024)\", \"~1088 B\", () => new Uint8Array(1024)],\n [\"10-char string\", \"~40 B\", (i) => `str-${i}-xxxx`.slice(0, 10) + String(i)],\n [\n \"obj w/ getter (defineProperty)\",\n \"~200 B\",\n () => {\n const o: any = {};\n Object.defineProperty(o, \"x\", { get: () => 1, configurable: true });\n return o;\n },\n ],\n];"} {"repo":"zod","file":"packages/bench/memory/calibrate.ts","line":24,"symbol":"o","kind":"constant","lang":"typescript","code":"const o: any = {};"} {"repo":"zod","file":"packages/bench/memory/calibrate.ts","line":35,"symbol":"m","kind":"constant","lang":"typescript","code":"const m = measureStable(label, N, factory, 5);"} {"repo":"zod","file":"packages/bench/memory/compiled-slope.ts","line":6,"symbol":"fiveKey","kind":"constant","lang":"typescript","code":"const fiveKey = (p: string) =>\n z.object({\n [`${p}a`]: z.string(),\n [`${p}b`]: z.number(),\n [`${p}c`]: z.boolean(),\n [`${p}d`]: z.string(),\n [`${p}e`]: z.number(),\n });"} {"repo":"zod","file":"packages/bench/memory/compiled-slope.ts","line":14,"symbol":"nested","kind":"function","lang":"typescript","code":"function nested(depth: number, fanout: number, p: string): z.ZodType {\n if (depth === 0) return z.string();\n const shape: Record = {};\n for (let i = 0; i < fanout; i++) shape[`${p}${i}`] = nested(depth - 1, fanout, p);\n return z.object(shape);\n}"} {"repo":"zod","file":"packages/bench/memory/compiled-slope.ts","line":16,"symbol":"shape","kind":"constant","lang":"typescript","code":"const shape: Record = {};"} {"repo":"zod","file":"packages/bench/memory/compiled-slope.ts","line":20,"symbol":"rejected","kind":"constant","lang":"typescript","code":"const rejected = (schema: z.ZodType) => {\n schema.safeParse(undefined);\n return schema;\n};"} {"repo":"zod","file":"packages/bench/memory/compiled-slope.ts","line":25,"symbol":"hold","kind":"constant","lang":"typescript","code":"const hold: unknown[] = [];"} {"repo":"zod","file":"packages/bench/memory/compiled-slope.ts","line":28,"symbol":"slope","kind":"function","lang":"typescript","code":"function slope(label: string, make: (p: string) => unknown, n: number): void {\n hold.length = 0;\n // warm-up instances absorb the one-time costs\n for (let i = 0; i < 3; i++) hold.push(make(`w${i}_`));\n const before = heapUsed();\n for (let i = 0; i < n; i++) hold.push(make(`m${i}_`));\n const per = (heapUsed() - before) / n;\n console.log(`${label.padEnd(40)} ${fmtBytes(per).padStart(10)} per schema`);\n}"} {"repo":"zod","file":"packages/bench/memory/compiled-slope.ts","line":32,"symbol":"before","kind":"constant","lang":"typescript","code":"const before = heapUsed();"} {"repo":"zod","file":"packages/bench/memory/compiled-slope.ts","line":34,"symbol":"per","kind":"constant","lang":"typescript","code":"const per = (heapUsed() - before) / n;"} {"repo":"zod","file":"packages/bench/memory/dict-mode.ts","line":13,"symbol":"hasFast","kind":"constant","lang":"typescript","doc":"biome-ignore lint/security/noGlobalEval: V8 natives syntax is not valid in a module body.","code":"const hasFast: (o: object) => boolean = eval(\"(o) => %HasFastProperties(o)\");"} {"repo":"zod","file":"packages/bench/memory/dict-mode.ts","line":15,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases: Array<[string, () => any]> = [\n [\"z.string()\", () => z.string()],\n [\"z.number()\", () => z.number()],\n [\"z.boolean()\", () => z.boolean()],\n [\"z.bigint()\", () => z.bigint()],\n [\"z.object({a})\", () => z.object({ a: z.string() })],\n [\"z.array(str)\", () => z.array(z.string())],\n [\"z.string().min(1)\", () => z.string().min(1)],\n [\"z.string().optional()\", () => z.string().optional()],\n [\"z.email()\", () => z.email()],\n [\"z.enum(['a'])\", () => z.enum([\"a\"])],\n];"} {"repo":"zod","file":"packages/bench/memory/dict-mode.ts","line":29,"symbol":"plain","kind":"constant","lang":"typescript","doc":"Reference points so the reader can see what fast/slow looks like.","code":"const plain: any = { a: 1, b: 2 };"} {"repo":"zod","file":"packages/bench/memory/dict-mode.ts","line":30,"symbol":"forcedSlow","kind":"constant","lang":"typescript","code":"const forcedSlow: any = {};"} {"repo":"zod","file":"packages/bench/memory/dict-mode.ts","line":40,"symbol":"s","kind":"constant","lang":"typescript","code":"const s = f();"} {"repo":"zod","file":"packages/bench/memory/dict-mode.ts","line":41,"symbol":"second","kind":"constant","lang":"typescript","code":"const second = f();"} {"repo":"zod","file":"packages/bench/memory/dict-mode.ts","line":56,"symbol":"probes","kind":"constant","lang":"typescript","code":"const probes: Array<[string, (o: any) => void]> = [\n [\n \"plain assignment x25\",\n (o) => {\n for (let i = 0; i < 25; i++) o[`p${i}`] = i;\n },\n ],\n [\n \"defineProperty all-true x25\",\n (o) => {\n for (let i = 0; i < 25; i++)\n Object.defineProperty(o, `p${i}`, { value: i, writable: true, enumerable: true, configurable: true });\n },\n ],\n [\"defineProperty enumerable:false x1\", (o) => Object.defineProperty(o, \"z\", { value: 1, enumerable: false })],\n [\"defineProperty value-only x1\", (o) => Object.defineProperty(o, \"z\", { value: 1 })],\n [\"defineProperty getter x1\", (o) => Object.defineProperty(o, \"z\", { get: () => 1, configurable: true })],\n];"} {"repo":"zod","file":"packages/bench/memory/dict-mode.ts","line":76,"symbol":"o","kind":"constant","lang":"typescript","code":"const o: any = {};"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":6,"symbol":"gc","kind":"constant","lang":"typescript","code":"const gc: (() => void) | undefined;"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":8,"symbol":"collect","kind":"function","lang":"typescript","code":"function collect(): void {\n if (typeof gc !== \"function\") {\n throw new Error(\"run with --expose-gc\");\n }\n // Repeated collections: the first pass frees the bulk, later passes catch objects that only became unreachable once the first pass ran.\n for (let i = 0; i < 6; i++) gc();\n}"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":16,"symbol":"heapUsed","kind":"function","lang":"typescript","code":"function heapUsed(): number {\n collect();\n return process.memoryUsage().heapUsed;\n}"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":21,"symbol":"Measurement","kind":"interface","lang":"typescript","code":"interface Measurement {\n label: string;\n count: number;\n totalBytes: number;\n bytesEach: number;\n}"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":32,"symbol":"measure","kind":"function","lang":"typescript","doc":"Builds `count` instances via `factory`, holds them all live, and reports the retained heap delta. The sink array itself is subtracted out.","code":"function measure(label: string, count: number, factory: (i: number) => unknown): Measurement {\n // Warm up so lazily-initialized module state isn't attributed to the payload.\n factory(0);\n\n const sink: unknown[] = new Array(count);\n const before = heapUsed();\n for (let i = 0; i < count; i++) {\n sink[i] = factory(i);\n }\n const after = heapUsed();\n\n // Keep the sink reachable across the measurement.\n if (sink.length !== count) throw new Error(\"unreachable\");\n\n const arrayOverhead = count * 8;\n const totalBytes = after - before - arrayOverhead;\n return { label, count, totalBytes, bytesEach: totalBytes / count };\n}"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":36,"symbol":"sink","kind":"constant","lang":"typescript","code":"const sink: unknown[] = new Array(count);"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":37,"symbol":"before","kind":"constant","lang":"typescript","code":"const before = heapUsed();"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":41,"symbol":"after","kind":"constant","lang":"typescript","code":"const after = heapUsed();"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":46,"symbol":"arrayOverhead","kind":"constant","lang":"typescript","code":"const arrayOverhead = count * 8;"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":47,"symbol":"totalBytes","kind":"constant","lang":"typescript","code":"const totalBytes = after - before - arrayOverhead;"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":55,"symbol":"measureStable","kind":"function","lang":"typescript","doc":"Median-of-runs variant. Allocation measurements are noisy; taking the median of independent runs keeps a single unlucky GC from dominating the number.","code":"function measureStable(label: string, count: number, factory: (i: number) => unknown, runs = 5): Measurement {\n const samples: number[] = [];\n for (let r = 0; r < runs; r++) {\n samples.push(measure(label, count, factory).bytesEach);\n }\n samples.sort((a, b) => a - b);\n const bytesEach = samples[Math.floor(samples.length / 2)]!;\n return { label, count, totalBytes: bytesEach * count, bytesEach };\n}"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":56,"symbol":"samples","kind":"constant","lang":"typescript","code":"const samples: number[] = [];"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":61,"symbol":"bytesEach","kind":"constant","lang":"typescript","code":"const bytesEach = samples[Math.floor(samples.length / 2)]!;"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":65,"symbol":"fmtBytes","kind":"function","lang":"typescript","code":"function fmtBytes(n: number): string {\n const abs = Math.abs(n);\n if (abs >= 1024 * 1024) return `${(n / 1024 / 1024).toFixed(2)} MB`;\n if (abs >= 1024) return `${(n / 1024).toFixed(1)} KB`;\n return `${n.toFixed(0)} B`;\n}"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":66,"symbol":"abs","kind":"constant","lang":"typescript","code":"const abs = Math.abs(n);"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":72,"symbol":"table","kind":"function","lang":"typescript","code":"function table(rows: Array>): void {\n if (rows.length === 0) return;\n const cols = Object.keys(rows[0]!);\n const widths = cols.map((c) => Math.max(c.length, ...rows.map((r) => String(r[c]).length)));\n const line = (cells: string[]) => cells.map((cell, i) => cell.padEnd(widths[i]!)).join(\" \");\n console.log(line(cols));\n console.log(widths.map((w) => \"-\".repeat(w)).join(\" \"));\n for (const row of rows) {\n console.log(line(cols.map((c) => String(row[c]))));\n }\n}"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":74,"symbol":"cols","kind":"constant","lang":"typescript","code":"const cols = Object.keys(rows[0]!);"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":75,"symbol":"widths","kind":"constant","lang":"typescript","code":"const widths = cols.map((c) => Math.max(c.length, ...rows.map((r) => String(r[c]).length)));"} {"repo":"zod","file":"packages/bench/memory/harness.ts","line":76,"symbol":"line","kind":"constant","lang":"typescript","code":"const line = (cells: string[]) => cells.map((cell, i) => cell.padEnd(widths[i]!)).join(\" \");"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":6,"symbol":"balanced","kind":"constant","lang":"typescript","code":"const balanced = Doc.prototype.indented;"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":7,"symbol":"leaky","kind":"function","lang":"typescript","code":"function leaky(this: Doc, fn: (doc: Doc) => void) {\n this.indent += 1;\n fn(this);\n this.indent -= 1;\n}"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":13,"symbol":"withLeak","kind":"function","lang":"typescript","code":"function withLeak(on: boolean, fn: () => T): T {\n Doc.prototype.indented = on ? (leaky as typeof balanced) : balanced;\n try {\n return fn();\n } finally {\n Doc.prototype.indented = balanced;\n }\n}"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":23,"symbol":"branch","kind":"constant","lang":"typescript","doc":"distinct key names per schema so V8's compilation cache never shares generated source between instances","code":"const branch = (p: string, i: number, islands: number) => {\n const shape: Record = { [`${p}kind`]: z.literal(`${p}k${i}`) };\n for (let j = 0; j < islands; j++) shape[`${p}n${j}`] = z.coerce.number().nullable();\n shape[`${p}tail`] = z.string();\n return z.object(shape);\n};"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":24,"symbol":"shape","kind":"constant","lang":"typescript","code":"const shape: Record = { [`${p}kind`]: z.literal(`${p}k${i}`) };"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":29,"symbol":"union","kind":"constant","lang":"typescript","code":"const union = (p: string, branches: number, islands: number) =>\n z.discriminatedUnion(`${p}kind`, Array.from({ length: branches }, (_, i) => branch(p, i, islands)) as never);"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":33,"symbol":"source","kind":"constant","lang":"typescript","doc":"The `// Constants:` header debug mode prepends is not part of what `new Function` receives.","code":"const source = (schema: z.ZodType) => compileFn(schema, { debug: true }).code!.replace(/^\\/\\/ Constants:.*\\n/, \"\");"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":34,"symbol":"leading","kind":"constant","lang":"typescript","code":"const leading = (code: string) => code.split(\"\\n\").reduce((a, l) => a + (l.length - l.trimStart().length), 0);"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":35,"symbol":"sameModuloIndent","kind":"constant","lang":"typescript","code":"const sameModuloIndent = (a: string, b: string) => {\n const strip = (s: string) => s.replace(/^[ ]+/gm, \"\");\n return strip(a) === strip(b);\n};"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":36,"symbol":"strip","kind":"constant","lang":"typescript","code":"const strip = (s: string) => s.replace(/^[ ]+/gm, \"\");"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":41,"symbol":"retainedMedian","kind":"function","lang":"typescript","doc":"median, not minimum: a heap delta is noisy in BOTH directions — an unrelated collection inside the window makes a pass read low — so the smallest pass is as wrong as the largest. Taking minima put a 39 KB reading on a row whose true retention is ~75 KB.","code":"function retainedMedian(make: (p: string) => z.ZodType, n: number, leak: boolean, passes: number): number {\n const samples = Array.from({ length: passes }, () => retained(make, n, leak)).sort((a, b) => a - b);\n return samples[samples.length >> 1]!;\n}"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":42,"symbol":"samples","kind":"constant","lang":"typescript","code":"const samples = Array.from({ length: passes }, () => retained(make, n, leak)).sort((a, b) => a - b);"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":50,"symbol":"retained","kind":"function","lang":"typescript","doc":"Retained bytes per compiled function: the schemas are built and held before the baseline, so only the compile lands in the delta.","code":"function retained(make: (p: string) => z.ZodType, n: number, leak: boolean): number {\n const schemas = Array.from({ length: n + 2 }, () => make(`m${nsCounter++}_`));\n const hold: unknown[] = [];\n (globalThis as { __hold?: unknown[] }).__hold = hold;\n withLeak(leak, () => {\n for (let i = 0; i < 2; i++) hold.push(compileFn(schemas[i]!)); // warm-up absorbs one-time compiler costs\n });\n const before = heapUsed();\n withLeak(leak, () => {\n for (let i = 2; i < schemas.length; i++) hold.push(compileFn(schemas[i]!));\n });\n const per = (heapUsed() - before) / n;\n if (hold.length !== schemas.length || schemas.length !== n + 2) throw new Error(\"unreachable\");\n hold.length = 0;\n return per;\n}"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":51,"symbol":"schemas","kind":"constant","lang":"typescript","code":"const schemas = Array.from({ length: n + 2 }, () => make(`m${nsCounter++}_`));"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":52,"symbol":"hold","kind":"constant","lang":"typescript","code":"const hold: unknown[] = [];"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":57,"symbol":"before","kind":"constant","lang":"typescript","code":"const before = heapUsed();"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":61,"symbol":"per","kind":"constant","lang":"typescript","code":"const per = (heapUsed() - before) / n;"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":67,"symbol":"PASSES","kind":"constant","lang":"typescript","code":"const PASSES = Number(process.env.PASSES ?? 5);"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":69,"symbol":"CASES","kind":"constant","lang":"typescript","code":"const CASES: Array<{ label: string; branches: number; islands: number; n: number }> = [\n { label: \"162 branches, no islands\", branches: 162, islands: 0, n: 12 },\n { label: \"10 branches, 20 islands\", branches: 10, islands: 2, n: 40 },\n { label: \"25 branches, 50 islands\", branches: 25, islands: 2, n: 24 },\n { label: \"50 branches, 100 islands\", branches: 50, islands: 2, n: 16 },\n { label: \"100 branches, 200 islands\", branches: 100, islands: 2, n: 12 },\n { label: \"162 branches, 324 islands\", branches: 162, islands: 2, n: 10 },\n];"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":79,"symbol":"make","kind":"constant","lang":"typescript","code":"const make = (p: string) => union(p, c.branches, c.islands) as unknown as z.ZodType;"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":80,"symbol":"probe","kind":"constant","lang":"typescript","code":"const probe = make(\"p_\");"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":81,"symbol":"leakedCode","kind":"constant","lang":"typescript","code":"const leakedCode = withLeak(true, () => source(probe));"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":82,"symbol":"fixedCode","kind":"constant","lang":"typescript","code":"const fixedCode = withLeak(false, () => source(probe));"} {"repo":"zod","file":"packages/bench/memory/indent-leak.ts","line":85,"symbol":"row","kind":"constant","lang":"typescript","code":"const row = {\n label: c.label,\n branches: c.branches,\n islands: c.branches * c.islands,\n leakedBytes: leakedCode.length,\n fixedBytes: fixedCode.length,\n leakedLeadingBytes: leading(leakedCode),\n fixedLeadingBytes: leading(fixedCode),\n leakedRetained: Math.round(retainedMedian(make, c.n, true, PASSES)),\n fixedRetained: Math.round(retainedMedian(make, c.n, false, PASSES)),\n };"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":16,"symbol":"Scenario","kind":"interface","lang":"typescript","code":"interface Scenario {\n label: string;\n /** Must leave nothing reachable behind. */\n run: (i: number) => void;\n /** Known-leaky scenarios we assert ON, to prove the detector works. */\n expectLeak?: boolean;\n}"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":24,"symbol":"scenarios","kind":"constant","lang":"typescript","code":"const scenarios: Scenario[] = [\n // --- controls: these MUST show a leak, proving the detector is sensitive ---\n {\n label: \"CONTROL: push to module array\",\n run: (i) => void leakSink.push(z.string().min(i % 5)),\n expectLeak: true,\n },\n {\n label: \"CONTROL: no-op\",\n run: () => {},\n },\n\n // --- schema construction, all references dropped ---\n { label: \"z.string()\", run: () => void z.string() },\n { label: \"z.string().min(1)\", run: () => void z.string().min(1) },\n { label: \"z.object({...})\", run: () => void z.object({ a: z.string(), b: z.number() }) },\n { label: \"z.object().extend()\", run: () => void z.object({ a: z.string() }).extend({ b: z.number() }) },\n { label: \"z.object().partial()\", run: () => void z.object({ a: z.string() }).partial() },\n {\n label: \"z.discriminatedUnion\",\n run: () => void z.discriminatedUnion(\"t\", [z.object({ t: z.literal(\"a\") }), z.object({ t: z.literal(\"b\") })]),\n },\n {\n label: \"z.lazy recursive\",\n run: () => {\n const s: any = z.lazy(() => z.object({ v: z.string(), next: s.optional() }));\n void s.safeParse({ v: \"x\", next: { v: \"y\" } });\n },\n },\n\n // --- registry / metadata ---\n { label: \".describe()\", ru"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":49,"symbol":"s","kind":"constant","lang":"typescript","code":"const s: any = z.lazy(() => z.object({ v: z.string(), next: s.optional() }));"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":85,"symbol":"leakSink","kind":"constant","lang":"typescript","code":"const leakSink: unknown[] = [];"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":86,"symbol":"localRegistry","kind":"constant","lang":"typescript","code":"const localRegistry = z.registry<{ id: string }>();"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":87,"symbol":"bigSchema","kind":"constant","lang":"typescript","code":"const bigSchema = z.object({\n s: z.string(),\n n: z.number(),\n arr: z.array(z.string()),\n nested: z.object({ deep: z.object({ deeper: z.string() }) }),\n});"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":93,"symbol":"refined","kind":"constant","lang":"typescript","code":"const refined = z.string().refine((s) => s.length > 1000, \"too short\");"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":95,"symbol":"makeBig","kind":"function","lang":"typescript","code":"function makeBig(i: number) {\n return {\n s: `string-value-${i}`,\n n: i,\n arr: Array.from({ length: 20 }, (_, k) => `item-${i}-${k}-padding-padding-padding`),\n nested: { deep: { deeper: `deep-${i}` } },\n };\n}"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":104,"symbol":"heapAfter","kind":"function","lang":"typescript","code":"function heapAfter(run: (i: number) => void, iterations: number, offset: number): number {\n for (let i = 0; i < iterations; i++) run(offset + i);\n collect();\n return process.memoryUsage().heapUsed;\n}"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":110,"symbol":"SMALL","kind":"constant","lang":"typescript","code":"const SMALL = 2_000;"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":111,"symbol":"LARGE","kind":"constant","lang":"typescript","code":"const LARGE = 10_000;"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":113,"symbol":"rows","kind":"constant","lang":"typescript","code":"const rows = scenarios.map((s) => {\n // Warm everything (lazy prototype installs, JIT compilation) so one-time costs land before the first measurement.\n for (let i = 0; i < 500; i++) s.run(i);\n collect();\n\n const base = process.memoryUsage().heapUsed;\n const afterSmall = heapAfter(s.run, SMALL, 1_000_000);\n const afterLarge = heapAfter(s.run, LARGE, 2_000_000);\n\n // Bytes retained per iteration, from the slope between the two batches. Using the slope cancels any fixed cost captured in `base`.\n const slope = (afterLarge - afterSmall) / LARGE;\n const totalGrowth = afterLarge - base;\n const leaking = slope > 24; // below ~1 pointer/iteration is noise\n\n return {\n scenario: s.label,\n \"bytes/iter\": slope.toFixed(1),\n \"total growth\": fmtBytes(totalGrowth),\n verdict: leaking ? \"LEAK\" : \"ok\",\n expected: s.expectLeak ? \"leak\" : \"ok\",\n agree: leaking === !!s.expectLeak ? \"\" : \" <-- MISMATCH\",\n };\n});"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":118,"symbol":"base","kind":"constant","lang":"typescript","code":"const base = process.memoryUsage().heapUsed;"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":119,"symbol":"afterSmall","kind":"constant","lang":"typescript","code":"const afterSmall = heapAfter(s.run, SMALL, 1_000_000);"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":120,"symbol":"afterLarge","kind":"constant","lang":"typescript","code":"const afterLarge = heapAfter(s.run, LARGE, 2_000_000);"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":123,"symbol":"slope","kind":"constant","lang":"typescript","doc":"Bytes retained per iteration, from the slope between the two batches. Using the slope cancels any fixed cost captured in `base`.","code":"const slope = (afterLarge - afterSmall) / LARGE;"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":124,"symbol":"totalGrowth","kind":"constant","lang":"typescript","code":"const totalGrowth = afterLarge - base;"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":125,"symbol":"leaking","kind":"constant","lang":"typescript","code":"const leaking = slope > 24;"} {"repo":"zod","file":"packages/bench/memory/leaks.ts","line":139,"symbol":"mismatches","kind":"constant","lang":"typescript","code":"const mismatches = rows.filter((r) => r.agree !== \"\");"} {"repo":"zod","file":"packages/bench/memory/own-props.ts","line":9,"symbol":"describe","kind":"function","lang":"typescript","code":"function describe(label: string, a: any, b: any): void {\n const report: Array<{ where: string; key: string; kind: string; perInstance: string }> = [];\n\n for (const [where, objA, objB] of [\n [\"inst\", a, b],\n [\"_zod\", a._zod, b._zod],\n ] as const) {\n for (const key of Reflect.ownKeys(objA)) {\n const d = Object.getOwnPropertyDescriptor(objA, key)!;\n const dB = Object.getOwnPropertyDescriptor(objB, key);\n let kind: string;\n let perInstance: string;\n if (d.get || d.set) {\n kind = `accessor${d.get ? \" get\" : \"\"}${d.set ? \" set\" : \"\"}`;\n // Accessor pairs defined per-instance are distinct function objects.\n perInstance = dB && (d.get !== dB.get || d.set !== dB.set) ? \"YES\" : \"no\";\n } else {\n const v = d.value;\n kind = typeof v === \"function\" ? \"function\" : Array.isArray(v) ? `array[${v.length}]` : typeof v;\n perInstance = dB && typeof v === \"object\" && v !== null ? (v !== dB.value ? \"YES\" : \"no\") : \"\";\n if (typeof v === \"function\") perInstance = dB && v !== dB.value ? \"YES\" : \"no\";\n }\n report.push({ where, key: String(key), kind, perInstance });\n }\n }\n\n const closures = report.filter("} {"repo":"zod","file":"packages/bench/memory/own-props.ts","line":10,"symbol":"report","kind":"constant","lang":"typescript","code":"const report: Array<{ where: string; key: string; kind: string; perInstance: string }> = [];"} {"repo":"zod","file":"packages/bench/memory/own-props.ts","line":17,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = Object.getOwnPropertyDescriptor(objA, key)!;"} {"repo":"zod","file":"packages/bench/memory/own-props.ts","line":18,"symbol":"dB","kind":"constant","lang":"typescript","code":"const dB = Object.getOwnPropertyDescriptor(objB, key);"} {"repo":"zod","file":"packages/bench/memory/own-props.ts","line":26,"symbol":"v","kind":"constant","lang":"typescript","code":"const v = d.value;"} {"repo":"zod","file":"packages/bench/memory/own-props.ts","line":35,"symbol":"closures","kind":"constant","lang":"typescript","code":"const closures = report.filter(\n (r) => (r.kind === \"function\" || r.kind.startsWith(\"accessor\")) && r.perInstance === \"YES\"\n );"} {"repo":"zod","file":"packages/bench/memory/own-props.ts","line":38,"symbol":"objects","kind":"constant","lang":"typescript","code":"const objects = report.filter((r) => r.kind === \"object\" && r.perInstance === \"YES\");"} {"repo":"zod","file":"packages/bench/memory/prop-arrays.ts","line":11,"symbol":"which","kind":"constant","lang":"typescript","code":"const which = process.argv[2] ?? \"string\";"} {"repo":"zod","file":"packages/bench/memory/prop-arrays.ts","line":12,"symbol":"factories","kind":"constant","lang":"typescript","code":"const factories: Record unknown> = {\n string: () => z.string(),\n \"string-min\": () => z.string().min(1),\n \"object-3\": () => z.object({ a: z.string(), b: z.number(), c: z.boolean() }),\n number: () => z.number(),\n};"} {"repo":"zod","file":"packages/bench/memory/prop-arrays.ts","line":19,"symbol":"N","kind":"constant","lang":"typescript","code":"const N = 5_000;"} {"repo":"zod","file":"packages/bench/memory/prop-arrays.ts","line":20,"symbol":"sink","kind":"constant","lang":"typescript","code":"const sink: unknown[] = [];"} {"repo":"zod","file":"packages/bench/memory/prop-arrays.ts","line":23,"symbol":"file","kind":"constant","lang":"typescript","code":"const file = snapshotNow(\"props\");"} {"repo":"zod","file":"packages/bench/memory/prop-arrays.ts","line":24,"symbol":"g","kind":"constant","lang":"typescript","code":"const g = loadGraph(file);"} {"repo":"zod","file":"packages/bench/memory/prop-arrays.ts","line":27,"symbol":"byOwner","kind":"constant","lang":"typescript","doc":"For every node that owns an \"(object properties)\" child, record the owner's kind and the child's size.","code":"const byOwner = new Map();"} {"repo":"zod","file":"packages/bench/memory/prop-arrays.ts","line":31,"symbol":"child","kind":"constant","lang":"typescript","code":"const child = e.to;"} {"repo":"zod","file":"packages/bench/memory/prop-arrays.ts","line":33,"symbol":"key","kind":"constant","lang":"typescript","code":"const key = `${g.type(i)}::${g.name(i)}`;"} {"repo":"zod","file":"packages/bench/memory/prop-arrays.ts","line":44,"symbol":"rows","kind":"constant","lang":"typescript","code":"const rows = [...byOwner.entries()]\n .map(([owner, r]) => ({\n owner,\n count: r.count,\n \"per schema\": (r.count / N).toFixed(2),\n \"total bytes\": r.bytes,\n \"avg size\": fmtBytes(r.bytes / r.count),\n \"bytes/schema\": (r.bytes / N).toFixed(0),\n }))\n .filter((r) => r.count >= N * 0.2)\n .sort((a, b) => Number(b[\"bytes/schema\"]) - Number(a[\"bytes/schema\"]));"} {"repo":"zod","file":"packages/bench/memory/prop-slack.ts","line":10,"symbol":"Empty","kind":"function","lang":"typescript","doc":"A constructor that assigns nothing, so V8 infers zero in-object slots and every property lands in a growable backing store — same as $constructor.","code":"function Empty(this: any) {}"} {"repo":"zod","file":"packages/bench/memory/prop-slack.ts","line":12,"symbol":"withProps","kind":"function","lang":"typescript","code":"function withProps(n: number): () => unknown {\n return () => {\n const o: any = new (Empty as any)();\n for (let i = 0; i < n; i++) o[`p${i}`] = i;\n return o;\n };\n}"} {"repo":"zod","file":"packages/bench/memory/prop-slack.ts","line":14,"symbol":"o","kind":"constant","lang":"typescript","code":"const o: any = new (Empty as any)();"} {"repo":"zod","file":"packages/bench/memory/prop-slack.ts","line":21,"symbol":"literalProps","kind":"function","lang":"typescript","doc":"Same, but properties defined all at once from a literal (fast path).","code":"function literalProps(n: number): () => unknown {\n const keys = Array.from({ length: n }, (_, i) => `p${i}`);\n return () => {\n const o: any = {};\n for (const k of keys) o[k] = 0;\n return o;\n };\n}"} {"repo":"zod","file":"packages/bench/memory/prop-slack.ts","line":22,"symbol":"keys","kind":"constant","lang":"typescript","code":"const keys = Array.from({ length: n }, (_, i) => `p${i}`);"} {"repo":"zod","file":"packages/bench/memory/prop-slack.ts","line":24,"symbol":"o","kind":"constant","lang":"typescript","code":"const o: any = {};"} {"repo":"zod","file":"packages/bench/memory/prop-slack.ts","line":30,"symbol":"counts","kind":"constant","lang":"typescript","code":"const counts = [0, 4, 8, 12, 16, 20, 23, 25, 30, 40];"} {"repo":"zod","file":"packages/bench/memory/prop-slack.ts","line":34,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = measureStable(`ctor+${n}`, 20_000, withProps(n), 5);"} {"repo":"zod","file":"packages/bench/memory/prop-slack.ts","line":35,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = measureStable(`lit+${n}`, 20_000, literalProps(n), 5);"} {"repo":"zod","file":"packages/bench/memory/realworld.ts","line":11,"symbol":"makeResource","kind":"function","lang":"typescript","doc":"One \"resource\" the way an API codebase tends to define them.","code":"function makeResource(i: number) {\n const Address = z.object({\n street: z.string().min(1).max(200),\n city: z.string().min(1),\n postalCode: z.string().regex(/^\\d{5}$/),\n country: z.string().length(2),\n });\n\n const Contact = z.object({\n email: z.email(),\n phone: z.string().optional(),\n address: Address.optional(),\n });\n\n const Status = z.enum([\"active\", \"pending\", \"archived\", \"deleted\"]);\n\n const Event = z.discriminatedUnion(\"kind\", [\n z.object({ kind: z.literal(\"created\"), at: z.iso.datetime(), by: z.uuid() }),\n z.object({ kind: z.literal(\"updated\"), at: z.iso.datetime(), fields: z.array(z.string()) }),\n z.object({ kind: z.literal(\"deleted\"), at: z.iso.datetime(), reason: z.string().nullable() }),\n ]);\n\n return z\n .object({\n id: z.uuid(),\n slug: z.string().regex(/^[a-z0-9-]+$/),\n title: z.string().min(1).max(300),\n description: z.string().max(5000).optional(),\n status: Status,\n count: z.number().int().nonnegative(),\n score: z.number().min(0).max(100),\n tags: z.array(z.string().min(1)).max(50),\n contact: Contact,\n history: z.array(Event),\n metadata: z.record(z.string(), z.unknown()).option"} {"repo":"zod","file":"packages/bench/memory/realworld.ts","line":12,"symbol":"Address","kind":"constant","lang":"typescript","code":"const Address = z.object({\n street: z.string().min(1).max(200),\n city: z.string().min(1),\n postalCode: z.string().regex(/^\\d{5}$/),\n country: z.string().length(2),\n });"} {"repo":"zod","file":"packages/bench/memory/realworld.ts","line":19,"symbol":"Contact","kind":"constant","lang":"typescript","code":"const Contact = z.object({\n email: z.email(),\n phone: z.string().optional(),\n address: Address.optional(),\n });"} {"repo":"zod","file":"packages/bench/memory/realworld.ts","line":25,"symbol":"Status","kind":"constant","lang":"typescript","code":"const Status = z.enum([\"active\", \"pending\", \"archived\", \"deleted\"]);"} {"repo":"zod","file":"packages/bench/memory/realworld.ts","line":27,"symbol":"Event","kind":"constant","lang":"typescript","code":"const Event = z.discriminatedUnion(\"kind\", [\n z.object({ kind: z.literal(\"created\"), at: z.iso.datetime(), by: z.uuid() }),\n z.object({ kind: z.literal(\"updated\"), at: z.iso.datetime(), fields: z.array(z.string()) }),\n z.object({ kind: z.literal(\"deleted\"), at: z.iso.datetime(), reason: z.string().nullable() }),\n ]);"} {"repo":"zod","file":"packages/bench/memory/realworld.ts","line":52,"symbol":"COUNTS","kind":"constant","lang":"typescript","code":"const COUNTS = [50, 200, 500];"} {"repo":"zod","file":"packages/bench/memory/realworld.ts","line":54,"symbol":"rows","kind":"constant","lang":"typescript","code":"const rows = COUNTS.map((n) => {\n // Warm the lazily-installed prototypes so they aren't billed to the payload.\n makeResource(-1);\n collect();\n const before = process.memoryUsage().heapUsed;\n\n const catalogue: unknown[] = [];\n for (let i = 0; i < n; i++) catalogue.push(makeResource(i));\n\n collect();\n const after = process.memoryUsage().heapUsed;\n if (catalogue.length !== n) throw new Error(\"unreachable\");\n\n return {\n \"resource schemas\": n,\n \"heap held\": fmtBytes(after - before),\n \"per resource\": fmtBytes((after - before) / n),\n bytes: (after - before).toFixed(0),\n };\n});"} {"repo":"zod","file":"packages/bench/memory/realworld.ts","line":58,"symbol":"before","kind":"constant","lang":"typescript","code":"const before = process.memoryUsage().heapUsed;"} {"repo":"zod","file":"packages/bench/memory/realworld.ts","line":60,"symbol":"catalogue","kind":"constant","lang":"typescript","code":"const catalogue: unknown[] = [];"} {"repo":"zod","file":"packages/bench/memory/realworld.ts","line":64,"symbol":"after","kind":"constant","lang":"typescript","code":"const after = process.memoryUsage().heapUsed;"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":13,"symbol":"gc","kind":"constant","lang":"typescript","code":"const gc: (() => void) | undefined;"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":15,"symbol":"RawSnapshot","kind":"interface","lang":"typescript","code":"interface RawSnapshot {\n snapshot: {\n meta: { node_fields: string[]; node_types: (string[] | string)[]; edge_fields: string[]; edge_types: string[][] };\n node_count: number;\n edge_count: number;\n };\n nodes: number[];\n edges: number[];\n strings: string[];\n}"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":26,"symbol":"Graph","kind":"interface","lang":"typescript","code":"interface Graph {\n count: number;\n type: (i: number) => string;\n name: (i: number) => string;\n selfSize: (i: number) => number;\n /** [toNodeIndex, edgeType, edgeNameOrIndex][] */\n edgesOf: (i: number) => Array<{ to: number; type: string; name: string }>;\n}"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":35,"symbol":"loadGraph","kind":"function","lang":"typescript","code":"function loadGraph(file: string): Graph {\n const snap: RawSnapshot = JSON.parse(fs.readFileSync(file, \"utf8\"));\n const meta = snap.snapshot.meta;\n const nf = meta.node_fields;\n const ef = meta.edge_fields;\n const nStride = nf.length;\n const eStride = ef.length;\n\n const nTypeIdx = nf.indexOf(\"type\");\n const nNameIdx = nf.indexOf(\"name\");\n const nSizeIdx = nf.indexOf(\"self_size\");\n const nEdgeCountIdx = nf.indexOf(\"edge_count\");\n const eTypeIdx = ef.indexOf(\"type\");\n const eNameIdx = ef.indexOf(\"name_or_index\");\n const eToIdx = ef.indexOf(\"to_node\");\n\n const nodeTypes = meta.node_types[nTypeIdx] as string[];\n const edgeTypes = meta.edge_types[eTypeIdx] as string[];\n const { nodes, edges, strings } = snap;\n const count = snap.snapshot.node_count;\n\n // Prefix-sum of edge counts so edges of node i are locatable in O(1).\n const edgeStart = new Uint32Array(count + 1);\n for (let i = 0; i < count; i++) {\n edgeStart[i + 1] = edgeStart[i]! + nodes[i * nStride + nEdgeCountIdx]!;\n }\n\n return {\n count,\n type: (i) => nodeTypes[nodes[i * nStride + nTypeIdx]!]!,\n name: (i) => strings[nodes[i * nStride + nNameIdx]!]!,\n selfSize: (i) => nodes[i * nStride + nSizeId"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":36,"symbol":"snap","kind":"constant","lang":"typescript","code":"const snap: RawSnapshot = JSON.parse(fs.readFileSync(file, \"utf8\"));"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":37,"symbol":"meta","kind":"constant","lang":"typescript","code":"const meta = snap.snapshot.meta;"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":38,"symbol":"nf","kind":"constant","lang":"typescript","code":"const nf = meta.node_fields;"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":39,"symbol":"ef","kind":"constant","lang":"typescript","code":"const ef = meta.edge_fields;"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":40,"symbol":"nStride","kind":"constant","lang":"typescript","code":"const nStride = nf.length;"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":41,"symbol":"eStride","kind":"constant","lang":"typescript","code":"const eStride = ef.length;"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":43,"symbol":"nTypeIdx","kind":"constant","lang":"typescript","code":"const nTypeIdx = nf.indexOf(\"type\");"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":44,"symbol":"nNameIdx","kind":"constant","lang":"typescript","code":"const nNameIdx = nf.indexOf(\"name\");"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":45,"symbol":"nSizeIdx","kind":"constant","lang":"typescript","code":"const nSizeIdx = nf.indexOf(\"self_size\");"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":46,"symbol":"nEdgeCountIdx","kind":"constant","lang":"typescript","code":"const nEdgeCountIdx = nf.indexOf(\"edge_count\");"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":47,"symbol":"eTypeIdx","kind":"constant","lang":"typescript","code":"const eTypeIdx = ef.indexOf(\"type\");"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":48,"symbol":"eNameIdx","kind":"constant","lang":"typescript","code":"const eNameIdx = ef.indexOf(\"name_or_index\");"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":49,"symbol":"eToIdx","kind":"constant","lang":"typescript","code":"const eToIdx = ef.indexOf(\"to_node\");"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":51,"symbol":"nodeTypes","kind":"constant","lang":"typescript","code":"const nodeTypes = meta.node_types[nTypeIdx] as string[];"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":52,"symbol":"edgeTypes","kind":"constant","lang":"typescript","code":"const edgeTypes = meta.edge_types[eTypeIdx] as string[];"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":54,"symbol":"count","kind":"constant","lang":"typescript","code":"const count = snap.snapshot.node_count;"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":57,"symbol":"edgeStart","kind":"constant","lang":"typescript","doc":"Prefix-sum of edge counts so edges of node i are locatable in O(1).","code":"const edgeStart = new Uint32Array(count + 1);"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":68,"symbol":"out","kind":"constant","lang":"typescript","code":"const out: Array<{ to: number; type: string; name: string }> = [];"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":70,"symbol":"base","kind":"constant","lang":"typescript","code":"const base = e * eStride;"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":71,"symbol":"type","kind":"constant","lang":"typescript","code":"const type = edgeTypes[edges[base + eTypeIdx]!]!;"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":72,"symbol":"nameOrIndex","kind":"constant","lang":"typescript","code":"const nameOrIndex = edges[base + eNameIdx]!;"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":85,"symbol":"snapshotNow","kind":"function","lang":"typescript","code":"function snapshotNow(tag: string): string {\n if (typeof gc !== \"function\") throw new Error(\"run with --expose-gc\");\n for (let i = 0; i < 6; i++) gc();\n const file = path.join(os.tmpdir(), `zod-ret-${tag}-${process.pid}.heapsnapshot`);\n v8.writeHeapSnapshot(file);\n return file;\n}"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":88,"symbol":"file","kind":"constant","lang":"typescript","code":"const file = path.join(os.tmpdir(), `zod-ret-${tag}-${process.pid}.heapsnapshot`);"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":97,"symbol":"shortestPaths","kind":"function","lang":"typescript","doc":"BFS outward from `roots`, recording for each visited node the shortest edge path that reached it. Nodes in `stopAt` are not traversed through.","code":"function shortestPaths(g: Graph, roots: number[], maxDepth = 12): Map {\n const paths = new Map();\n let frontier = roots.slice();\n for (const r of roots) paths.set(r, []);\n\n for (let depth = 0; depth < maxDepth && frontier.length > 0; depth++) {\n const next: number[] = [];\n for (const from of frontier) {\n const fromPath = paths.get(from)!;\n for (const e of g.edgesOf(from)) {\n if (paths.has(e.to)) continue;\n if (e.type === \"weak\") continue;\n paths.set(e.to, [...fromPath, `${e.type === \"element\" ? `[${e.name}]` : e.name}`]);\n next.push(e.to);\n }\n }\n frontier = next;\n }\n return paths;\n}"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":98,"symbol":"paths","kind":"constant","lang":"typescript","code":"const paths = new Map();"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":103,"symbol":"next","kind":"constant","lang":"typescript","code":"const next: number[] = [];"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":105,"symbol":"fromPath","kind":"constant","lang":"typescript","code":"const fromPath = paths.get(from)!;"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":118,"symbol":"findNodes","kind":"function","lang":"typescript","code":"function findNodes(g: Graph, pred: (i: number) => boolean): number[] {\n const out: number[] = [];\n for (let i = 0; i < g.count; i++) if (pred(i)) out.push(i);\n return out;\n}"} {"repo":"zod","file":"packages/bench/memory/retainers.ts","line":119,"symbol":"out","kind":"constant","lang":"typescript","code":"const out: number[] = [];"} {"repo":"zod","file":"packages/bench/memory/schema-footprint.ts","line":5,"symbol":"N","kind":"constant","lang":"typescript","code":"const N = 20_000;"} {"repo":"zod","file":"packages/bench/memory/schema-footprint.ts","line":7,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases: Array<[string, (i: number) => unknown]> = [\n [\"z.string()\", () => z.string()],\n [\"z.number()\", () => z.number()],\n [\"z.boolean()\", () => z.boolean()],\n [\"z.literal('a')\", () => z.literal(\"a\")],\n [\"z.string().min(1)\", () => z.string().min(1)],\n [\"z.string().min(1).max(5)\", () => z.string().min(1).max(5)],\n [\"z.string().optional()\", () => z.string().optional()],\n [\"z.email()\", () => z.email()],\n [\"z.uuid()\", () => z.uuid()],\n [\"z.iso.datetime()\", () => z.iso.datetime()],\n [\"z.array(z.string())\", () => z.array(z.string())],\n [\"z.enum(['a','b','c'])\", () => z.enum([\"a\", \"b\", \"c\"])],\n [\"z.object({}) empty\", () => z.object({})],\n [\n \"z.object() 3 keys\",\n () =>\n z.object({\n a: z.string(),\n b: z.number(),\n c: z.boolean(),\n }),\n ],\n [\n \"z.object() 10 keys\",\n () => {\n const shape: Record = {};\n for (let k = 0; k < 10; k++) shape[`k${k}`] = z.string();\n return z.object(shape);\n },\n ],\n [\n \"z.object() 10 keys (shared leaf)\",\n (() => {\n const leaf = z.string();\n return () => {\n const shape: Record = {};\n for (let k = 0; k < 10; k++) shap"} {"repo":"zod","file":"packages/bench/memory/schema-footprint.ts","line":33,"symbol":"shape","kind":"constant","lang":"typescript","code":"const shape: Record = {};"} {"repo":"zod","file":"packages/bench/memory/schema-footprint.ts","line":41,"symbol":"leaf","kind":"constant","lang":"typescript","code":"const leaf = z.string();"} {"repo":"zod","file":"packages/bench/memory/schema-footprint.ts","line":43,"symbol":"shape","kind":"constant","lang":"typescript","code":"const shape: Record = {};"} {"repo":"zod","file":"packages/bench/memory/schema-footprint.ts","line":74,"symbol":"rows","kind":"constant","lang":"typescript","code":"const rows = cases.map(([label, factory]) => {\n const m = measureStable(label, N, factory, 5);\n return { schema: label, bytes: m.bytesEach.toFixed(0), human: fmtBytes(m.bytesEach) };\n});"} {"repo":"zod","file":"packages/bench/memory/schema-footprint.ts","line":75,"symbol":"m","kind":"constant","lang":"typescript","code":"const m = measureStable(label, N, factory, 5);"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":12,"symbol":"gc","kind":"constant","lang":"typescript","code":"const gc: (() => void) | undefined;"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":14,"symbol":"Snapshot","kind":"interface","lang":"typescript","code":"interface Snapshot {\n snapshot: {\n meta: {\n node_fields: string[];\n node_types: (string[] | string)[];\n edge_fields: string[];\n edge_types: (string[] | string)[];\n };\n node_count: number;\n edge_count: number;\n };\n nodes: number[];\n edges: number[];\n strings: string[];\n}"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":30,"symbol":"NodeRow","kind":"interface","lang":"typescript","code":"interface NodeRow {\n type: string;\n name: string;\n selfSize: number;\n}"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":36,"symbol":"collect","kind":"function","lang":"typescript","code":"function collect(): void {\n if (typeof gc !== \"function\") throw new Error(\"run with --expose-gc\");\n for (let i = 0; i < 6; i++) gc();\n}"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":41,"symbol":"takeSnapshot","kind":"function","lang":"typescript","code":"function takeSnapshot(tag: string): string {\n collect();\n const file = path.join(os.tmpdir(), `zod-mem-${tag}-${process.pid}.heapsnapshot`);\n v8.writeHeapSnapshot(file);\n return file;\n}"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":43,"symbol":"file","kind":"constant","lang":"typescript","code":"const file = path.join(os.tmpdir(), `zod-mem-${tag}-${process.pid}.heapsnapshot`);"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":48,"symbol":"readNodes","kind":"function","lang":"typescript","code":"function readNodes(file: string): NodeRow[] {\n const snap: Snapshot = JSON.parse(fs.readFileSync(file, \"utf8\"));\n const { node_fields, node_types } = snap.snapshot.meta;\n const typeIdx = node_fields.indexOf(\"type\");\n const nameIdx = node_fields.indexOf(\"name\");\n const sizeIdx = node_fields.indexOf(\"self_size\");\n const stride = node_fields.length;\n const typeNames = node_types[typeIdx] as string[];\n const { nodes, strings } = snap;\n\n const out: NodeRow[] = new Array(snap.snapshot.node_count);\n for (let i = 0, n = 0; i < nodes.length; i += stride, n++) {\n out[n] = {\n type: typeNames[nodes[i + typeIdx]!]!,\n name: strings[nodes[i + nameIdx]!]!,\n selfSize: nodes[i + sizeIdx]!,\n };\n }\n return out;\n}"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":49,"symbol":"snap","kind":"constant","lang":"typescript","code":"const snap: Snapshot = JSON.parse(fs.readFileSync(file, \"utf8\"));"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":51,"symbol":"typeIdx","kind":"constant","lang":"typescript","code":"const typeIdx = node_fields.indexOf(\"type\");"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":52,"symbol":"nameIdx","kind":"constant","lang":"typescript","code":"const nameIdx = node_fields.indexOf(\"name\");"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":53,"symbol":"sizeIdx","kind":"constant","lang":"typescript","code":"const sizeIdx = node_fields.indexOf(\"self_size\");"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":54,"symbol":"stride","kind":"constant","lang":"typescript","code":"const stride = node_fields.length;"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":55,"symbol":"typeNames","kind":"constant","lang":"typescript","code":"const typeNames = node_types[typeIdx] as string[];"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":58,"symbol":"out","kind":"constant","lang":"typescript","code":"const out: NodeRow[] = new Array(snap.snapshot.node_count);"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":69,"symbol":"key","kind":"function","lang":"typescript","code":"function key(r: NodeRow): string {\n return `${r.type}::${r.name}`;\n}"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":73,"symbol":"tally","kind":"function","lang":"typescript","code":"function tally(rows: NodeRow[]): Map {\n const m = new Map();\n for (const r of rows) {\n const k = key(r);\n let e = m.get(k);\n if (!e) {\n e = { count: 0, bytes: 0 };\n m.set(k, e);\n }\n e.count++;\n e.bytes += r.selfSize;\n }\n return m;\n}"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":74,"symbol":"m","kind":"constant","lang":"typescript","code":"const m = new Map();"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":76,"symbol":"k","kind":"constant","lang":"typescript","code":"const k = key(r);"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":88,"symbol":"DiffRow","kind":"interface","lang":"typescript","code":"interface DiffRow {\n what: string;\n count: number;\n bytes: number;\n countEach: number;\n bytesEach: number;\n}"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":100,"symbol":"diffAllocation","kind":"function","lang":"typescript","doc":"Runs `factory` `delta` extra times on top of `baseline` live instances and reports which node kinds grew, normalized per added instance.","code":"function diffAllocation(factory: () => unknown, baseline = 2_000, delta = 8_000): DiffRow[] {\n const sink: unknown[] = [];\n for (let i = 0; i < baseline; i++) sink.push(factory());\n\n const fileA = takeSnapshot(\"a\");\n const before = tally(readNodes(fileA));\n fs.unlinkSync(fileA);\n\n for (let i = 0; i < delta; i++) sink.push(factory());\n\n const fileB = takeSnapshot(\"b\");\n const after = tally(readNodes(fileB));\n fs.unlinkSync(fileB);\n\n if (sink.length !== baseline + delta) throw new Error(\"unreachable\");\n\n const rows: DiffRow[] = [];\n for (const [k, a] of after) {\n const b = before.get(k) ?? { count: 0, bytes: 0 };\n const dCount = a.count - b.count;\n const dBytes = a.bytes - b.bytes;\n // Ignore noise that doesn't scale with the population.\n if (dCount < delta * 0.2) continue;\n rows.push({\n what: k,\n count: dCount,\n bytes: dBytes,\n countEach: dCount / delta,\n bytesEach: dBytes / delta,\n });\n }\n rows.sort((x, y) => y.bytes - x.bytes);\n return rows;\n}"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":101,"symbol":"sink","kind":"constant","lang":"typescript","code":"const sink: unknown[] = [];"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":104,"symbol":"fileA","kind":"constant","lang":"typescript","code":"const fileA = takeSnapshot(\"a\");"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":105,"symbol":"before","kind":"constant","lang":"typescript","code":"const before = tally(readNodes(fileA));"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":110,"symbol":"fileB","kind":"constant","lang":"typescript","code":"const fileB = takeSnapshot(\"b\");"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":111,"symbol":"after","kind":"constant","lang":"typescript","code":"const after = tally(readNodes(fileB));"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":116,"symbol":"rows","kind":"constant","lang":"typescript","code":"const rows: DiffRow[] = [];"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":118,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = before.get(k) ?? { count: 0, bytes: 0 };"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":119,"symbol":"dCount","kind":"constant","lang":"typescript","code":"const dCount = a.count - b.count;"} {"repo":"zod","file":"packages/bench/memory/snapshot.ts","line":120,"symbol":"dBytes","kind":"constant","lang":"typescript","code":"const dBytes = a.bytes - b.bytes;"} {"repo":"zod","file":"packages/bench/memory/survey.ts","line":13,"symbol":"census","kind":"function","lang":"typescript","code":"function census(a: any, b: any): { own: number; zod: number; funcs: number; accessors: number } {\n let funcs = 0;\n let accessors = 0;\n for (const [objA, objB] of [\n [a, b],\n [a._zod, b._zod],\n ] as const) {\n for (const key of Reflect.ownKeys(objA)) {\n const d = Object.getOwnPropertyDescriptor(objA, key)!;\n const dB = objB && Object.getOwnPropertyDescriptor(objB, key);\n if (d.get || d.set) {\n if (dB && (d.get !== dB.get || d.set !== dB.set)) accessors++;\n } else if (typeof d.value === \"function\" && dB && d.value !== dB.value) {\n funcs++;\n }\n }\n }\n return { own: Reflect.ownKeys(a).length, zod: Reflect.ownKeys(a._zod).length, funcs, accessors };\n}"} {"repo":"zod","file":"packages/bench/memory/survey.ts","line":21,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = Object.getOwnPropertyDescriptor(objA, key)!;"} {"repo":"zod","file":"packages/bench/memory/survey.ts","line":22,"symbol":"dB","kind":"constant","lang":"typescript","code":"const dB = objB && Object.getOwnPropertyDescriptor(objB, key);"} {"repo":"zod","file":"packages/bench/memory/survey.ts","line":33,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases: Array<[string, () => any]> = [\n [\"string\", () => z.string()],\n [\"number\", () => z.number()],\n [\"boolean\", () => z.boolean()],\n [\"bigint\", () => z.bigint()],\n [\"date\", () => z.date()],\n [\"file\", () => z.file()],\n [\"symbol\", () => z.symbol()],\n [\"literal\", () => z.literal(\"a\")],\n [\"enum\", () => z.enum([\"a\", \"b\"])],\n [\"array\", () => z.array(z.string())],\n [\"object\", () => z.object({ a: z.string() })],\n [\"record\", () => z.record(z.string(), z.string())],\n [\"map\", () => z.map(z.string(), z.string())],\n [\"set\", () => z.set(z.string())],\n [\"tuple\", () => z.tuple([z.string()])],\n [\"union\", () => z.union([z.string(), z.number()])],\n [\"intersection\", () => z.intersection(z.object({}), z.object({}))],\n [\"optional\", () => z.string().optional()],\n [\"nullable\", () => z.string().nullable()],\n [\"default\", () => z.string().default(\"x\")],\n [\"catch\", () => z.string().catch(\"x\")],\n [\"pipe\", () => z.string().pipe(z.string())],\n [\"lazy\", () => z.lazy(() => z.string())],\n [\"promise\", () => z.promise(z.string())],\n [\"readonly\", () => z.string().readonly()],\n [\"success\", () => z.success(z.string())],\n [\"transform\", () => z.transform((x) => x)],\n [\"email (fmt)\", () ="} {"repo":"zod","file":"packages/bench/memory/survey.ts","line":65,"symbol":"rows","kind":"constant","lang":"typescript","code":"const rows = cases.map(([label, f]) => {\n const c = census(f(), f());\n return {\n schema: label,\n \"own(inst)\": c.own,\n \"own(_zod)\": c.zod,\n \"per-inst fns\": c.funcs,\n \"per-inst accessors\": c.accessors,\n \"dict mode?\": c.own > 30 ? \"LIKELY\" : \"\",\n };\n});"} {"repo":"zod","file":"packages/bench/memory/survey.ts","line":66,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = census(f(), f());"} {"repo":"zod","file":"packages/bench/memory/survey.ts","line":79,"symbol":"total","kind":"constant","lang":"typescript","code":"const total = rows.reduce((s, r) => s + (r[\"per-inst fns\"] as number), 0);"} {"repo":"zod","file":"packages/bench/memory/throughput.ts","line":8,"symbol":"timeOnce","kind":"function","lang":"typescript","code":"function timeOnce(fn: () => void, ms: number): number {\n let ops = 0;\n const start = process.hrtime.bigint();\n const budget = BigInt(ms) * 1_000_000n;\n while (process.hrtime.bigint() - start < budget) {\n for (let i = 0; i < 200; i++) fn();\n ops += 200;\n }\n return ops / (Number(process.hrtime.bigint() - start) / 1e9);\n}"} {"repo":"zod","file":"packages/bench/memory/throughput.ts","line":10,"symbol":"start","kind":"constant","lang":"typescript","code":"const start = process.hrtime.bigint();"} {"repo":"zod","file":"packages/bench/memory/throughput.ts","line":11,"symbol":"budget","kind":"constant","lang":"typescript","code":"const budget = BigInt(ms) * 1_000_000n;"} {"repo":"zod","file":"packages/bench/memory/throughput.ts","line":19,"symbol":"ROUNDS","kind":"constant","lang":"typescript","code":"const ROUNDS = 7;"} {"repo":"zod","file":"packages/bench/memory/throughput.ts","line":20,"symbol":"CASES","kind":"constant","lang":"typescript","code":"const CASES: Array<[string, () => void]> = [];"} {"repo":"zod","file":"packages/bench/memory/throughput.ts","line":21,"symbol":"bench","kind":"function","lang":"typescript","code":"function bench(label: string, fn: () => void): void {\n CASES.push([label, fn]);\n}"} {"repo":"zod","file":"packages/bench/memory/throughput.ts","line":30,"symbol":"runAll","kind":"function","lang":"typescript","doc":"Rounds are interleaved across all cases rather than run case-by-case, so a transient (thermal, GC, other processes) hits every case roughly equally instead of ruining one. Reported value is the median round.","code":"function runAll(ms = 400): Array<{ label: string; opsPerSec: number; spreadPct: number }> {\n for (const [, fn] of CASES) for (let i = 0; i < 5_000; i++) fn();\n\n const samples = new Map(CASES.map(([l]) => [l, []]));\n for (let r = 0; r < ROUNDS; r++) {\n for (const [label, fn] of CASES) {\n samples.get(label)!.push(timeOnce(fn, ms));\n }\n }\n return CASES.map(([label]) => {\n const s = samples.get(label)!.sort((a, b) => a - b);\n const median = s[Math.floor(s.length / 2)]!;\n return { label, opsPerSec: median, spreadPct: ((s.at(-1)! - s[0]!) / median) * 100 };\n });\n}"} {"repo":"zod","file":"packages/bench/memory/throughput.ts","line":33,"symbol":"samples","kind":"constant","lang":"typescript","code":"const samples = new Map(CASES.map(([l]) => [l, []]));"} {"repo":"zod","file":"packages/bench/memory/throughput.ts","line":40,"symbol":"s","kind":"constant","lang":"typescript","code":"const s = samples.get(label)!.sort((a, b) => a - b);"} {"repo":"zod","file":"packages/bench/memory/throughput.ts","line":41,"symbol":"median","kind":"constant","lang":"typescript","code":"const median = s[Math.floor(s.length / 2)]!;"} {"repo":"zod","file":"packages/bench/memory/throughput.ts","line":46,"symbol":"shape","kind":"constant","lang":"typescript","code":"const shape = { a: z.string(), b: z.number(), c: z.boolean() };"} {"repo":"zod","file":"packages/bench/memory/throughput.ts","line":47,"symbol":"objSchema","kind":"constant","lang":"typescript","code":"const objSchema = z.object(shape);"} {"repo":"zod","file":"packages/bench/memory/throughput.ts","line":48,"symbol":"strSchema","kind":"constant","lang":"typescript","code":"const strSchema = z.string();"} {"repo":"zod","file":"packages/bench/memory/throughput.ts","line":49,"symbol":"minSchema","kind":"constant","lang":"typescript","code":"const minSchema = z.string().min(1);"} {"repo":"zod","file":"packages/bench/memory/throughput.ts","line":50,"symbol":"arrSchema","kind":"constant","lang":"typescript","code":"const arrSchema = z.array(z.string());"} {"repo":"zod","file":"packages/bench/memory/throughput.ts","line":51,"symbol":"unionSchema","kind":"constant","lang":"typescript","code":"const unionSchema = z.union([z.string(), z.number()]);"} {"repo":"zod","file":"packages/bench/memory/throughput.ts","line":52,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = { a: \"x\", b: 1, c: true };"} {"repo":"zod","file":"packages/bench/memory/throughput.ts","line":53,"symbol":"arrData","kind":"constant","lang":"typescript","code":"const arrData = [\"a\", \"b\", \"c\", \"d\"];"} {"repo":"zod","file":"packages/bench/metabench.ts","line":10,"symbol":"BENCH","kind":"type","lang":"typescript","code":"type BENCH = \"tinybench\" | \"benchmarkjs\" | \"mitata\";"} {"repo":"zod","file":"packages/bench/metabench.ts","line":11,"symbol":"BENCH","kind":"constant","lang":"typescript","code":"const BENCH: BENCH = (process.env.BENCH as BENCH) || \"tinybench\";"} {"repo":"zod","file":"packages/bench/metabench.ts","line":13,"symbol":"Benchmarks","kind":"type","lang":"typescript","code":"type Benchmarks = { [k: string]: (d: T) => any };"} {"repo":"zod","file":"packages/bench/metabench.ts","line":14,"symbol":"metabench","kind":"function","lang":"typescript","code":"function metabench(name: string, benchmarks?: Benchmarks): Metabench {\n let bench: Metabench;\n if (BENCH === \"tinybench\") {\n bench = new Tinybench(name, benchmarks || {});\n } else if (BENCH === \"benchmarkjs\") {\n bench = new BenchmarkJS(name, benchmarks || {});\n } else if (BENCH === \"mitata\") {\n bench = new Mitata(name, benchmarks || {});\n } else {\n throw new Error(`Unknown benchmark runner: ${BENCH}`);\n }\n // console.log(`running benchmark with ${BENCH}...`);\n return bench;\n}"} {"repo":"zod","file":"packages/bench/metabench.ts","line":29,"symbol":"BenchWithDataParams","kind":"interface","lang":"typescript","code":"interface BenchWithDataParams {\n name: string;\n data: () => D;\n batch?: number | null;\n benchmarks?: Benchmarks;\n}"} {"repo":"zod","file":"packages/bench/metabench.ts","line":36,"symbol":"benchWithData","kind":"function","lang":"typescript","code":"function benchWithData(params: BenchWithDataParams & ThisType<{ data: D }>): Metabench {\n const bench = metabench(params.name);\n // console.log(`Batch size: ${params.batch}`);\n\n if (params.batch === null) {\n const DATA = params.data();\n for (const key in params.benchmarks) {\n const _bench = params.benchmarks[key].bind({\n data: DATA,\n }) as any;\n bench.add(key, _bench);\n }\n } else {\n const DATA = Array.from({ length: params.batch || 1000 }, params.data);\n for (const key in params.benchmarks) {\n const _bench = params.benchmarks[key].bind({\n data: DATA,\n }) as any;\n bench.add(key, () => {\n for (const d of DATA) {\n _bench(d);\n }\n });\n }\n }\n\n return bench;\n}"} {"repo":"zod","file":"packages/bench/metabench.ts","line":37,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(params.name);"} {"repo":"zod","file":"packages/bench/metabench.ts","line":41,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = params.data();"} {"repo":"zod","file":"packages/bench/metabench.ts","line":43,"symbol":"_bench","kind":"constant","lang":"typescript","code":"const _bench = params.benchmarks[key].bind({\n data: DATA,\n }) as any;"} {"repo":"zod","file":"packages/bench/metabench.ts","line":49,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = Array.from({ length: params.batch || 1000 }, params.data);"} {"repo":"zod","file":"packages/bench/metabench.ts","line":51,"symbol":"_bench","kind":"constant","lang":"typescript","code":"const _bench = params.benchmarks[key].bind({\n data: DATA,\n }) as any;"} {"repo":"zod","file":"packages/bench/metabench.ts","line":68,"symbol":"constructor","kind":"method","lang":"typescript","code":"constructor(\n public name: string,\n public benchmarks: Benchmarks\n // params?: Omit, \"name\" | \"benchmarks\">\n ) {}"} {"repo":"zod","file":"packages/bench/metabench.ts","line":74,"symbol":"add","kind":"method","lang":"typescript","code":"add(name: string, fn: (val: D) => any): this {\n this.benchmarks![name] = fn;\n return this;\n }"} {"repo":"zod","file":"packages/bench/metabench.ts","line":80,"symbol":"Tinybench","kind":"class","lang":"typescript","code":"class Tinybench extends Metabench {\n runner = \"tinybench\";\n async run() {\n const bench = new Bench({ time: 1500 });\n for (const [name, fn] of Object.entries(this.benchmarks)) {\n bench.add(name, fn as any);\n }\n // await runBench(this.name, bench);\n console.log();\n console.log(` benchmarking ${chalk.bold.white(this.name)} with ${chalk.bold.white(this.runner)}`);\n\n bench.addEventListener(\"cycle\", (e) => {\n const task = e.task?.result;\n if (!task) throw new Error(\"Task has no result\");\n\n console.log(\n chalk.dim(\" \") +\n chalk.white.dim(`→ `) +\n chalk.white(e.task.name) +\n chalk.white.dim(\" \") +\n chalk.cyan(formatNumber(task.hz)) +\n chalk.cyan(` ops/sec`) +\n chalk.dim(` (${e.task.result?.totalTime.toFixed(2)}ms)`)\n );\n });\n\n await bench.warmup();\n await bench.run();\n\n const sorted = bench.tasks.sort((a, b) => {\n if (!a.result || !b.result) throw new Error(\"Task has no result\");\n return a.result?.mean - b.result?.mean;\n });\n // const fastest = sorted[0];\n const slowest = sorted[sorted.length - 1];\n\n const table = new Table({\n columns: [\n "} {"repo":"zod","file":"packages/bench/metabench.ts","line":82,"symbol":"run","kind":"method","lang":"typescript","code":"async run() {\n const bench = new Bench({ time: 1500 });\n for (const [name, fn] of Object.entries(this.benchmarks)) {\n bench.add(name, fn as any);\n }\n // await runBench(this.name, bench);\n console.log();\n console.log(` benchmarking ${chalk.bold.white(this.name)} with ${chalk.bold.white(this.runner)}`);\n\n bench.addEventListener(\"cycle\", (e) => {\n const task = e.task?.result;\n if (!task) throw new Error(\"Task has no result\");\n\n console.log(\n chalk.dim(\" \") +\n chalk.white.dim(`→ `) +\n chalk.white(e.task.name) +\n chalk.white.dim(\" \") +\n chalk.cyan(formatNumber(task.hz)) +\n chalk.cyan(` ops/sec`) +\n chalk.dim(` (${e.task.result?.totalTime.toFixed(2)}ms)`)\n );\n });\n\n await bench.warmup();\n await bench.run();\n\n const sorted = bench.tasks.sort((a, b) => {\n if (!a.result || !b.result) throw new Error(\"Task has no result\");\n return a.result?.mean - b.result?.mean;\n });\n // const fastest = sorted[0];\n const slowest = sorted[sorted.length - 1];\n\n const table = new Table({\n columns: [\n { name: \"name\", color: \"white\" },\n { name: \"summa"} {"repo":"zod","file":"packages/bench/metabench.ts","line":83,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = new Bench({ time: 1500 });"} {"repo":"zod","file":"packages/bench/metabench.ts","line":92,"symbol":"task","kind":"constant","lang":"typescript","code":"const task = e.task?.result;"} {"repo":"zod","file":"packages/bench/metabench.ts","line":109,"symbol":"sorted","kind":"constant","lang":"typescript","code":"const sorted = bench.tasks.sort((a, b) => {\n if (!a.result || !b.result) throw new Error(\"Task has no result\");\n return a.result?.mean - b.result?.mean;\n });"} {"repo":"zod","file":"packages/bench/metabench.ts","line":114,"symbol":"slowest","kind":"constant","lang":"typescript","doc":"const fastest = sorted[0];","code":"const slowest = sorted[sorted.length - 1];"} {"repo":"zod","file":"packages/bench/metabench.ts","line":116,"symbol":"table","kind":"constant","lang":"typescript","code":"const table = new Table({\n columns: [\n { name: \"name\", color: \"white\" },\n { name: \"summary\", alignment: \"left\" },\n { name: \"ops/sec\", color: \"cyan\" },\n { name: \"time/op\", color: \"magenta\" },\n { name: \"margin\", color: \"magenta\" },\n { name: \"samples\", color: \"magenta\" },\n ],\n });"} {"repo":"zod","file":"packages/bench/metabench.ts","line":128,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = task.result;"} {"repo":"zod","file":"packages/bench/metabench.ts","line":141,"symbol":"rendered","kind":"constant","lang":"typescript","code":"const rendered = ` ${table.render().split(\"\\n\").join(\"\\n \")}`;"} {"repo":"zod","file":"packages/bench/metabench.ts","line":148,"symbol":"BenchmarkJS","kind":"class","lang":"typescript","code":"class BenchmarkJS extends Metabench {\n runner = \"benchmarkjs\";\n async run() {\n const suite = new Benchmark.Suite();\n console.log(` benchmarking ${chalk.white(this.name)} with ${this.runner}`);\n for (const name in this.benchmarks) {\n const fn = this.benchmarks[name];\n suite.add(name, fn);\n }\n suite.on(\"cycle\", (event: Benchmark.Event) => {\n // const target = event.target;\n // console.log(target.name, target.hz, target.stats!.mean);\n console.log(chalk.white.dim(` → ${String(event.target)}`));\n // print summary\n });\n suite.on(\"complete\", (event: Benchmark.Event) => {\n // print summary\n const suite = event.currentTarget as Benchmark.Suite;\n\n // for(const benchmark of suite){}\n const results: {\n name: string;\n hz: number;\n mean: number;\n rme: number;\n samples: number;\n }[] = suite.map((benchmark: Benchmark) => ({\n name: benchmark.name,\n hz: benchmark.hz,\n mean: benchmark.stats.mean,\n rme: benchmark.stats.rme,\n samples: benchmark.stats.sample.length,\n }));\n\n results.sort((a, b) => a.hz - b.hz).reverse();\n const slowest = resu"} {"repo":"zod","file":"packages/bench/metabench.ts","line":150,"symbol":"run","kind":"method","lang":"typescript","code":"async run() {\n const suite = new Benchmark.Suite();\n console.log(` benchmarking ${chalk.white(this.name)} with ${this.runner}`);\n for (const name in this.benchmarks) {\n const fn = this.benchmarks[name];\n suite.add(name, fn);\n }\n suite.on(\"cycle\", (event: Benchmark.Event) => {\n // const target = event.target;\n // console.log(target.name, target.hz, target.stats!.mean);\n console.log(chalk.white.dim(` → ${String(event.target)}`));\n // print summary\n });\n suite.on(\"complete\", (event: Benchmark.Event) => {\n // print summary\n const suite = event.currentTarget as Benchmark.Suite;\n\n // for(const benchmark of suite){}\n const results: {\n name: string;\n hz: number;\n mean: number;\n rme: number;\n samples: number;\n }[] = suite.map((benchmark: Benchmark) => ({\n name: benchmark.name,\n hz: benchmark.hz,\n mean: benchmark.stats.mean,\n rme: benchmark.stats.rme,\n samples: benchmark.stats.sample.length,\n }));\n\n results.sort((a, b) => a.hz - b.hz).reverse();\n const slowest = results[results.length - 1];\n\n const table = new Table({\n "} {"repo":"zod","file":"packages/bench/metabench.ts","line":151,"symbol":"suite","kind":"constant","lang":"typescript","code":"const suite = new Benchmark.Suite();"} {"repo":"zod","file":"packages/bench/metabench.ts","line":154,"symbol":"fn","kind":"constant","lang":"typescript","code":"const fn = this.benchmarks[name];"} {"repo":"zod","file":"packages/bench/metabench.ts","line":165,"symbol":"suite","kind":"constant","lang":"typescript","doc":"print summary","code":"const suite = event.currentTarget as Benchmark.Suite;"} {"repo":"zod","file":"packages/bench/metabench.ts","line":168,"symbol":"results","kind":"constant","lang":"typescript","doc":"for(const benchmark of suite){}","code":"const results: {\n name: string;\n hz: number;\n mean: number;\n rme: number;\n samples: number;\n }[] = suite.map((benchmark: Benchmark) => ({\n name: benchmark.name,\n hz: benchmark.hz,\n mean: benchmark.stats.mean,\n rme: benchmark.stats.rme,\n samples: benchmark.stats.sample.length,\n }));"} {"repo":"zod","file":"packages/bench/metabench.ts","line":183,"symbol":"slowest","kind":"constant","lang":"typescript","code":"const slowest = results[results.length - 1];"} {"repo":"zod","file":"packages/bench/metabench.ts","line":185,"symbol":"table","kind":"constant","lang":"typescript","code":"const table = new Table({\n columns: [\n { name: \"name\", color: \"white\" },\n { name: \"summary\", alignment: \"left\" },\n { name: \"ops/sec\", color: \"cyan\" },\n { name: \"time/op\", color: \"magenta\" },\n { name: \"margin\", color: \"magenta\" },\n { name: \"samples\", color: \"magenta\" },\n ],\n });"} {"repo":"zod","file":"packages/bench/metabench.ts","line":207,"symbol":"rendered","kind":"constant","lang":"typescript","code":"const rendered = ` ${table.render().split(\"\\n\").join(\"\\n \")}`;"} {"repo":"zod","file":"packages/bench/metabench.ts","line":216,"symbol":"Mitata","kind":"class","lang":"typescript","code":"class Mitata extends Metabench {\n runner = \"mitata\";\n async run() {\n mitata.group(this.name, () => {\n for (const [name, fn] of Object.entries(this.benchmarks)) {\n mitata.bench(name, fn as any);\n }\n });\n\n mitata.run();\n }\n}"} {"repo":"zod","file":"packages/bench/metabench.ts","line":218,"symbol":"run","kind":"method","lang":"typescript","code":"async run() {\n mitata.group(this.name, () => {\n for (const [name, fn] of Object.entries(this.benchmarks)) {\n mitata.bench(name, fn as any);\n }\n });\n\n mitata.run();\n }"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":19,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = Object.freeze({\n number: 1,\n negNumber: -1,\n maxNumber: Number.MAX_VALUE,\n string: \"string\",\n longString:\n \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\",\n boolean: true,\n deeplyNested: { foo: \"bar\", num: 1, bool: false },\n});"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":31,"symbol":"DIRTY","kind":"constant","lang":"typescript","doc":"what moltar's parseSafe feeds in: the fixture plus unknown keys the parser must strip, nested ones included","code":"const DIRTY = Object.freeze({\n ...DATA,\n extraAttribute: \"strip me\",\n deeplyNested: { ...DATA.deeplyNested, extraNestedAttribute: \"strip me\" },\n});"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":37,"symbol":"Category","kind":"type","lang":"typescript","code":"type Category = \"parseSafe\" | \"assertLoose\";"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":39,"symbol":"Entry","kind":"interface","lang":"typescript","code":"interface Entry {\n name: string;\n category: Category;\n run: (input: unknown) => unknown;\n}"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":45,"symbol":"entries","kind":"constant","lang":"typescript","code":"const entries: Entry[] = [];"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":46,"symbol":"add","kind":"constant","lang":"typescript","code":"const add = (name: string, category: Category, run: (input: unknown) => unknown) =>\n entries.push({ name, category, run });"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":49,"symbol":"SHAPE","kind":"constant","lang":"typescript","code":"const SHAPE = {\n number: z.number(),\n negNumber: z.number(),\n maxNumber: z.number(),\n string: z.string(),\n longString: z.string(),\n boolean: z.boolean(),\n deeplyNested: z.object({ foo: z.string(), num: z.number(), bool: z.boolean() }),\n};"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":60,"symbol":"zodSchema","kind":"constant","lang":"typescript","doc":"--- zod ---","code":"const zodSchema = z.object(SHAPE);"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":61,"symbol":"zodCompiled","kind":"constant","lang":"typescript","code":"const zodCompiled = z.compile(zodSchema);"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":65,"symbol":"zodLoose","kind":"constant","lang":"typescript","code":"const zodLoose = z.looseObject({\n ...SHAPE,\n deeplyNested: z.looseObject({ foo: z.string(), num: z.number(), bool: z.boolean() }),\n});"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":69,"symbol":"zodLooseCompiled","kind":"constant","lang":"typescript","code":"const zodLooseCompiled = z.compile(zodLoose);"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":74,"symbol":"zod3Leaves","kind":"constant","lang":"typescript","doc":"--- zod 3 ---","code":"const zod3Leaves = { foo: z3.string(), num: z3.number(), bool: z3.boolean() };"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":75,"symbol":"zod3Shape","kind":"constant","lang":"typescript","code":"const zod3Shape = {\n number: z3.number(),\n negNumber: z3.number(),\n maxNumber: z3.number(),\n string: z3.string(),\n longString: z3.string(),\n boolean: z3.boolean(),\n deeplyNested: z3.object(zod3Leaves),\n};"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":84,"symbol":"zod3Schema","kind":"constant","lang":"typescript","code":"const zod3Schema = z3.object(zod3Shape);"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":86,"symbol":"zod3Loose","kind":"constant","lang":"typescript","code":"const zod3Loose = z3.object({ ...zod3Shape, deeplyNested: z3.object(zod3Leaves).passthrough() }).passthrough();"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":93,"symbol":"valibotSchema","kind":"constant","lang":"typescript","doc":"--- valibot ---","code":"const valibotSchema = v.object({\n number: v.number(),\n negNumber: v.number(),\n maxNumber: v.number(),\n string: v.string(),\n longString: v.string(),\n boolean: v.boolean(),\n deeplyNested: v.object({ foo: v.string(), num: v.number(), bool: v.boolean() }),\n});"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":109,"symbol":"arktypeShape","kind":"constant","lang":"typescript","doc":"--- arktype ---","code":"const arktypeShape = {\n number: \"number\",\n negNumber: \"number\",\n maxNumber: \"number\",\n string: \"string\",\n longString: \"string\",\n boolean: \"boolean\",\n deeplyNested: { foo: \"string\", num: \"number\", bool: \"boolean\" },\n} as const;"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":118,"symbol":"arktypeLoose","kind":"constant","lang":"typescript","code":"const arktypeLoose = type(arktypeShape as any);"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":125,"symbol":"arktypeStrip","kind":"constant","lang":"typescript","doc":"parseSafe needs unknown keys deleted at every level, which is a different arktype configuration; arktype returns its errors rather than throwing, so the caller pays for that check","code":"const arktypeStrip = (arktypeLoose as any).onDeepUndeclaredKey(\"delete\");"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":127,"symbol":"out","kind":"constant","lang":"typescript","code":"const out = arktypeStrip(d);"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":133,"symbol":"effectSchema","kind":"constant","lang":"typescript","doc":"--- effect ---","code":"const effectSchema = Schema.Struct({\n number: Schema.Number,\n negNumber: Schema.Number,\n maxNumber: Schema.Number,\n string: Schema.String,\n longString: Schema.String,\n boolean: Schema.Boolean,\n deeplyNested: Schema.Struct({ foo: Schema.String, num: Schema.Number, bool: Schema.Boolean }),\n});"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":142,"symbol":"effectParse","kind":"constant","lang":"typescript","code":"const effectParse = Schema.decodeUnknownSync(effectSchema, { onExcessProperty: undefined });"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":143,"symbol":"effectAssert","kind":"constant","lang":"typescript","code":"const effectAssert = Schema.asserts(effectSchema, { onExcessProperty: \"ignore\" });"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":151,"symbol":"yupSchema","kind":"constant","lang":"typescript","doc":"--- yup ---","code":"const yupSchema = yup.object({\n number: yup.number().required(),\n negNumber: yup.number().required(),\n maxNumber: yup.number().required(),\n string: yup.string().required(),\n longString: yup.string().required(),\n boolean: yup.bool().required(),\n deeplyNested: yup.object({ foo: yup.string().required(), num: yup.number().required(), bool: yup.bool().required() }),\n});"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":167,"symbol":"typeboxSchema","kind":"constant","lang":"typescript","doc":"--- typebox ---","code":"const typeboxSchema = Type.Object({\n number: Type.Number(),\n negNumber: Type.Number(),\n maxNumber: Type.Number(),\n string: Type.String(),\n longString: Type.String(),\n boolean: Type.Boolean(),\n deeplyNested: Type.Object({ foo: Type.String(), num: Type.Number(), bool: Type.Boolean() }),\n});"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":176,"symbol":"typeboxCompiled","kind":"constant","lang":"typescript","code":"const typeboxCompiled = TypeCompiler.Compile(typeboxSchema);"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":196,"symbol":"typiaCase","kind":"constant","lang":"typescript","doc":"--- typia, a transformer that generates its checks at build time; see typia-case/README.md ---","code":"const typiaCase = createRequire(import.meta.url)(\"./typia-case/build/index.cjs\") as {\n is: (d: unknown) => boolean;\n clone: (d: unknown) => unknown;\n};"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":211,"symbol":"deepEq","kind":"function","lang":"typescript","code":"function deepEq(a: unknown, b: unknown): boolean {\n if (a === b) return true;\n if (typeof a !== typeof b || a === null || b === null || typeof a !== \"object\") return false;\n const ka = Object.keys(a as object);\n const kb = Object.keys(b as object);\n if (ka.length !== kb.length) return false;\n return ka.every((k) => deepEq((a as any)[k], (b as any)[k]));\n}"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":214,"symbol":"ka","kind":"constant","lang":"typescript","code":"const ka = Object.keys(a as object);"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":215,"symbol":"kb","kind":"constant","lang":"typescript","code":"const kb = Object.keys(b as object);"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":220,"symbol":"ROUNDS","kind":"constant","lang":"typescript","code":"const ROUNDS = 15;"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":222,"symbol":"timed","kind":"function","lang":"typescript","code":"function timed(fn: () => void, iters: number): number {\n const start = process.hrtime.bigint();\n for (let i = 0; i < iters; i++) fn();\n return Number(process.hrtime.bigint() - start) / 1e6;\n}"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":223,"symbol":"start","kind":"constant","lang":"typescript","code":"const start = process.hrtime.bigint();"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":229,"symbol":"calibrate","kind":"function","lang":"typescript","doc":"iterations that put one measurement near ~40ms, so a round is short but not noise","code":"function calibrate(fn: () => void): number {\n let iters = 64;\n for (;;) {\n const ms = timed(fn, iters);\n if (ms > 25 || iters > 4_000_000) return iters;\n iters = Math.max(iters * 2, Math.ceil((iters * 40) / Math.max(ms, 0.05)));\n }\n}"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":232,"symbol":"ms","kind":"constant","lang":"typescript","code":"const ms = timed(fn, iters);"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":241,"symbol":"problems","kind":"constant","lang":"typescript","code":"const problems: string[] = [];"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":242,"symbol":"runners","kind":"constant","lang":"typescript","code":"const runners: { entry: Entry; fn: () => void }[] = [];"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":245,"symbol":"id","kind":"constant","lang":"typescript","code":"const id = `${e.name} [${e.category}]`;"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":248,"symbol":"clone","kind":"constant","lang":"typescript","doc":"moltar's own tests for the category, run before anything is timed. Inputs are unfrozen clones: arktype's strip writes through the input object on its way to building the result, so a frozen fixture rejects it for the wrong reason.","code":"const clone = (o: any) => ({ ...o, deeplyNested: { ...o.deeplyNested } });"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":270,"symbol":"out","kind":"constant","lang":"typescript","code":"const out = e.run({ ...clone(DATA), number: \"foo\" });"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":281,"symbol":"source","kind":"constant","lang":"typescript","doc":"distinct objects, and an array load rather than a constant, so nothing is hoisted and a pass-through library cannot escape one shared reference","code":"const source = e.category === \"parseSafe\" ? DIRTY : DATA;"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":282,"symbol":"pool","kind":"constant","lang":"typescript","code":"const pool = Array.from({ length: 64 }, (_, i) => ({\n ...source,\n number: i,\n deeplyNested: { ...source.deeplyNested },\n }));"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":292,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = e.run(pool[idx++ & 63]);"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":310,"symbol":"iters","kind":"constant","lang":"typescript","code":"const iters = new Map(runners.map((r) => [`${r.entry.name}|${r.entry.category}`, calibrate(r.fn)]));"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":311,"symbol":"best","kind":"constant","lang":"typescript","code":"const best = new Map(runners.map((r) => [`${r.entry.name}|${r.entry.category}`, Number.POSITIVE_INFINITY]));"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":315,"symbol":"key","kind":"constant","lang":"typescript","code":"const key = `${r.entry.name}|${r.entry.category}`;"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":316,"symbol":"ms","kind":"constant","lang":"typescript","code":"const ms = timed(r.fn, iters.get(key)!);"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":321,"symbol":"rows","kind":"constant","lang":"typescript","code":"const rows = runners\n .map((r) => {\n const key = `${r.entry.name}|${r.entry.category}`;\n return { name: r.entry.name, category: r.entry.category, ops: (iters.get(key)! / best.get(key)!) * 1000 };\n })\n .sort((a, b) => b.ops - a.ops);"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":323,"symbol":"key","kind":"constant","lang":"typescript","code":"const key = `${r.entry.name}|${r.entry.category}`;"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":328,"symbol":"fmt","kind":"constant","lang":"typescript","code":"const fmt = (n: number) =>\n n >= 1e6 ? `${(n / 1e6).toFixed(2)}M` : n >= 1e3 ? `${(n / 1e3).toFixed(1)}k` : n.toFixed(0);"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":334,"symbol":"group","kind":"constant","lang":"typescript","code":"const group = rows.filter((r) => r.category === category);"} {"repo":"zod","file":"packages/bench/moltar-libs.ts","line":342,"symbol":"top","kind":"constant","lang":"typescript","code":"const top = group[0].ops;"} {"repo":"zod","file":"packages/bench/number.ts","line":6,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = makeData(10000, () => Math.random());"} {"repo":"zod","file":"packages/bench/number.ts","line":7,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"z.number().parse\", {\n zod3() {\n for (const _ of DATA) zod3.parse(_);\n },\n zod4() {\n for (const _ of DATA) zod4.parse(_);\n },\n});"} {"repo":"zod","file":"packages/bench/number.ts","line":8,"symbol":"zod3","kind":"method","lang":"typescript","code":"zod3() {\n for (const _ of DATA) zod3.parse(_);\n }"} {"repo":"zod","file":"packages/bench/number.ts","line":11,"symbol":"zod4","kind":"method","lang":"typescript","code":"zod4() {\n for (const _ of DATA) zod4.parse(_);\n }"} {"repo":"zod","file":"packages/bench/object-async.ts","line":4,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"small: z.object().parseAsync\", {\n async zod3() {\n for (const _ of DATA) await zod3.parseAsync(_);\n },\n async zod4() {\n for (const _ of DATA) await zod4.parseAsync(_);\n },\n});"} {"repo":"zod","file":"packages/bench/object-async.ts","line":5,"symbol":"zod3","kind":"method","lang":"typescript","code":"async zod3() {\n for (const _ of DATA) await zod3.parseAsync(_);\n }"} {"repo":"zod","file":"packages/bench/object-async.ts","line":8,"symbol":"zod4","kind":"method","lang":"typescript","code":"async zod4() {\n for (const _ of DATA) await zod4.parseAsync(_);\n }"} {"repo":"zod","file":"packages/bench/object-creation.ts","line":3,"symbol":"ZodFail","kind":"class","lang":"typescript","code":"class ZodFail {\n status = \"fail\";\n constructor(public value: string) {}\n}"} {"repo":"zod","file":"packages/bench/object-creation.ts","line":5,"symbol":"constructor","kind":"method","lang":"typescript","code":"constructor(public value: string) {}"} {"repo":"zod","file":"packages/bench/object-creation.ts","line":8,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"object creation\")\n .add(\"raw object\", () => {\n const obj = { status: \"fail\", value: \"this is a test\" };\n obj.value;\n })\n .add(\"constructor\", () => {\n const obj = new ZodFail(\"this is a test\");\n obj.value;\n });"} {"repo":"zod","file":"packages/bench/object-creation.ts","line":10,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = { status: \"fail\", value: \"this is a test\" };"} {"repo":"zod","file":"packages/bench/object-creation.ts","line":14,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = new ZodFail(\"this is a test\");"} {"repo":"zod","file":"packages/bench/object-fail.ts","line":4,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"small: z.object().safeParseAsync\", {\n zod3() {\n for (const _ of DATA) zod3.parse(_);\n },\n zod4() {\n for (const _ of DATA) zod4.parse(_);\n },\n});"} {"repo":"zod","file":"packages/bench/object-fail.ts","line":5,"symbol":"zod3","kind":"method","lang":"typescript","code":"zod3() {\n for (const _ of DATA) zod3.parse(_);\n }"} {"repo":"zod","file":"packages/bench/object-fail.ts","line":8,"symbol":"zod4","kind":"method","lang":"typescript","code":"zod4() {\n for (const _ of DATA) zod4.parse(_);\n }"} {"repo":"zod","file":"packages/bench/object-moltar-jitless.ts","line":14,"symbol":"z3Schema","kind":"constant","lang":"typescript","code":"const z3Schema = z3.strictObject({\n number: z3.number(),\n negNumber: z3.number(),\n maxNumber: z3.number(),\n string: z3.string(),\n longString: z3.string(),\n boolean: z3.boolean(),\n deeplyNested: z3.strictObject({\n foo: z3.string(),\n num: z3.number(),\n bool: z3.boolean(),\n }),\n});"} {"repo":"zod","file":"packages/bench/object-moltar-jitless.ts","line":28,"symbol":"z4LibSchema","kind":"constant","lang":"typescript","code":"const z4LibSchema = z4lib.strictObject({\n number: z4lib.number(),\n negNumber: z4lib.number(),\n maxNumber: z4lib.number(),\n string: z4lib.string(),\n longString: z4lib.string(),\n boolean: z4lib.boolean(),\n deeplyNested: z4lib.strictObject({\n foo: z4lib.string(),\n num: z4lib.number(),\n bool: z4lib.boolean(),\n }),\n});"} {"repo":"zod","file":"packages/bench/object-moltar-jitless.ts","line":42,"symbol":"z4Schema","kind":"constant","lang":"typescript","code":"const z4Schema = z4.strictObject({\n number: z4.number(),\n negNumber: z4.number(),\n maxNumber: z4.number(),\n string: z4.string(),\n longString: z4.string(),\n boolean: z4.boolean(),\n deeplyNested: z4.strictObject({\n foo: z4.string(),\n num: z4.number(),\n bool: z4.boolean(),\n }),\n});"} {"repo":"zod","file":"packages/bench/object-moltar-jitless.ts","line":56,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = Array.from({ length: 1000 }, () =>\n Object.freeze({\n number: 1,\n negNumber: -1,\n maxNumber: Number.MAX_VALUE,\n string: \"string\",\n longString:\n \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Vivendum intellegat et qui, ei denique consequuntur vix. Semper aeterno percipit ut his, sea ex utinam referrentur repudiandae. No epicuri hendrerit consetetur sit, sit dicta adipiscing ex, in facete detracto deterruisset duo. Quot populo ad qui. Sit fugit nostrum et. Ad per diam dicant interesset, lorem iusto sensibus ut sed. No dicam aperiam vis. Pri posse graeco definitiones cu, id eam populo quaestio adipiscing, usu quod malorum te. Ex nam agam veri, dicunt efficiantur ad qui, ad legere adversarium sit. Commune platonem mel id, brute adipiscing duo an. Vivendum inte"} {"repo":"zod","file":"packages/bench/object-moltar-jitless.ts","line":77,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"z.object() safeParse\", {\n zod3() {\n for (const _ of DATA) z3Schema.parse(_);\n },\n zod4lib() {\n for (const _ of DATA) z4LibSchema.parse(_);\n },\n zod4() {\n for (const _ of DATA) z4Schema.parse(_);\n },\n});"} {"repo":"zod","file":"packages/bench/object-moltar-jitless.ts","line":78,"symbol":"zod3","kind":"method","lang":"typescript","code":"zod3() {\n for (const _ of DATA) z3Schema.parse(_);\n }"} {"repo":"zod","file":"packages/bench/object-moltar-jitless.ts","line":81,"symbol":"zod4lib","kind":"method","lang":"typescript","code":"zod4lib() {\n for (const _ of DATA) z4LibSchema.parse(_);\n }"} {"repo":"zod","file":"packages/bench/object-moltar-jitless.ts","line":84,"symbol":"zod4","kind":"method","lang":"typescript","code":"zod4() {\n for (const _ of DATA) z4Schema.parse(_);\n }"} {"repo":"zod","file":"packages/bench/object-moltar.ts","line":6,"symbol":"z3Schema","kind":"constant","lang":"typescript","code":"const z3Schema = z3.strictObject({\n number: z3.number(),\n negNumber: z3.number(),\n maxNumber: z3.number(),\n string: z3.string(),\n longString: z3.string(),\n boolean: z3.boolean(),\n deeplyNested: z3.strictObject({\n foo: z3.string(),\n num: z3.number(),\n bool: z3.boolean(),\n }),\n});"} {"repo":"zod","file":"packages/bench/object-moltar.ts","line":20,"symbol":"z4LibSchema","kind":"constant","lang":"typescript","code":"const z4LibSchema = z4lib.strictObject({\n number: z4lib.number(),\n negNumber: z4lib.number(),\n maxNumber: z4lib.number(),\n string: z4lib.string(),\n longString: z4lib.string(),\n boolean: z4lib.boolean(),\n deeplyNested: z4lib.strictObject({\n foo: z4lib.string(),\n num: z4lib.number(),\n bool: z4lib.boolean(),\n }),\n});"} {"repo":"zod","file":"packages/bench/object-moltar.ts","line":34,"symbol":"z4Schema","kind":"constant","lang":"typescript","code":"const z4Schema = z4.strictObject({\n number: z4.number(),\n negNumber: z4.number(),\n maxNumber: z4.number(),\n string: z4.string(),\n longString: z4.string(),\n boolean: z4.boolean(),\n deeplyNested: z4.strictObject({\n foo: z4.string(),\n num: z4.number(),\n bool: z4.boolean(),\n }),\n});"} {"repo":"zod","file":"packages/bench/object-moltar.ts","line":48,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = Array.from({ length: 1000 }, () =>\n Object.freeze({\n number: 1,\n negNumber: -1,\n maxNumber: Number.MAX_VALUE,\n string: \"string\",\n longString:\n \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Vivendum intellegat et qui, ei denique consequuntur vix. Semper aeterno percipit ut his, sea ex utinam referrentur repudiandae. No epicuri hendrerit consetetur sit, sit dicta adipiscing ex, in facete detracto deterruisset duo. Quot populo ad qui. Sit fugit nostrum et. Ad per diam dicant interesset, lorem iusto sensibus ut sed. No dicam aperiam vis. Pri posse graeco definitiones cu, id eam populo quaestio adipiscing, usu quod malorum te. Ex nam agam veri, dicunt efficiantur ad qui, ad legere adversarium sit. Commune platonem mel id, brute adipiscing duo an. Vivendum inte"} {"repo":"zod","file":"packages/bench/object-moltar.ts","line":69,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"z.object() safeParse\", {\n zod3() {\n for (const _ of DATA) z3Schema.parse(_);\n },\n zod4lib() {\n for (const _ of DATA) z4LibSchema.parse(_);\n },\n zod4() {\n for (const _ of DATA) z4Schema.parse(_);\n },\n});"} {"repo":"zod","file":"packages/bench/object-moltar.ts","line":70,"symbol":"zod3","kind":"method","lang":"typescript","code":"zod3() {\n for (const _ of DATA) z3Schema.parse(_);\n }"} {"repo":"zod","file":"packages/bench/object-moltar.ts","line":73,"symbol":"zod4lib","kind":"method","lang":"typescript","code":"zod4lib() {\n for (const _ of DATA) z4LibSchema.parse(_);\n }"} {"repo":"zod","file":"packages/bench/object-moltar.ts","line":76,"symbol":"zod4","kind":"method","lang":"typescript","code":"zod4() {\n for (const _ of DATA) z4Schema.parse(_);\n }"} {"repo":"zod","file":"packages/bench/object-safe.ts","line":4,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"small: z.object().safeParse\", {\n zod3() {\n for (const _ of DATA) zod3.safeParse(_);\n },\n zod4() {\n for (const _ of DATA) zod4.safeParse(_);\n },\n});"} {"repo":"zod","file":"packages/bench/object-safe.ts","line":5,"symbol":"zod3","kind":"method","lang":"typescript","code":"zod3() {\n for (const _ of DATA) zod3.safeParse(_);\n }"} {"repo":"zod","file":"packages/bench/object-safe.ts","line":8,"symbol":"zod4","kind":"method","lang":"typescript","code":"zod4() {\n for (const _ of DATA) zod4.safeParse(_);\n }"} {"repo":"zod","file":"packages/bench/object-safeasync.ts","line":4,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"small: z.object().safeParseAsync\", {\n async zod3() {\n for (const _ of DATA) await zod3.spa(_);\n },\n async zod4() {\n for (const _ of DATA) await zod4.spa(_);\n },\n});"} {"repo":"zod","file":"packages/bench/object-safeasync.ts","line":5,"symbol":"zod3","kind":"method","lang":"typescript","code":"async zod3() {\n for (const _ of DATA) await zod3.spa(_);\n }"} {"repo":"zod","file":"packages/bench/object-safeasync.ts","line":8,"symbol":"zod4","kind":"method","lang":"typescript","code":"async zod4() {\n for (const _ of DATA) await zod4.spa(_);\n }"} {"repo":"zod","file":"packages/bench/object-setup.ts","line":12,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA: any[] = makeData(1000, () => {\n return Object.freeze({\n number: Math.random(),\n string: `${Math.random()}`,\n boolean: Math.random() > 0.5,\n });\n});"} {"repo":"zod","file":"packages/bench/object.ts","line":6,"symbol":"z3Schema","kind":"constant","lang":"typescript","code":"const z3Schema = z3.object({\n string: z3.string(),\n boolean: z3.boolean(),\n number: z3.number(),\n});"} {"repo":"zod","file":"packages/bench/object.ts","line":12,"symbol":"z4Schema","kind":"constant","lang":"typescript","code":"const z4Schema = z4.object({\n string: z4.string(),\n boolean: z4.boolean(),\n number: z4.number(),\n});"} {"repo":"zod","file":"packages/bench/object.ts","line":18,"symbol":"valibotSchema","kind":"constant","lang":"typescript","code":"const valibotSchema = v.object({\n string: v.string(),\n boolean: v.boolean(),\n number: v.number(),\n});"} {"repo":"zod","file":"packages/bench/object.ts","line":24,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = Array.from({ length: 1000 }, () =>\n Object.freeze({\n number: Math.random(),\n string: `${Math.random()}`,\n boolean: Math.random() > 0.5,\n })\n);"} {"repo":"zod","file":"packages/bench/object.ts","line":36,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"z.object().parse\", {\n zod3() {\n for (const d of DATA) z3Schema.parse(d);\n },\n zod4() {\n for (const d of DATA) z4Schema.parse(d);\n },\n valibot() {\n for (const d of DATA) v.parse(valibotSchema, d);\n },\n});"} {"repo":"zod","file":"packages/bench/object.ts","line":37,"symbol":"zod3","kind":"method","lang":"typescript","code":"zod3() {\n for (const d of DATA) z3Schema.parse(d);\n }"} {"repo":"zod","file":"packages/bench/object.ts","line":40,"symbol":"zod4","kind":"method","lang":"typescript","code":"zod4() {\n for (const d of DATA) z4Schema.parse(d);\n }"} {"repo":"zod","file":"packages/bench/object.ts","line":43,"symbol":"valibot","kind":"method","lang":"typescript","code":"valibot() {\n for (const d of DATA) v.parse(valibotSchema, d);\n }"} {"repo":"zod","file":"packages/bench/property-access.ts","line":4,"symbol":"objA","kind":"constant","lang":"typescript","code":"const objA = {\n value: randomString(1000),\n};"} {"repo":"zod","file":"packages/bench/property-access.ts","line":9,"symbol":"objB","kind":"constant","lang":"typescript","doc":"with Proxy, no get trap","code":"const objB = new Proxy(\n {\n value: randomString(1000),\n },\n {}\n);"} {"repo":"zod","file":"packages/bench/property-access.ts","line":17,"symbol":"objC","kind":"constant","lang":"typescript","doc":"with Proxy, get/set trap","code":"const objC = new Proxy(\n {\n value: randomString(1000),\n },\n {\n get(target, prop) {\n return (target as any)[prop];\n },\n set(target, prop, value) {\n (target as any)[prop] = value;\n return true;\n },\n }\n);"} {"repo":"zod","file":"packages/bench/property-access.ts","line":22,"symbol":"get","kind":"method","lang":"typescript","code":"get(target, prop) {\n return (target as any)[prop];\n }"} {"repo":"zod","file":"packages/bench/property-access.ts","line":25,"symbol":"set","kind":"method","lang":"typescript","code":"set(target, prop, value) {\n (target as any)[prop] = value;\n return true;\n }"} {"repo":"zod","file":"packages/bench/property-access.ts","line":33,"symbol":"objD","kind":"constant","lang":"typescript","doc":"with Proxy, get/set trap, use Reflect","code":"const objD = new Proxy(\n {\n value: randomString(1000),\n },\n {\n get(target, prop) {\n return Reflect.get(target, prop);\n },\n set(target, prop, value) {\n return Reflect.set(target, prop, value);\n },\n }\n);"} {"repo":"zod","file":"packages/bench/property-access.ts","line":38,"symbol":"get","kind":"method","lang":"typescript","code":"get(target, prop) {\n return Reflect.get(target, prop);\n }"} {"repo":"zod","file":"packages/bench/property-access.ts","line":41,"symbol":"set","kind":"method","lang":"typescript","code":"set(target, prop, value) {\n return Reflect.set(target, prop, value);\n }"} {"repo":"zod","file":"packages/bench/property-access.ts","line":48,"symbol":"r","kind":"constant","lang":"typescript","doc":"getter","code":"const r = randomString(1000);"} {"repo":"zod","file":"packages/bench/property-access.ts","line":49,"symbol":"objE","kind":"constant","lang":"typescript","code":"const objE = {\n get value() {\n return r;\n },\n};"} {"repo":"zod","file":"packages/bench/property-access.ts","line":50,"symbol":"value","kind":"method","lang":"typescript","code":"get value() {\n return r;\n }"} {"repo":"zod","file":"packages/bench/property-access.ts","line":55,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"property access\", {\n // internal_prop() {\n // a.value;\n // },\n // scope_prop() {\n // b.value;\n // },\n // getter_override() {\n // c.value;\n // },\n\n objB() {\n objB.value;\n },\n objC() {\n objC.value;\n },\n objD() {\n objD.value;\n },\n objE() {\n objE.value;\n },\n objA() {\n objA.value;\n },\n objNone() {},\n});"} {"repo":"zod","file":"packages/bench/property-access.ts","line":66,"symbol":"objB","kind":"method","lang":"typescript","code":"objB() {\n objB.value;\n }"} {"repo":"zod","file":"packages/bench/property-access.ts","line":69,"symbol":"objC","kind":"method","lang":"typescript","code":"objC() {\n objC.value;\n }"} {"repo":"zod","file":"packages/bench/property-access.ts","line":72,"symbol":"objD","kind":"method","lang":"typescript","code":"objD() {\n objD.value;\n }"} {"repo":"zod","file":"packages/bench/property-access.ts","line":75,"symbol":"objE","kind":"method","lang":"typescript","code":"objE() {\n objE.value;\n }"} {"repo":"zod","file":"packages/bench/property-access.ts","line":78,"symbol":"objA","kind":"method","lang":"typescript","code":"objA() {\n objA.value;\n }"} {"repo":"zod","file":"packages/bench/property-access.ts","line":81,"symbol":"objNone","kind":"method","lang":"typescript","code":"objNone() {}"} {"repo":"zod","file":"packages/bench/safe.ts","line":4,"symbol":"ZodFail","kind":"class","lang":"typescript","code":"class ZodFail {\n status = \"fail\";\n constructor(public value: string) {\n // super();\n }\n}"} {"repo":"zod","file":"packages/bench/safe.ts","line":6,"symbol":"constructor","kind":"method","lang":"typescript","code":"constructor(public value: string) {\n // super();\n }"} {"repo":"zod","file":"packages/bench/safe.ts","line":11,"symbol":"makeSuccess","kind":"function","lang":"typescript","code":"function makeSuccess(value: unknown) {\n return { status: \"success\", value };\n}"} {"repo":"zod","file":"packages/bench/safe.ts","line":14,"symbol":"makeFail","kind":"function","lang":"typescript","code":"function makeFail(value: unknown) {\n return { status: \"success\", value };\n}"} {"repo":"zod","file":"packages/bench/safe.ts","line":18,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = benchWithData({\n name: \"safe return\",\n data() {\n return Math.random() > 0.5 ? randomString(15) : Math.random();\n },\n batch: 1000,\n benchmarks: {\n baseline(d) {\n return typeof d !== \"string\";\n },\n\n discUnion(d) {\n if (typeof d !== \"string\") {\n return makeFail(d);\n } else {\n return makeSuccess(d);\n }\n },\n union(d) {\n if (typeof d !== \"string\") {\n return new ZodFail(\"too big\");\n } else {\n return d;\n }\n },\n },\n});"} {"repo":"zod","file":"packages/bench/safe.ts","line":20,"symbol":"data","kind":"method","lang":"typescript","code":"data() {\n return Math.random() > 0.5 ? randomString(15) : Math.random();\n }"} {"repo":"zod","file":"packages/bench/safe.ts","line":25,"symbol":"baseline","kind":"method","lang":"typescript","code":"baseline(d) {\n return typeof d !== \"string\";\n }"} {"repo":"zod","file":"packages/bench/safe.ts","line":29,"symbol":"discUnion","kind":"method","lang":"typescript","code":"discUnion(d) {\n if (typeof d !== \"string\") {\n return makeFail(d);\n } else {\n return makeSuccess(d);\n }\n }"} {"repo":"zod","file":"packages/bench/safe.ts","line":36,"symbol":"union","kind":"method","lang":"typescript","code":"union(d) {\n if (typeof d !== \"string\") {\n return new ZodFail(\"too big\");\n } else {\n return d;\n }\n }"} {"repo":"zod","file":"packages/bench/safeparse.ts","line":4,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n string: z.string(),\n boolean: z.boolean(),\n number: z.number(),\n});"} {"repo":"zod","file":"packages/bench/safeparse.ts","line":10,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = Array.from({ length: 1000 }, () =>\n Object.freeze({\n // number: Math.random(),\n // string: `${Math.random()}`,\n // boolean: Math.random() > 0.5,\n })\n);"} {"repo":"zod","file":"packages/bench/safeparse.ts","line":22,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"safeparse vs parse — fail\", {\n parse() {\n for (const d of DATA) {\n try {\n const _result = schema.parse(d);\n } catch (_e) {\n _e;\n }\n }\n },\n safeparse() {\n for (const d of DATA) {\n const result = schema.safeParse(d);\n result.error;\n }\n },\n});"} {"repo":"zod","file":"packages/bench/safeparse.ts","line":23,"symbol":"parse","kind":"method","lang":"typescript","code":"parse() {\n for (const d of DATA) {\n try {\n const _result = schema.parse(d);\n } catch (_e) {\n _e;\n }\n }\n }"} {"repo":"zod","file":"packages/bench/safeparse.ts","line":26,"symbol":"_result","kind":"constant","lang":"typescript","code":"const _result = schema.parse(d);"} {"repo":"zod","file":"packages/bench/safeparse.ts","line":32,"symbol":"safeparse","kind":"method","lang":"typescript","code":"safeparse() {\n for (const d of DATA) {\n const result = schema.safeParse(d);\n result.error;\n }\n }"} {"repo":"zod","file":"packages/bench/safeparse.ts","line":34,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(d);"} {"repo":"zod","file":"packages/bench/single-element-enum.ts","line":6,"symbol":"z4LibSchema","kind":"constant","lang":"typescript","code":"const z4LibSchema = zod4.enum([\"a\"]);"} {"repo":"zod","file":"packages/bench/single-element-enum.ts","line":8,"symbol":"z4Schema","kind":"constant","lang":"typescript","code":"const z4Schema = zodNext.enum([\"a\"]);"} {"repo":"zod","file":"packages/bench/single-element-enum.ts","line":10,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = Array.from({ length: 10000 }, () => \"a\");"} {"repo":"zod","file":"packages/bench/single-element-enum.ts","line":15,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"single-element enum parse\", {\n zodNext() {\n for (const _ of DATA) z4LibSchema.parse(\"a\");\n },\n zod4() {\n for (const _ of DATA) z4Schema.parse(\"a\");\n },\n});"} {"repo":"zod","file":"packages/bench/single-element-enum.ts","line":16,"symbol":"zodNext","kind":"method","lang":"typescript","code":"zodNext() {\n for (const _ of DATA) z4LibSchema.parse(\"a\");\n }"} {"repo":"zod","file":"packages/bench/single-element-enum.ts","line":19,"symbol":"zod4","kind":"method","lang":"typescript","code":"zod4() {\n for (const _ of DATA) z4Schema.parse(\"a\");\n }"} {"repo":"zod","file":"packages/bench/single-item-union.ts","line":6,"symbol":"z4LibSchema","kind":"constant","lang":"typescript","code":"const z4LibSchema = zod4.union([zod4.object({ value: zod4.string() })]);"} {"repo":"zod","file":"packages/bench/single-item-union.ts","line":8,"symbol":"z4Schema","kind":"constant","lang":"typescript","code":"const z4Schema = zodNext.union([zodNext.object({ value: zodNext.string() })]);"} {"repo":"zod","file":"packages/bench/single-item-union.ts","line":10,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = Array.from({ length: 100 }, () => ({ value: randomString(15) }));"} {"repo":"zod","file":"packages/bench/single-item-union.ts","line":15,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"single item union\", {\n zodNext() {\n z4LibSchema.parse({ value: \"asdfadfs\" });\n },\n zod4() {\n z4Schema.parse({ value: \"asdfadfs\" });\n },\n});"} {"repo":"zod","file":"packages/bench/single-item-union.ts","line":16,"symbol":"zodNext","kind":"method","lang":"typescript","code":"zodNext() {\n z4LibSchema.parse({ value: \"asdfadfs\" });\n }"} {"repo":"zod","file":"packages/bench/single-item-union.ts","line":19,"symbol":"zod4","kind":"method","lang":"typescript","code":"zod4() {\n z4Schema.parse({ value: \"asdfadfs\" });\n }"} {"repo":"zod","file":"packages/bench/string.ts","line":6,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = makeData(10000, () => `${Math.random()}`);"} {"repo":"zod","file":"packages/bench/string.ts","line":7,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"z.string().parse\", {\n zod3() {\n for (const _ of DATA) zod3.parse(_);\n },\n zod4() {\n for (const _ of DATA) zod4.parse(_);\n },\n});"} {"repo":"zod","file":"packages/bench/string.ts","line":8,"symbol":"zod3","kind":"method","lang":"typescript","code":"zod3() {\n for (const _ of DATA) zod3.parse(_);\n }"} {"repo":"zod","file":"packages/bench/string.ts","line":11,"symbol":"zod4","kind":"method","lang":"typescript","code":"zod4() {\n for (const _ of DATA) zod4.parse(_);\n }"} {"repo":"zod","file":"packages/bench/typia-case/src/index.ts","line":3,"symbol":"Fixture","kind":"interface","lang":"typescript","code":"interface Fixture {\n number: number;\n negNumber: number;\n maxNumber: number;\n string: string;\n longString: string;\n boolean: boolean;\n deeplyNested: {\n foo: string;\n num: number;\n bool: boolean;\n };\n}"} {"repo":"zod","file":"packages/bench/typia-case/src/index.ts","line":17,"symbol":"is","kind":"constant","lang":"typescript","code":"const is = typia.createIs();"} {"repo":"zod","file":"packages/bench/typia-case/src/index.ts","line":18,"symbol":"equals","kind":"constant","lang":"typescript","code":"const equals = typia.createEquals();"} {"repo":"zod","file":"packages/bench/typia-case/src/index.ts","line":19,"symbol":"clone","kind":"constant","lang":"typescript","code":"const clone = typia.misc.createClone();"} {"repo":"zod","file":"packages/bench/union.ts","line":5,"symbol":"aSchema","kind":"constant","lang":"typescript","code":"const aSchema = z.object({\n type: z.literal(\"a\"),\n });"} {"repo":"zod","file":"packages/bench/union.ts","line":9,"symbol":"bSchema","kind":"constant","lang":"typescript","code":"const bSchema = z.object({\n type: z.literal(\"b\"),\n });"} {"repo":"zod","file":"packages/bench/union.ts","line":13,"symbol":"cSchema","kind":"constant","lang":"typescript","code":"const cSchema = z.object({\n type: z.literal(\"c\"),\n });"} {"repo":"zod","file":"packages/bench/union.ts","line":20,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = { type: \"c\" };"} {"repo":"zod","file":"packages/bench/union.ts","line":21,"symbol":"bench","kind":"constant","lang":"typescript","code":"const bench = metabench(\"z.union().parse\")\n .add(\"zod3\", () => {\n zod3.parse(DATA);\n })\n .add(\"zod4\", () => {\n zod4.parse(DATA);\n });"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":9,"symbol":"Case","kind":"interface","lang":"typescript","code":"interface Case {\n name: string;\n group: string;\n schema: z.ZodType;\n valid: unknown;\n invalid: unknown;\n}"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":17,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases: Case[] = [];"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":18,"symbol":"add","kind":"constant","lang":"typescript","code":"const add = (group: string, name: string, schema: z.ZodType, valid: unknown, invalid: unknown) =>\n cases.push({ group, name, schema, valid, invalid });"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":22,"symbol":"objShape","kind":"constant","lang":"typescript","doc":"---- key-count sweep, one wrong key at three positions ---------------------","code":"const objShape = (n: number) => {\n const shape: Record = {};\n for (let i = 0; i < n; i++) shape[`k${i}`] = z.string();\n return z.object(shape) as z.ZodType;\n};"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":23,"symbol":"shape","kind":"constant","lang":"typescript","code":"const shape: Record = {};"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":27,"symbol":"objInput","kind":"constant","lang":"typescript","code":"const objInput = (n: number) => {\n const o: Record = {};\n for (let i = 0; i < n; i++) o[`k${i}`] = \"v\";\n return o;\n};"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":28,"symbol":"o","kind":"constant","lang":"typescript","code":"const o: Record = {};"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":34,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = objShape(n);"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":35,"symbol":"valid","kind":"constant","lang":"typescript","code":"const valid = objInput(n);"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":36,"symbol":"mid","kind":"constant","lang":"typescript","code":"const mid = Math.floor(n / 2);"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":41,"symbol":"missing","kind":"constant","lang":"typescript","code":"const missing = { ...valid };"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":49,"symbol":"valid","kind":"constant","lang":"typescript","code":"const valid = Array.from({ length: n }, (_, i) => `s${i}`);"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":50,"symbol":"mid","kind":"constant","lang":"typescript","code":"const mid = Math.floor(n / 2);"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":61,"symbol":"rowSchema","kind":"constant","lang":"typescript","doc":"---- nested shapes ---------------------------------------------------------","code":"const rowSchema = z.object({ id: z.number(), name: z.string(), active: z.boolean() });"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":63,"symbol":"valid","kind":"constant","lang":"typescript","code":"const valid = Array.from({ length: n }, (_, i) => ({ id: i, name: `n${i}`, active: true }));"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":64,"symbol":"mid","kind":"constant","lang":"typescript","code":"const mid = Math.floor(n / 2);"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":74,"symbol":"deep","kind":"constant","lang":"typescript","code":"const deep = (depth: number): z.ZodType =>\n depth === 0\n ? z.object({ leaf: z.string(), a: z.string(), b: z.string() })\n : z.object({ next: deep(depth - 1), a: z.string(), b: z.string() });"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":78,"symbol":"deepInput","kind":"constant","lang":"typescript","code":"const deepInput = (depth: number, badAt: number): any =>\n depth === 0\n ? { leaf: badAt === 0 ? 1 : \"x\", a: \"x\", b: \"x\" }\n : { next: deepInput(depth - 1, badAt - 1), a: \"x\", b: \"x\" };"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":116,"symbol":"collect","kind":"constant","lang":"typescript","code":"const collect = typeof (globalThis as any).gc === \"function\" ? (globalThis as any).gc : () => {};"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":117,"symbol":"HAS_GC","kind":"constant","lang":"typescript","code":"const HAS_GC = typeof (globalThis as any).gc === \"function\";"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":118,"symbol":"ROUNDS","kind":"constant","lang":"typescript","code":"const ROUNDS = 15;"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":124,"symbol":"CTX_OFF","kind":"constant","lang":"typescript","doc":"Both carry both keys, so the guard is the only difference the measurement can see.","code":"const CTX_OFF = { async: false, abortEarly: false } as any;"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":125,"symbol":"CTX_ON","kind":"constant","lang":"typescript","code":"const CTX_ON = { async: false, abortEarly: true } as any;"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":127,"symbol":"timed","kind":"function","lang":"typescript","code":"function timed(fn: () => void, iters: number): number {\n collect();\n const start = process.hrtime.bigint();\n for (let i = 0; i < iters; i++) fn();\n return Number(process.hrtime.bigint() - start) / 1e6;\n}"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":129,"symbol":"start","kind":"constant","lang":"typescript","code":"const start = process.hrtime.bigint();"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":134,"symbol":"calibrate","kind":"function","lang":"typescript","code":"function calibrate(fn: () => void): number {\n let iters = 64;\n for (;;) {\n const start = process.hrtime.bigint();\n for (let i = 0; i < iters; i++) fn();\n const ms = Number(process.hrtime.bigint() - start) / 1e6;\n if (ms > 25 || iters > 4_000_000) return iters;\n iters = Math.max(iters * 2, Math.ceil((iters * 40) / Math.max(ms, 0.05)));\n }\n}"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":137,"symbol":"start","kind":"constant","lang":"typescript","code":"const start = process.hrtime.bigint();"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":139,"symbol":"ms","kind":"constant","lang":"typescript","code":"const ms = Number(process.hrtime.bigint() - start) / 1e6;"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":145,"symbol":"Measurement","kind":"interface","lang":"typescript","code":"interface Measurement {\n offNs: number;\n onNs: number;\n issuesOff: number;\n issuesOn: number;\n}"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":152,"symbol":"measure","kind":"function","lang":"typescript","code":"function measure(schema: z.ZodType, input: unknown): Measurement {\n const pool = Array.from({ length: 64 }, () => input);\n let idx = 0;\n // _zod.run is read at call time: the object JIT replaces it on first use, so a reference captured up front would measure the stale interpreted path.\n const off = () => {\n const r = (schema as any)._zod.run({ value: pool[idx++ & 63], issues: [] }, CTX_OFF);\n sink += r.issues.length + (r.issues.length === 0 ? 1 : 0);\n escaped = r;\n };\n const on = () => {\n const r = (schema as any)._zod.run({ value: pool[idx++ & 63], issues: [] }, CTX_ON);\n sink += r.issues.length + (r.issues.length === 0 ? 1 : 0);\n escaped = r;\n };\n\n const issuesOff = (schema as any)._zod.run({ value: input, issues: [] }, CTX_OFF).issues.length;\n const issuesOn = (schema as any)._zod.run({ value: input, issues: [] }, CTX_ON).issues.length;\n\n const iters = calibrate(off);\n for (let i = 0; i < 5; i++) {\n off();\n on();\n }\n\n let bestOff = Number.POSITIVE_INFINITY;\n let bestOn = Number.POSITIVE_INFINITY;\n for (let r = 0; r < ROUNDS; r++) {\n bestOff = Math.min(bestOff, timed(off, iters));\n bestOn = Math.min(bestOn, timed(on, iters));\n }\n ret"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":153,"symbol":"pool","kind":"constant","lang":"typescript","code":"const pool = Array.from({ length: 64 }, () => input);"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":156,"symbol":"off","kind":"constant","lang":"typescript","doc":"_zod.run is read at call time: the object JIT replaces it on first use, so a reference captured up front would measure the stale interpreted path.","code":"const off = () => {\n const r = (schema as any)._zod.run({ value: pool[idx++ & 63], issues: [] }, CTX_OFF);\n sink += r.issues.length + (r.issues.length === 0 ? 1 : 0);\n escaped = r;\n };"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":157,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = (schema as any)._zod.run({ value: pool[idx++ & 63], issues: [] }, CTX_OFF);"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":161,"symbol":"on","kind":"constant","lang":"typescript","code":"const on = () => {\n const r = (schema as any)._zod.run({ value: pool[idx++ & 63], issues: [] }, CTX_ON);\n sink += r.issues.length + (r.issues.length === 0 ? 1 : 0);\n escaped = r;\n };"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":162,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = (schema as any)._zod.run({ value: pool[idx++ & 63], issues: [] }, CTX_ON);"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":167,"symbol":"issuesOff","kind":"constant","lang":"typescript","code":"const issuesOff = (schema as any)._zod.run({ value: input, issues: [] }, CTX_OFF).issues.length;"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":168,"symbol":"issuesOn","kind":"constant","lang":"typescript","code":"const issuesOn = (schema as any)._zod.run({ value: input, issues: [] }, CTX_ON).issues.length;"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":170,"symbol":"iters","kind":"constant","lang":"typescript","code":"const iters = calibrate(off);"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":185,"symbol":"Row","kind":"interface","lang":"typescript","code":"interface Row {\n group: string;\n name: string;\n valid: Measurement;\n invalid: Measurement;\n}"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":192,"symbol":"problems","kind":"constant","lang":"typescript","code":"const problems: string[] = [];"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":210,"symbol":"rows","kind":"constant","lang":"typescript","code":"const rows: Row[] = [];"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":220,"symbol":"fmtNs","kind":"constant","lang":"typescript","code":"const fmtNs = (n: number) => (n >= 1000 ? `${(n / 1000).toFixed(2)}µs` : `${n.toFixed(0)}ns`);"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":221,"symbol":"pad","kind":"constant","lang":"typescript","code":"const pad = (s: string, n: number) => s.padEnd(n);"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":222,"symbol":"padL","kind":"constant","lang":"typescript","code":"const padL = (s: string, n: number) => s.padStart(n);"} {"repo":"zod","file":"packages/bench/validate-abort-sweep.ts","line":248,"symbol":"validRatios","kind":"constant","lang":"typescript","code":"const validRatios = rows.map((r) => r.valid.offNs / r.valid.onNs).sort((a, b) => a - b);"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":10,"symbol":"Case","kind":"interface","lang":"typescript","code":"interface Case {\n name: string;\n schema: z.ZodType;\n valid: unknown;\n invalid: unknown;\n}"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":17,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases: Case[] = [];"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":18,"symbol":"add","kind":"constant","lang":"typescript","code":"const add = (name: string, schema: z.ZodType, valid: unknown, invalid: unknown) =>\n cases.push({ name, schema, valid, invalid });"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":26,"symbol":"flat5","kind":"constant","lang":"typescript","code":"const flat5 = { a: \"x\", b: 1, c: true, d: \"y\", e: 2 };"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":34,"symbol":"wide20","kind":"constant","lang":"typescript","code":"const wide20 = Object.fromEntries(Array.from({ length: 20 }, (_, i) => [`k${i}`, \"v\"]));"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":42,"symbol":"moltarValid","kind":"constant","lang":"typescript","code":"const moltarValid = {\n number: 1,\n negNumber: -1,\n maxNumber: Number.MAX_VALUE,\n string: \"string\",\n longString: \"Lorem ipsum dolor sit amet, consectetur adipiscing elit\",\n boolean: true,\n deeplyNested: { foo: \"bar\", num: 1, bool: false },\n};"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":98,"symbol":"collect","kind":"constant","lang":"typescript","code":"const collect = typeof (globalThis as any).gc === \"function\" ? (globalThis as any).gc : () => {};"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":99,"symbol":"HAS_GC","kind":"constant","lang":"typescript","code":"const HAS_GC = typeof (globalThis as any).gc === \"function\";"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":101,"symbol":"ROUNDS","kind":"constant","lang":"typescript","code":"const ROUNDS = 15;"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":107,"symbol":"timed","kind":"function","lang":"typescript","code":"function timed(fn: () => void, iters: number): number {\n collect();\n const start = process.hrtime.bigint();\n for (let i = 0; i < iters; i++) fn();\n return Number(process.hrtime.bigint() - start) / 1e6; // ms\n}"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":109,"symbol":"start","kind":"constant","lang":"typescript","code":"const start = process.hrtime.bigint();"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":115,"symbol":"calibrate","kind":"function","lang":"typescript","doc":"Iterations that put one measurement near ~40ms, so a round is short but not noise.","code":"function calibrate(fn: () => void): number {\n let iters = 64;\n for (;;) {\n const start = process.hrtime.bigint();\n for (let i = 0; i < iters; i++) fn();\n const ms = Number(process.hrtime.bigint() - start) / 1e6;\n if (ms > 25 || iters > 4_000_000) return iters;\n iters = Math.max(iters * 2, Math.ceil((iters * 40) / Math.max(ms, 0.05)));\n }\n}"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":118,"symbol":"start","kind":"constant","lang":"typescript","code":"const start = process.hrtime.bigint();"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":120,"symbol":"ms","kind":"constant","lang":"typescript","code":"const ms = Number(process.hrtime.bigint() - start) / 1e6;"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":126,"symbol":"Measurement","kind":"interface","lang":"typescript","code":"interface Measurement {\n safeParseNs: number;\n validateNs: number;\n}"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":131,"symbol":"Pair","kind":"interface","lang":"typescript","code":"interface Pair {\n plain: Measurement;\n compiled: Measurement | null;\n}"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":137,"symbol":"measure","kind":"function","lang":"typescript","doc":"all four calls alternate inside a round and share one iteration count, so every ratio the harness prints is paired","code":"function measure(plain: z.ZodType, compiled: z.ZodType | null, input: unknown): Pair {\n // Feed the input through an array load. Passed as a constant the whole call is loop-invariant and V8 hoists it out of the timing loop.\n const pool = Array.from({ length: 64 }, () => input);\n let idx = 0;\n const safeParseOn = (s: z.ZodType) => () => {\n const r = s.safeParse(pool[idx++ & 63]);\n sink += r.success ? 1 : 0;\n escaped = r;\n };\n const validateOn = (s: z.ZodType) => () => {\n const ok = z.validate(s, pool[idx++ & 63]);\n sink += ok ? 1 : 0;\n escaped = ok;\n };\n\n const ops = [safeParseOn(plain), validateOn(plain)];\n if (compiled) ops.push(safeParseOn(compiled), validateOn(compiled));\n\n // the plain safeParse is the slowest of the four, so calibrating on it keeps every block at or under the ~40ms target\n const iters = calibrate(ops[0]);\n for (let i = 0; i < 3; i++) for (const op of ops) op();\n\n const best = ops.map(() => Number.POSITIVE_INFINITY);\n for (let r = 0; r < ROUNDS; r++)\n for (let i = 0; i < ops.length; i++) best[i] = Math.min(best[i], timed(ops[i], iters));\n\n const ns = (i: number) => (best[i] * 1e6) / iters;\n return {\n plain: { safeParseNs:"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":139,"symbol":"pool","kind":"constant","lang":"typescript","doc":"Feed the input through an array load. Passed as a constant the whole call is loop-invariant and V8 hoists it out of the timing loop.","code":"const pool = Array.from({ length: 64 }, () => input);"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":141,"symbol":"safeParseOn","kind":"constant","lang":"typescript","code":"const safeParseOn = (s: z.ZodType) => () => {\n const r = s.safeParse(pool[idx++ & 63]);\n sink += r.success ? 1 : 0;\n escaped = r;\n };"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":142,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = s.safeParse(pool[idx++ & 63]);"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":146,"symbol":"validateOn","kind":"constant","lang":"typescript","code":"const validateOn = (s: z.ZodType) => () => {\n const ok = z.validate(s, pool[idx++ & 63]);\n sink += ok ? 1 : 0;\n escaped = ok;\n };"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":147,"symbol":"ok","kind":"constant","lang":"typescript","code":"const ok = z.validate(s, pool[idx++ & 63]);"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":152,"symbol":"ops","kind":"constant","lang":"typescript","code":"const ops = [safeParseOn(plain), validateOn(plain)];"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":156,"symbol":"iters","kind":"constant","lang":"typescript","doc":"the plain safeParse is the slowest of the four, so calibrating on it keeps every block at or under the ~40ms target","code":"const iters = calibrate(ops[0]);"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":159,"symbol":"best","kind":"constant","lang":"typescript","code":"const best = ops.map(() => Number.POSITIVE_INFINITY);"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":163,"symbol":"ns","kind":"constant","lang":"typescript","code":"const ns = (i: number) => (best[i] * 1e6) / iters;"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":170,"symbol":"Row","kind":"interface","lang":"typescript","code":"interface Row {\n name: string;\n compiled: boolean;\n valid: Measurement;\n invalid: Measurement;\n}"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":177,"symbol":"rows","kind":"constant","lang":"typescript","code":"const rows: Row[] = [];"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":178,"symbol":"problems","kind":"constant","lang":"typescript","code":"const problems: string[] = [];"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":180,"symbol":"Target","kind":"interface","lang":"typescript","code":"interface Target {\n name: string;\n compiled: boolean;\n schema: z.ZodType;\n valid: unknown;\n invalid: unknown;\n}"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":188,"symbol":"CasePair","kind":"interface","lang":"typescript","code":"interface CasePair {\n name: string;\n plain: z.ZodType;\n compiled: z.ZodType | null;\n valid: unknown;\n invalid: unknown;\n}"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":196,"symbol":"targets","kind":"constant","lang":"typescript","code":"const targets: Target[] = [];"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":197,"symbol":"pairs","kind":"constant","lang":"typescript","code":"const pairs: CasePair[] = [];"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":233,"symbol":"valid","kind":"constant","lang":"typescript","code":"const valid = measure(p.plain, p.compiled, p.valid);"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":234,"symbol":"invalid","kind":"constant","lang":"typescript","code":"const invalid = measure(p.plain, p.compiled, p.invalid);"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":240,"symbol":"fmtNs","kind":"constant","lang":"typescript","code":"const fmtNs = (n: number) => (n >= 1000 ? `${(n / 1000).toFixed(1)}µs` : `${n.toFixed(0)}ns`);"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":241,"symbol":"pad","kind":"constant","lang":"typescript","code":"const pad = (s: string, n: number) => s.padEnd(n);"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":242,"symbol":"padL","kind":"constant","lang":"typescript","code":"const padL = (s: string, n: number) => s.padStart(n);"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":245,"symbol":"subset","kind":"constant","lang":"typescript","code":"const subset = rows.filter((r) => r.compiled === mode);"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":268,"symbol":"ratios","kind":"constant","lang":"typescript","code":"const ratios = subset.map((r) => r[key].safeParseNs / r[key].validateNs).sort((a, b) => a - b);"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":277,"symbol":"cross","kind":"constant","lang":"typescript","code":"const cross = rows\n .filter((r) => !r.compiled)\n .map((r) => ({ name: r.name, compiled: rows.find((o) => o.name === r.name && o.compiled) }))\n .filter((r): r is { name: string; compiled: Row } => !!r.compiled);"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":290,"symbol":"plainSp","kind":"constant","lang":"typescript","code":"const plainSp = rows.find((o) => o.name === c.name && !o.compiled)!.invalid.safeParseNs;"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":291,"symbol":"compV","kind":"constant","lang":"typescript","code":"const compV = c.compiled.invalid.validateNs;"} {"repo":"zod","file":"packages/bench/validate-vs-safeparse.ts","line":297,"symbol":"ratios","kind":"constant","lang":"typescript","code":"const ratios = cross\n .map(\n (c) => rows.find((o) => o.name === c.name && !o.compiled)!.invalid.safeParseNs / c.compiled.invalid.validateNs\n )\n .sort((a, b) => a - b);"} {"repo":"zod","file":"packages/docs/app/(doc)/[[...slug]]/page.tsx","line":17,"symbol":"Page","kind":"function","lang":"tsx","code":"async function Page(props: {\n params: Promise<{ slug?: string[] }>;\n}) {\n const params = await props.params;\n const page = source.getPage(params.slug);\n if (!page) notFound();\n\n const title = page.data.title;\n const markdownContent = await getLLMText(page);\n\n const MDXContent = page.data.body;\n const toc = page.data.toc\n .filter((item) => item.depth <= 3)\n .map((item) => {\n return item;\n });\n\n return (\n \n {title && title !== \"Intro\" && (\n
\n {title}\n
\n
\n \n ;\n}) {\n const params = await props.params;\n const page = source.getPage(params.slug);\n if (!page) notFound();\n\n const rootTitle = page.data.title ?? \"Home\";\n const title = rootTitle + \" | Zod\";\n const description = page.data.description;\n return {\n title,\n description,\n openGraph: {\n type: \"website\",\n title,\n description,\n siteName: \"Zod\",\n url: `https://zod.dev/${page.slugs.join(\"/\")}`,\n images: [\n {\n url: `/og.png?title=${encodeURIComponent(rootTitle)}&description=${encodeURIComponent(description ?? \"\")}&path=${encodeURIComponent(`${[\"zod.dev\", ...page.slugs].join(\"/\")}`)}`,\n width: 1200,\n height: 630,\n alt: title,\n },\n ],\n },\n twitter: {\n card: \"summary_large_image\",\n title,\n description,\n creator: \"@colinhacks\",\n site: \"@colinhacks\",\n },\n keywords: [\"zod\", \"typescript\", \"validation\", \"schema\"],\n };\n}"} {"repo":"zod","file":"packages/docs/app/(doc)/layout.tsx","line":76,"symbol":"Layout","kind":"function","lang":"tsx","code":"function Layout({ children }: { children: ReactNode }) {\n return (\n \n {children}\n \n );\n}"} {"repo":"zod","file":"packages/docs/app/(doc)/not-found.tsx","line":6,"symbol":"NotFound","kind":"function","lang":"tsx","doc":"rendered inside the (doc) layout, which already provides the docs shell","code":"function NotFound() {\n return (\n \n
\n

404

\n

This page could not be found.

\n
\n
\n );\n}"} {"repo":"zod","file":"packages/docs/app/blog/[slug]/page.tsx","line":20,"symbol":"MetaLine","kind":"function","lang":"tsx","code":"function MetaLine({ author, date }: { author: string; date?: Date }) {\n return (\n

\n \n {author}\n \n {date ? (\n <>\n ·\n \n \n ) : null}\n

\n );\n}"} {"repo":"zod","file":"packages/docs/app/blog/[slug]/page.tsx","line":36,"symbol":"Page","kind":"function","lang":"tsx","code":"async function Page(props: { params: Promise<{ slug: string }> }) {\n const params = await props.params;\n const page = blog.getPage([params.slug]) as any;\n\n if (!page || isHidden(page)) notFound();\n const Mdx = page.data.body as ComponentType;\n const title: string = page.data?.title ?? params.slug;\n const author: string = page.data?.author ?? \"Colin McDonnell\";\n const date = page.data?.date ? new Date(page.data.date) : undefined;\n // h2s plus their h3s, except under Bug fixes where the h3s are long and numerous\n let section = \"\";\n const sections = ((page.data?.toc ?? []) as TocEntry[]).filter((t) => {\n if (t.depth === 2) section = t.url;\n return t.depth === 2 || (t.depth === 3 && section !== \"#bug-fixes\");\n });\n\n return (\n
\n
\n
\n \n

!isHidden(page))\n .map((page) => ({\n slug: page.slugs[0],\n }));\n}"} {"repo":"zod","file":"packages/docs/app/blog/[slug]/page.tsx","line":124,"symbol":"generateMetadata","kind":"function","lang":"tsx","code":"async function generateMetadata(props: { params: Promise<{ slug: string }> }) {\n const params = await props.params;\n const page = blog.getPage([params.slug]) as any;\n\n if (!page || isHidden(page)) notFound();\n\n const title = stripBackticks((page.data?.title as string | undefined) ?? params.slug);\n const description = (page.data?.description as string | undefined) ?? undefined;\n const url = `https://zod.dev/blog/${params.slug}`;\n // same generated card the docs pages use\n const image = {\n url: `/og.png?title=${encodeURIComponent(title)}&description=${encodeURIComponent(description ?? \"\")}&path=${encodeURIComponent(`zod.dev/blog/${params.slug}`)}`,\n width: 1200,\n height: 630,\n alt: title,\n };\n\n return {\n title,\n description,\n openGraph: { type: \"article\", title, description, siteName: \"Zod\", url, images: [image] },\n twitter: { card: \"summary_large_image\", title, description, images: [image], creator: \"@colinhacks\", site: \"@colinhacks\" },\n };\n}"} {"repo":"zod","file":"packages/docs/app/blog/layout.tsx","line":15,"symbol":"BlogLayout","kind":"function","lang":"tsx","doc":"the star pill takes the navbar's top-right slot; `on: \"nav\"` keeps it in the bar itself on mobile rather than in the collapsed menu","code":"function BlogLayout({ children }: { children: ReactNode }) {\n return (\n \n \n \n ),\n },\n ]}\n >\n {children}\n \n );\n}"} {"repo":"zod","file":"packages/docs/app/blog/page.tsx","line":7,"symbol":"BlogIndexPage","kind":"function","lang":"tsx","code":"function BlogIndexPage() {\n const posts = (blog.getPages() as any[])\n .filter((post) => !post.data?.draft)\n .sort((a, b) => new Date(b.data?.date ?? 0).getTime() - new Date(a.data?.date ?? 0).getTime());\n\n return (\n
\n
\n

\n Blog\n \n \n RSS\n \n {posts.length} posts\n \n

\n
    \n {posts.map((post) => {\n const title = post.data.title ?? post.slugs.join(\"/\") ?? \"Untitled\";\n const description = post.data.description ?? \"\";\n const dateValue = post.data?.date as string | Date | undefined;\n return (\n
  • \n text.replaceAll(\"&\", \"&\").replaceAll(\"<\", \"<\").replaceAll(\">\", \">\");"} {"repo":"zod","file":"packages/docs/app/blog/rss.xml/route.ts","line":9,"symbol":"GET","kind":"function","lang":"typescript","code":"function GET() {\n const posts = (blog.getPages() as any[])\n .filter((post) => !post.data?.draft)\n .sort((a, b) => new Date(b.data?.date ?? 0).getTime() - new Date(a.data?.date ?? 0).getTime());\n\n const items = posts.map((post) => {\n const url = `https://zod.dev${post.url}`;\n const title = stripBackticks((post.data?.title as string | undefined) ?? post.slugs.join(\"/\"));\n const description = (post.data?.description as string | undefined) ?? \"\";\n const pubDate = new Date(post.data?.date ?? 0).toUTCString();\n return ` \n ${escapeXml(title)}\n ${url}\n ${url}\n ${pubDate}\n ${escapeXml(description)}\n `;\n });\n\n const xml = `\n\n \n Zod Blog\n https://zod.dev/blog\n Release announcements and engineering deep dives from Zod.\n en-us\n \n${items.join(\"\\n\")}\n \n"} {"repo":"zod","file":"packages/docs/app/blog/rss.xml/route.ts","line":10,"symbol":"posts","kind":"constant","lang":"typescript","code":"const posts = (blog.getPages() as any[])\n .filter((post) => !post.data?.draft)\n .sort((a, b) => new Date(b.data?.date ?? 0).getTime() - new Date(a.data?.date ?? 0).getTime());"} {"repo":"zod","file":"packages/docs/app/blog/rss.xml/route.ts","line":14,"symbol":"items","kind":"constant","lang":"typescript","code":"const items = posts.map((post) => {\n const url = `https://zod.dev${post.url}`;\n const title = stripBackticks((post.data?.title as string | undefined) ?? post.slugs.join(\"/\"));\n const description = (post.data?.description as string | undefined) ?? \"\";\n const pubDate = new Date(post.data?.date ?? 0).toUTCString();\n return ` \n ${escapeXml(title)}\n ${url}\n ${url}\n ${pubDate}\n ${escapeXml(description)}\n `;\n });"} {"repo":"zod","file":"packages/docs/app/blog/rss.xml/route.ts","line":15,"symbol":"url","kind":"constant","lang":"typescript","code":"const url = `https://zod.dev${post.url}`;"} {"repo":"zod","file":"packages/docs/app/blog/rss.xml/route.ts","line":16,"symbol":"title","kind":"constant","lang":"typescript","code":"const title = stripBackticks((post.data?.title as string | undefined) ?? post.slugs.join(\"/\"));"} {"repo":"zod","file":"packages/docs/app/blog/rss.xml/route.ts","line":17,"symbol":"description","kind":"constant","lang":"typescript","code":"const description = (post.data?.description as string | undefined) ?? \"\";"} {"repo":"zod","file":"packages/docs/app/blog/rss.xml/route.ts","line":18,"symbol":"pubDate","kind":"constant","lang":"typescript","code":"const pubDate = new Date(post.data?.date ?? 0).toUTCString();"} {"repo":"zod","file":"packages/docs/app/blog/rss.xml/route.ts","line":28,"symbol":"xml","kind":"constant","lang":"typescript","code":"const xml = `\n\n \n Zod Blog\n https://zod.dev/blog\n Release announcements and engineering deep dives from Zod.\n en-us\n \n${items.join(\"\\n\")}\n \n\n`;"} {"repo":"zod","file":"packages/docs/app/layout.tsx","line":16,"symbol":"Layout","kind":"function","lang":"tsx","code":"function Layout({ children }: { children: ReactNode }) {\n return (\n \n \n {/* Preload critical images to prevent FOUC */}\n \n \n \n \n \n \n 💎 Zod 4.6 is out!  \n \n Read the announcement.\n \n \n \n \n \n {children}\n \n \n \n \n \n \n );\n}"} {"repo":"zod","file":"packages/docs/app/llms-full.txt/route.ts","line":6,"symbol":"revalidate","kind":"constant","lang":"typescript","code":"const revalidate = false;"} {"repo":"zod","file":"packages/docs/app/llms-full.txt/route.ts","line":8,"symbol":"GET","kind":"function","lang":"typescript","code":"async function GET() {\n const pages = source.getPages();\n\n // Read meta.json to get the page order\n const metaPath = join(process.cwd(), \"content\", \"meta.json\");\n const meta = JSON.parse(await fs.readFile(metaPath, \"utf-8\"));\n\n // Create a map of page URLs to their order in meta.json\n const pageOrder = new Map();\n meta.pages.forEach((page: string, index: number) => {\n pageOrder.set(page, index);\n });\n\n // Sort pages according to meta.json order\n const sortedPages = pages.sort((a, b) => {\n const aOrder = pageOrder.get(a.url) ?? Number.MAX_SAFE_INTEGER;\n const bOrder = pageOrder.get(b.url) ?? Number.MAX_SAFE_INTEGER;\n return aOrder - bOrder;\n });\n\n // Generate content\n let txt = `# Zod\n\nZod is a TypeScript-first schema validation library with static type inference. This documentation provides comprehensive coverage of Zod 4's features, API, and usage patterns.\n\n`;\n\n // Process each page\n for (const page of sortedPages) {\n txt += await getLLMText(page);\n txt += \"\\n\\n\";\n }\n\n return new Response(txt, {\n headers: { \"Content-Type\": \"text/plain; charset=utf-8\" },\n });\n}"} {"repo":"zod","file":"packages/docs/app/llms-full.txt/route.ts","line":9,"symbol":"pages","kind":"constant","lang":"typescript","code":"const pages = source.getPages();"} {"repo":"zod","file":"packages/docs/app/llms-full.txt/route.ts","line":12,"symbol":"metaPath","kind":"constant","lang":"typescript","doc":"Read meta.json to get the page order","code":"const metaPath = join(process.cwd(), \"content\", \"meta.json\");"} {"repo":"zod","file":"packages/docs/app/llms-full.txt/route.ts","line":13,"symbol":"meta","kind":"constant","lang":"typescript","code":"const meta = JSON.parse(await fs.readFile(metaPath, \"utf-8\"));"} {"repo":"zod","file":"packages/docs/app/llms-full.txt/route.ts","line":16,"symbol":"pageOrder","kind":"constant","lang":"typescript","doc":"Create a map of page URLs to their order in meta.json","code":"const pageOrder = new Map();"} {"repo":"zod","file":"packages/docs/app/llms-full.txt/route.ts","line":22,"symbol":"sortedPages","kind":"constant","lang":"typescript","doc":"Sort pages according to meta.json order","code":"const sortedPages = pages.sort((a, b) => {\n const aOrder = pageOrder.get(a.url) ?? Number.MAX_SAFE_INTEGER;\n const bOrder = pageOrder.get(b.url) ?? Number.MAX_SAFE_INTEGER;\n return aOrder - bOrder;\n });"} {"repo":"zod","file":"packages/docs/app/llms-full.txt/route.ts","line":23,"symbol":"aOrder","kind":"constant","lang":"typescript","code":"const aOrder = pageOrder.get(a.url) ?? Number.MAX_SAFE_INTEGER;"} {"repo":"zod","file":"packages/docs/app/llms-full.txt/route.ts","line":24,"symbol":"bOrder","kind":"constant","lang":"typescript","code":"const bOrder = pageOrder.get(b.url) ?? Number.MAX_SAFE_INTEGER;"} {"repo":"zod","file":"packages/docs/app/llms.txt/route.ts","line":4,"symbol":"revalidate","kind":"constant","lang":"typescript","doc":"cached forever","code":"const revalidate = false;"} {"repo":"zod","file":"packages/docs/app/llms.txt/route.ts","line":6,"symbol":"stringifyTitle","kind":"function","lang":"typescript","code":"function stringifyTitle(title: any): string {\n if (typeof title === \"string\") return title;\n if (typeof title === \"number\" || typeof title === \"bigint\" || typeof title === \"boolean\") {\n return String(title);\n }\n\n // Handle React elements and complex objects\n if (title && typeof title === \"object\") {\n // If it's a React element with props.children\n if (title.props?.children) {\n return stringifyTitle(title.props.children);\n }\n\n // If it's an array, join the elements\n if (Array.isArray(title)) {\n return title.map(stringifyTitle).join(\"\");\n }\n\n // If it has a textContent property\n if (title.textContent) {\n return String(title.textContent);\n }\n\n // Try to extract text from common React element patterns\n if (title.type && (title.type === \"span\" || title.type === \"code\" || typeof title.type === \"string\")) {\n if (typeof title.props?.children === \"string\") {\n return title.props.children;\n }\n }\n }\n\n return \"\";\n}"} {"repo":"zod","file":"packages/docs/app/llms.txt/route.ts","line":40,"symbol":"GET","kind":"function","lang":"typescript","code":"async function GET() {\n const pages = source.getPages();\n\n // Generate LLMS.txt content\n let txt = `# Zod\n\n> Zod is a TypeScript-first schema validation library with static type inference. This documentation provides comprehensive coverage of Zod 4's features, API, and usage patterns.\n\n`;\n\n // Process each page\n for (const page of pages) {\n // Skip separator entries that start with \"---\"\n const title = stringifyTitle(page.data.title);\n if (title.startsWith(\"---\")) {\n continue;\n }\n\n // Create section for each page\n txt += `## ${title || \"Untitled\"}\\n\\n`;\n\n // Add main page link with description from frontmatter\n const pageUrl = `https://zod.dev${page.url}`;\n const description = page.data.description || \"Documentation page\";\n txt += `- [${title || \"Untitled\"}](${pageUrl}): ${description}\\n`;\n\n // Add TOC sections for deep linking\n if (page.data.toc && page.data.toc.length > 0) {\n // Group sections by depth for better organization\n const sections = page.data.toc.filter((item: any) => item.depth >= 2 && item.depth <= 4);\n\n if (sections.length > 0) {\n txt += \"\\n\";\n\n for (const section of sections) {\n con"} {"repo":"zod","file":"packages/docs/app/llms.txt/route.ts","line":41,"symbol":"pages","kind":"constant","lang":"typescript","code":"const pages = source.getPages();"} {"repo":"zod","file":"packages/docs/app/llms.txt/route.ts","line":53,"symbol":"title","kind":"constant","lang":"typescript","doc":"Skip separator entries that start with \"---\"","code":"const title = stringifyTitle(page.data.title);"} {"repo":"zod","file":"packages/docs/app/llms.txt/route.ts","line":62,"symbol":"pageUrl","kind":"constant","lang":"typescript","doc":"Add main page link with description from frontmatter","code":"const pageUrl = `https://zod.dev${page.url}`;"} {"repo":"zod","file":"packages/docs/app/llms.txt/route.ts","line":63,"symbol":"description","kind":"constant","lang":"typescript","code":"const description = page.data.description || \"Documentation page\";"} {"repo":"zod","file":"packages/docs/app/llms.txt/route.ts","line":69,"symbol":"sections","kind":"constant","lang":"typescript","doc":"Group sections by depth for better organization","code":"const sections = page.data.toc.filter((item: any) => item.depth >= 2 && item.depth <= 4);"} {"repo":"zod","file":"packages/docs/app/llms.txt/route.ts","line":75,"symbol":"sectionTitle","kind":"constant","lang":"typescript","code":"const sectionTitle = stringifyTitle(section.title);"} {"repo":"zod","file":"packages/docs/app/llms.txt/route.ts","line":78,"symbol":"anchor","kind":"constant","lang":"typescript","code":"const anchor = section.url.replace(\"#\", \"\");"} {"repo":"zod","file":"packages/docs/app/llms.txt/route.ts","line":79,"symbol":"fullUrl","kind":"constant","lang":"typescript","code":"const fullUrl = `https://zod.dev${page.url}?id=${anchor}`;"} {"repo":"zod","file":"packages/docs/app/not-found.tsx","line":7,"symbol":"NotFound","kind":"function","lang":"tsx","code":"function NotFound() {\n return (\n \n \n
    \n

    404

    \n

    This page could not be found.

    \n
    \n
    \n
    \n );\n}"} {"repo":"zod","file":"packages/docs/app/og.png/route.tsx","line":15,"symbol":"GET","kind":"function","lang":"tsx","doc":"export const loadImage = (img: string) => { const p = path.join(process.cwd(), img); const image = fs.readFileSync(p); return image.toString(\"base64\"); };","code":"async function GET(request: Request) {\n try {\n const { searchParams } = new URL(request.url);\n const imagePrefix = process.env.VERCEL_URL ? `https://zod.dev` : \"http://localhost:3000\";\n\n // Get dynamic params\n const title = searchParams.get(\"title\") || \"Zod Documentation\";\n // a long title wraps to three or more lines, and the description would push the footer off the canvas\n const description = title.length > 60 ? null : searchParams.get(\"description\");\n\n return new ImageResponse(\n \n {/* Logo in upper right corner */}\n \n \"Zod\n \n New\n \n \n \n \n \n \n );\n}"} {"repo":"zod","file":"packages/docs/components/blog-toc.tsx","line":5,"symbol":"TocEntry","kind":"interface","lang":"tsx","code":"interface TocEntry {\n title: ReactNode;\n url: string;\n depth: number;\n}"} {"repo":"zod","file":"packages/docs/components/blog-toc.tsx","line":11,"symbol":"Indicator","kind":"interface","lang":"tsx","code":"interface Indicator {\n top: number;\n height: number;\n}"} {"repo":"zod","file":"packages/docs/components/blog-toc.tsx","line":25,"symbol":"BlogToc","kind":"function","lang":"tsx","code":"function BlogToc({ sections, labelClassName }: { sections: TocEntry[]; labelClassName?: string }) {\n const [activeId, setActiveId] = useState(null);\n const [indicator, setIndicator] = useState(null);\n const railRef = useRef(null);\n const linksRef = useRef(new Map());\n\n const ids = sections.map((t) => t.url.replace(/^#/, \"\"));\n // a stable key so the observer only re-subscribes when the headings themselves change\n const idKey = ids.join(\"\\n\");\n\n useEffect(() => {\n const headingIds = idKey ? idKey.split(\"\\n\") : [];\n if (!headingIds.length) return;\n let observed: HTMLElement[] = [];\n\n // the observer is just a trigger, so every callback re-reads positions\n function sync() {\n // looked up fresh each time, because a hot reload of the post swaps in new heading elements\n const headings = headingIds.map((id) => document.getElementById(id)).filter((el) => el !== null);\n if (!headings.length) return;\n if (headings.length !== observed.length || headings.some((el, i) => el !== observed[i])) {\n for (const el of observed) observer.unobserve(el);\n for (const el of h"} {"repo":"zod","file":"packages/docs/components/blog-toc.tsx","line":41,"symbol":"sync","kind":"function","lang":"tsx","doc":"the observer is just a trigger, so every callback re-reads positions","code":"function sync() {\n // looked up fresh each time, because a hot reload of the post swaps in new heading elements\n const headings = headingIds.map((id) => document.getElementById(id)).filter((el) => el !== null);\n if (!headings.length) return;\n if (headings.length !== observed.length || headings.some((el, i) => el !== observed[i])) {\n for (const el of observed) observer.unobserve(el);\n for (const el of headings) observer.observe(el);\n observed = headings;\n }\n // a short last section never reaches the marker, so the page end hands it the highlight\n if (window.scrollY + window.innerHeight >= document.documentElement.scrollHeight - BOTTOM_SLACK) {\n setActiveId(headings[headings.length - 1].id);\n return;\n }\n const marker = window.innerHeight * MARKER;\n let current = headings[0];\n for (const el of headings) {\n if (el.getBoundingClientRect().top > marker) break;\n current = el;\n }\n setActiveId(current.id);\n }"} {"repo":"zod","file":"packages/docs/components/codec-image.tsx","line":5,"symbol":"ThemedImageProps","kind":"interface","lang":"tsx","code":"interface ThemedImageProps {\n lightSrc: string;\n darkSrc: string;\n alt: string;\n className?: string;\n}"} {"repo":"zod","file":"packages/docs/components/codec-image.tsx","line":12,"symbol":"ThemedImage","kind":"function","lang":"tsx","code":"function ThemedImage({ lightSrc, darkSrc, alt, className }: ThemedImageProps) {\n return (\n
    \n {/* Light mode image */}\n \n \n {/* Dark mode image */}\n \n
    \n );\n}"} {"repo":"zod","file":"packages/docs/components/copy-markdown-button.tsx","line":6,"symbol":"CopyMarkdownButtonProps","kind":"interface","lang":"tsx","code":"interface CopyMarkdownButtonProps {\n content: string;\n className?: string;\n}"} {"repo":"zod","file":"packages/docs/components/copy-markdown-button.tsx","line":11,"symbol":"CopyMarkdownButton","kind":"function","lang":"tsx","code":"function CopyMarkdownButton({ content, className = \"\" }: CopyMarkdownButtonProps) {\n const [copied, setCopied] = useState(false);\n\n const handleCopy = async () => {\n try {\n await navigator.clipboard.writeText(content);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n } catch (err) {\n console.error(\"Failed to copy markdown:\", err);\n }\n };\n\n return (\n \n
    \n {copied ? : }\n Copy markdown\n
    \n \n );\n}"} {"repo":"zod","file":"packages/docs/components/ecosystem.tsx","line":4,"symbol":"ZodResource","kind":"interface","lang":"tsx","code":"interface ZodResource {\n name: string;\n url: string;\n description: React.ReactNode;\n slug: string;\n stars?: number;\n}"} {"repo":"zod","file":"packages/docs/components/ecosystem.tsx","line":423,"symbol":"Table","kind":"function","lang":"tsx","code":"function Table(props: { resources: ZodResource[] }) {\n return (\n \n \n \n \n \n {/* */}\n \n \n \n \n {props.resources.map((resource) => (\n \n \n \n {/* */}\n \n \n ))}\n \n
    NameStarsZod 4 supportDescription
    \n \n {resource.name}\n \n {`⭐️ ${resource.stars ?? \"—\"}`}{`⭐️ ${resource.v4 ? \"✅\" : \"\"}`}{resource.description}
    \n );\n}"} {"repo":"zod","file":"packages/docs/components/ecosystem.tsx","line":456,"symbol":"ResourceTable","kind":"function","lang":"tsx","code":"async function ResourceTable({ resources }: ResourceTableProps) {\n await fetchStars(resources);\n\n return ;\n}"} {"repo":"zod","file":"packages/docs/components/ecosystem.tsx","line":462,"symbol":"ApiLibraries","kind":"function","lang":"tsx","code":"async function ApiLibraries() {\n return ;\n}"} {"repo":"zod","file":"packages/docs/components/ecosystem.tsx","line":466,"symbol":"FormIntegrations","kind":"function","lang":"tsx","code":"async function FormIntegrations() {\n return ;\n}"} {"repo":"zod","file":"packages/docs/components/ecosystem.tsx","line":470,"symbol":"ZodToX","kind":"function","lang":"tsx","code":"async function ZodToX() {\n return ;\n}"} {"repo":"zod","file":"packages/docs/components/ecosystem.tsx","line":474,"symbol":"XToZod","kind":"function","lang":"tsx","code":"async function XToZod() {\n return ;\n}"} {"repo":"zod","file":"packages/docs/components/ecosystem.tsx","line":478,"symbol":"MockingLibraries","kind":"function","lang":"tsx","code":"async function MockingLibraries() {\n return ;\n}"} {"repo":"zod","file":"packages/docs/components/ecosystem.tsx","line":482,"symbol":"PoweredByZod","kind":"function","lang":"tsx","code":"async function PoweredByZod() {\n return ;\n}"} {"repo":"zod","file":"packages/docs/components/ecosystem.tsx","line":486,"symbol":"ZodUtilities","kind":"function","lang":"tsx","code":"async function ZodUtilities() {\n return ;\n}"} {"repo":"zod","file":"packages/docs/components/featured.tsx","line":8,"symbol":"Featured","kind":"function","lang":"tsx","code":"function Featured(props: { data: FeatureData }) {\n const { data: feature } = props;\n return (\n <>\n \n Featured sponsor: {feature.name}\n \n
    \n \n
    \n \n \n {`${feature.name}\n \n
    \n
    \n

    \n Interested in featuring?{\" \"}\n \n Get in touch.\n \n

    \n
    \n \n );\n}"} {"repo":"zod","file":"packages/docs/components/github-star-pill.tsx","line":4,"symbol":"GitHubMark","kind":"function","lang":"tsx","doc":"official invertocat mark","code":"function GitHubMark({ className }: { className?: string }) {\n return (\n \n \n \n );\n}"} {"repo":"zod","file":"packages/docs/components/github-star-pill.tsx","line":13,"symbol":"StarIcon","kind":"function","lang":"tsx","doc":"github's outline `star-16` octicon; hollow reads as \"not starred yet\"","code":"function StarIcon({ className }: { className?: string }) {\n return (\n \n \n \n );\n}"} {"repo":"zod","file":"packages/docs/components/github-star-pill.tsx","line":22,"symbol":"formatStars","kind":"function","lang":"tsx","doc":"github-style abbreviation: 41400 → \"41.4k\", 2000 → \"2k\", under 1k exact","code":"function formatStars(count: number): string {\n if (count < 1000) return String(count);\n return `${(count / 1000).toFixed(1).replace(/\\.0$/, \"\")}k`;\n}"} {"repo":"zod","file":"packages/docs/components/github-star-pill.tsx","line":28,"symbol":"GitHubStarPill","kind":"function","lang":"tsx","doc":"the navbar's github entry as a star-button pill in its unstarred state; only the border takes the accent on hover","code":"async function GitHubStarPill({ repo }: { repo: string }) {\n const resource: { slug: string; stars?: number } = { slug: repo };\n await fetchStars([resource]);\n const stars = resource.stars;\n\n return (\n \n \n \n \n {stars !== undefined && {formatStars(stars)}}\n \n \n );\n}"} {"repo":"zod","file":"packages/docs/components/heading.tsx","line":12,"symbol":"Heading","kind":"function","lang":"tsx","code":"function Heading({ as, className, ...props }: HeadingProps): React.ReactElement {\n const As = as ?? \"h1\";\n\n if (!props.id) return ;\n\n return (\n \n {\n // // function __handleScroll(){\n // // if id query parameter is present, scroll to the element with that id\n // const params = new URLSearchParams(window.location.search);\n // console.dir(params, { depth: null });\n // const id = params.get(\"id\");\n // console.dir(params, { depth: null });\n // if (id) {\n // console.dir(document.getElementById(id), { depth: null });\n // document.getElementById(id)?.scrollIntoView();\n // }\n // // }\n // }}\n >\n {props.children}\n \n \n setIsLoaded(true)}\n style={{ height: \"100%\", width: \"auto\" }}\n />\n\n setIsLoaded(true)}\n style={{ height: \"100%\", width: \"auto\" }}\n />\n \n );\n}"} {"repo":"zod","file":"packages/docs/components/if.tsx","line":3,"symbol":"If","kind":"function","lang":"tsx","code":"function If(props: { groupId: string; values: string[]; children: any }) {\n if (typeof window === \"undefined\") return null;\n // read key from localstorage\n const value = window.localStorage.getItem(props.groupId);\n // if key is in values, return children\n if (value && props.values.includes(value)) {\n return props.children;\n }\n}"} {"repo":"zod","file":"packages/docs/components/inkeep-bubble.tsx","line":6,"symbol":"InkeepBubble","kind":"function","lang":"tsx","code":"function InkeepBubble() {\n // color mode sync target\n const [syncTarget, setSyncTarget] = useState(null);\n\n // document is not available in the server\n useEffect(() => {\n setSyncTarget(document.documentElement);\n }, []);\n\n const config = {\n baseSettings: {\n apiKey: process.env.NEXT_PUBLIC_INKEEP_KEY!, // required\n primaryBrandColor: \"#EE63C0\", // your brand color, widget color scheme is derived from this\n organizationDisplayName: \"Zod\",\n // ...optional settings\n colorMode: {\n sync: {\n target: syncTarget!,\n attributes: [\"class\"],\n isDarkMode: (attributes: any) => !!attributes.class?.includes(\"dark\"),\n },\n },\n theme: {\n styles: [\n {\n key: \"custom-theme\",\n type: \"style\",\n\n value: `\n .ikp-chat-button__container {\n z-index: var(--ikp-z-index-overlay);\n }`,\n },\n ],\n },\n },\n searchSettings: {\n // optional settings\n },\n aiChatSettings: {\n // optional settings\n\n aiAssistantAvatar: \"https://zod.dev/logo/logo.png\", // use your own ai assistant avatar\n "} {"repo":"zod","file":"packages/docs/components/inkeep-search.tsx","line":7,"symbol":"InkeepSearchBox","kind":"function","lang":"tsx","code":"function InkeepSearchBox(props: SharedProps) {\n const [syncTarget, setSyncTarget] = useState(null);\n const { open, onOpenChange } = props;\n // We do this because document is not available in the server\n useEffect(() => {\n setSyncTarget(document.documentElement);\n }, []);\n\n // if(!syncTarget) return null;\n\n const config: InkeepModalSearchAndChatProps = {\n baseSettings: {\n apiKey: process.env.NEXT_PUBLIC_INKEEP_KEY, // required\n primaryBrandColor: \"#EE63C0\", // your brand color, widget color scheme is derived from this\n organizationDisplayName: \"Zod\",\n // ...optional settings\n colorMode: {\n sync: {\n target: syncTarget!,\n attributes: [\"class\"],\n isDarkMode: (attributes) => !!attributes.class?.includes(\"dark\"),\n },\n },\n },\n modalSettings: {\n isOpen: open,\n onOpenChange,\n // optional settings\n },\n // searchSettings: {\n // // optional settings\n // },\n // aiChatSettings: {\n // // optional settings\n // aiAssistantAvatar: \"https://mydomain.com/mylogo\", // use your own ai assistant avatar\n // exampleQuestions: [\"Example question 1?\", \"Ex"} {"repo":"zod","file":"packages/docs/components/inline-code-title.tsx","line":4,"symbol":"InlineCodeTitle","kind":"function","lang":"tsx","doc":"renders `code` spans in a frontmatter title as ; stripBackticks() is the plain-text form for metadata","code":"function InlineCodeTitle({ text }: { text: string }) {\n const parts = text.split(\"`\");\n return (\n <>\n {parts.map((part, i) =>\n i % 2 === 1 ? <code key={i}>{part}</code> : <Fragment key={i}>{part}</Fragment>\n )}\n </>\n );\n}"} {"repo":"zod","file":"packages/docs/components/scroller.tsx","line":7,"symbol":"Scroller","kind":"function","lang":"tsx","code":"function Scroller() {\n const pathname = usePathname();\n const searchParams = useSearchParams();\n // const firstRender = useRef(true);\n\n // run after every route or query-string change\n // biome-ignore lint/correctness/useExhaustiveDependencies: pathname and searchParams only retrigger the effect\n useEffect(() => {\n // skip the very first render if you only care about later navigations\n handleScroll();\n // firstRender.current = false;\n }, [pathname, searchParams]);\n\n // also run once on the initial load (optional)\n useEffect(handleScroll, []);\n\n function handleScroll() {\n // accept either ?id=foo or #foo\n const id = searchParams?.get(\"id\") ?? window.location.hash.slice(1);\n const el = id ? document.getElementById(id) : null;\n el?.scrollIntoView();\n }\n\n return null;\n}"} {"repo":"zod","file":"packages/docs/components/scroller.tsx","line":23,"symbol":"handleScroll","kind":"function","lang":"tsx","code":"function handleScroll() {\n // accept either ?id=foo or #foo\n const id = searchParams?.get(\"id\") ?? window.location.hash.slice(1);\n const el = id ? document.getElementById(id) : null;\n el?.scrollIntoView();\n }"} {"repo":"zod","file":"packages/docs/components/sidebar-logo.tsx","line":6,"symbol":"SidebarLogo","kind":"function","lang":"tsx","code":"function SidebarLogo({ src, alt, width = 24, height = 24, className = \"h-5\" }: ImageProps) {\n const [isLoaded, setIsLoaded] = useState(false);\n\n return (\n <div className=\"relative\" style={{ width: `${width}px`, height: `${height}px` }}>\n <Image\n className={`transition-opacity duration-300 ${isLoaded ? \"opacity-100\" : \"opacity-0\"} ${className}`}\n alt={alt}\n src={src}\n width={width}\n height={height}\n quality={100}\n onLoad={() => setIsLoaded(true)}\n style={{ width: \"auto\", height: \"100%\" }}\n />\n </div>\n );\n}"} {"repo":"zod","file":"packages/docs/components/themed-image.tsx","line":6,"symbol":"ThemedImageProps","kind":"interface","lang":"tsx","code":"interface ThemedImageProps {\n lightSrc: string;\n darkSrc: string;\n alt: string;\n caption?: ReactNode;\n className?: string;\n}"} {"repo":"zod","file":"packages/docs/components/themed-image.tsx","line":14,"symbol":"ThemedImage","kind":"function","lang":"tsx","code":"function ThemedImage({ lightSrc, darkSrc, alt, caption, className }: ThemedImageProps) {\n return (\n <figure className={`my-6 ${className || \"\"}`}>\n <div className=\"rounded-lg border border-fd-border p-1\">\n <div className=\"relative overflow-hidden rounded-md border border-fd-border\">\n {/* Light mode image */}\n <Image\n className=\"my-0 block dark:hidden\"\n alt={alt}\n src={lightSrc}\n width={800}\n height={400}\n quality={100}\n style={{ height: \"auto\", width: \"100%\" }}\n />\n\n {/* Dark mode image */}\n <Image\n className=\"my-0 hidden dark:block\"\n alt={alt}\n src={darkSrc}\n width={800}\n height={400}\n quality={100}\n style={{ height: \"auto\", width: \"100%\" }}\n />\n </div>\n </div>\n {caption ? (\n <figcaption className=\"mx-auto mt-2 max-w-[65%] text-center text-sm text-fd-muted-foreground\">{caption}</figcaption>\n ) : null}\n </figure>\n );\n}"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":6,"symbol":"SourceLine","kind":"type","lang":"typescript","code":"type SourceLine = {\n text: string;\n number: number;\n};"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":11,"symbol":"CodeFence","kind":"type","lang":"typescript","code":"type CodeFence = {\n startLine: number;\n lineCount: number;\n};"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":16,"symbol":"TabBlock","kind":"type","lang":"typescript","code":"type TabBlock = {\n value: string;\n line: number;\n codeFences: CodeFence[];\n};"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":22,"symbol":"TabsBlock","kind":"type","lang":"typescript","code":"type TabsBlock = {\n startLine: number;\n tabs: TabBlock[];\n};"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":27,"symbol":"apiDocsPath","kind":"constant","lang":"typescript","code":"const apiDocsPath = resolve(dirname(fileURLToPath(import.meta.url)), \"api.mdx\");"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":30,"symbol":"source","kind":"constant","lang":"typescript","code":"const source = await readFile(apiDocsPath, \"utf8\");"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":31,"symbol":"tabsBlocks","kind":"constant","lang":"typescript","code":"const tabsBlocks = extractTabsBlocks(source);"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":32,"symbol":"failures","kind":"constant","lang":"typescript","code":"const failures: string[] = [];"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":38,"symbol":"zodTab","kind":"constant","lang":"typescript","code":"const zodTab = block.tabs.find((tab) => tab.value === \"Zod\");"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":39,"symbol":"zodMiniTab","kind":"constant","lang":"typescript","code":"const zodMiniTab = block.tabs.find((tab) => tab.value === \"Zod Mini\");"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":53,"symbol":"extractTabsBlocks","kind":"function","lang":"typescript","code":"function extractTabsBlocks(source: string): TabsBlock[] {\n const lines = stripMdxComments(source);\n const blocks: TabsBlock[] = [];\n\n for (let index = 0; index < lines.length; index++) {\n const line = lines[index];\n\n if (!line || !/<Tabs\\b/.test(line.text)) {\n continue;\n }\n\n const tabs: TabBlock[] = [];\n let currentTab: TabBlock | undefined;\n\n for (index += 1; index < lines.length; index++) {\n const blockLine = lines[index];\n\n if (!blockLine || /<\\/Tabs>/.test(blockLine.text)) {\n break;\n }\n\n const tabValue = getTabValue(blockLine.text);\n\n if (tabValue) {\n currentTab = { value: tabValue, line: blockLine.number, codeFences: [] };\n tabs.push(currentTab);\n continue;\n }\n\n if (/<\\/Tab>/.test(blockLine.text)) {\n currentTab = undefined;\n continue;\n }\n\n if (currentTab && blockLine.text.trimStart().startsWith(\"```\")) {\n const codeFence = readCodeFence(lines, index, blockLine.number);\n currentTab.codeFences.push(codeFence);\n index += codeFence.lineCount + 1;\n }\n }\n\n blocks.push({ startLine: line.number, tabs });\n }\n\n return blocks;\n}"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":54,"symbol":"lines","kind":"constant","lang":"typescript","code":"const lines = stripMdxComments(source);"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":55,"symbol":"blocks","kind":"constant","lang":"typescript","code":"const blocks: TabsBlock[] = [];"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":58,"symbol":"line","kind":"constant","lang":"typescript","code":"const line = lines[index];"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":64,"symbol":"tabs","kind":"constant","lang":"typescript","code":"const tabs: TabBlock[] = [];"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":68,"symbol":"blockLine","kind":"constant","lang":"typescript","code":"const blockLine = lines[index];"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":74,"symbol":"tabValue","kind":"constant","lang":"typescript","code":"const tabValue = getTabValue(blockLine.text);"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":88,"symbol":"codeFence","kind":"constant","lang":"typescript","code":"const codeFence = readCodeFence(lines, index, blockLine.number);"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":100,"symbol":"stripMdxComments","kind":"function","lang":"typescript","code":"function stripMdxComments(source: string): SourceLine[] {\n const lines = source.split(/\\r?\\n/);\n const sourceLines: SourceLine[] = [];\n let inCodeFence = false;\n const mdxCommentState = { inComment: false };\n\n for (let index = 0; index < lines.length; index++) {\n const line = lines[index] ?? \"\";\n const isFenceBoundary = line.trimStart().startsWith(\"```\");\n\n if (isFenceBoundary) {\n inCodeFence = !inCodeFence;\n }\n\n sourceLines.push({\n text: inCodeFence ? line : stripMdxCommentSegments(line, mdxCommentState),\n number: index + 1,\n });\n }\n\n return sourceLines;\n}"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":101,"symbol":"lines","kind":"constant","lang":"typescript","code":"const lines = source.split(/\\r?\\n/);"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":102,"symbol":"sourceLines","kind":"constant","lang":"typescript","code":"const sourceLines: SourceLine[] = [];"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":104,"symbol":"mdxCommentState","kind":"constant","lang":"typescript","code":"const mdxCommentState = { inComment: false };"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":107,"symbol":"line","kind":"constant","lang":"typescript","code":"const line = lines[index] ?? \"\";"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":108,"symbol":"isFenceBoundary","kind":"constant","lang":"typescript","code":"const isFenceBoundary = line.trimStart().startsWith(\"```\");"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":123,"symbol":"stripMdxCommentSegments","kind":"function","lang":"typescript","code":"function stripMdxCommentSegments(line: string, state: { inComment: boolean }): string {\n let result = \"\";\n let index = 0;\n\n while (index < line.length) {\n if (state.inComment) {\n const commentEnd = line.indexOf(\"*/}\", index);\n\n if (commentEnd === -1) {\n return result;\n }\n\n state.inComment = false;\n index = commentEnd + 3;\n continue;\n }\n\n const commentStart = line.indexOf(\"{/*\", index);\n\n if (commentStart === -1) {\n result += line.slice(index);\n break;\n }\n\n result += line.slice(index, commentStart);\n state.inComment = true;\n index = commentStart + 3;\n }\n\n return result;\n}"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":129,"symbol":"commentEnd","kind":"constant","lang":"typescript","code":"const commentEnd = line.indexOf(\"*/}\", index);"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":140,"symbol":"commentStart","kind":"constant","lang":"typescript","code":"const commentStart = line.indexOf(\"{/*\", index);"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":155,"symbol":"getTabValue","kind":"function","lang":"typescript","code":"function getTabValue(line: string): string | undefined {\n const quotedValue = line.match(/<Tab\\b[^>]*\\bvalue\\s*=\\s*([\"'])(.*?)\\1/);\n\n if (quotedValue?.[2]) {\n return quotedValue[2];\n }\n\n const expressionValue = line.match(/<Tab\\b[^>]*\\bvalue\\s*=\\s*\\{\\s*([\"'])(.*?)\\1\\s*\\}/);\n return expressionValue?.[2];\n}"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":156,"symbol":"quotedValue","kind":"constant","lang":"typescript","code":"const quotedValue = line.match(/<Tab\\b[^>]*\\bvalue\\s*=\\s*([\"'])(.*?)\\1/);"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":162,"symbol":"expressionValue","kind":"constant","lang":"typescript","code":"const expressionValue = line.match(/<Tab\\b[^>]*\\bvalue\\s*=\\s*\\{\\s*([\"'])(.*?)\\1\\s*\\}/);"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":166,"symbol":"readCodeFence","kind":"function","lang":"typescript","code":"function readCodeFence(lines: SourceLine[], fenceStartIndex: number, startLine: number): CodeFence {\n let lineCount = 0;\n\n for (let index = fenceStartIndex + 1; index < lines.length; index++) {\n const line = lines[index];\n\n if (!line || line.text.trimStart().startsWith(\"```\")) {\n break;\n }\n\n lineCount += 1;\n }\n\n return { startLine, lineCount };\n}"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":170,"symbol":"line","kind":"constant","lang":"typescript","code":"const line = lines[index];"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":182,"symbol":"assertExpectedTabLabels","kind":"function","lang":"typescript","code":"function assertExpectedTabLabels(block: TabsBlock, failures: string[]): void {\n const hasZodishTab = block.tabs.some((tab) => isLikelyTabValue(tab.value, \"Zod\"));\n const hasZodMiniishTab = block.tabs.some((tab) => isLikelyTabValue(tab.value, \"Zod Mini\"));\n\n if (!hasZodishTab || !hasZodMiniishTab) {\n return;\n }\n\n for (const tab of block.tabs) {\n for (const expectedValue of [\"Zod\", \"Zod Mini\"]) {\n if (tab.value !== expectedValue && isLikelyTabValue(tab.value, expectedValue)) {\n failures.push(\n `api.mdx:${tab.line} has likely ${expectedValue} tab label typo: expected value=\"${expectedValue}\", found value=\"${tab.value}\".`\n );\n }\n }\n }\n}"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":183,"symbol":"hasZodishTab","kind":"constant","lang":"typescript","code":"const hasZodishTab = block.tabs.some((tab) => isLikelyTabValue(tab.value, \"Zod\"));"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":184,"symbol":"hasZodMiniishTab","kind":"constant","lang":"typescript","code":"const hasZodMiniishTab = block.tabs.some((tab) => isLikelyTabValue(tab.value, \"Zod Mini\"));"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":201,"symbol":"compareCodeFences","kind":"function","lang":"typescript","code":"function compareCodeFences(block: TabsBlock, zodTab: TabBlock, zodMiniTab: TabBlock, failures: string[]): void {\n if (zodTab.codeFences.length !== zodMiniTab.codeFences.length) {\n failures.push(\n `api.mdx:${block.startLine} has ${zodTab.codeFences.length} Zod code fence(s) and ${zodMiniTab.codeFences.length} Zod Mini code fence(s).`\n );\n return;\n }\n\n for (let index = 0; index < zodTab.codeFences.length; index++) {\n const zodFence = zodTab.codeFences[index];\n const zodMiniFence = zodMiniTab.codeFences[index];\n\n if (!zodFence || !zodMiniFence || zodFence.lineCount === zodMiniFence.lineCount) {\n continue;\n }\n\n failures.push(\n `api.mdx:${block.startLine} code fence #${index + 1} has ${zodFence.lineCount} Zod line(s) at line ${zodFence.startLine} and ${zodMiniFence.lineCount} Zod Mini line(s) at line ${zodMiniFence.startLine}.`\n );\n }\n}"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":210,"symbol":"zodFence","kind":"constant","lang":"typescript","code":"const zodFence = zodTab.codeFences[index];"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":211,"symbol":"zodMiniFence","kind":"constant","lang":"typescript","code":"const zodMiniFence = zodMiniTab.codeFences[index];"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":223,"symbol":"isLikelyTabValue","kind":"function","lang":"typescript","code":"function isLikelyTabValue(actual: string, expected: string): boolean {\n const normalizedActual = normalizeTabValue(actual);\n const normalizedExpected = normalizeTabValue(expected);\n return normalizedActual === normalizedExpected || getEditDistance(normalizedActual, normalizedExpected) <= 1;\n}"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":224,"symbol":"normalizedActual","kind":"constant","lang":"typescript","code":"const normalizedActual = normalizeTabValue(actual);"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":225,"symbol":"normalizedExpected","kind":"constant","lang":"typescript","code":"const normalizedExpected = normalizeTabValue(expected);"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":229,"symbol":"normalizeTabValue","kind":"function","lang":"typescript","code":"function normalizeTabValue(value: string): string {\n return value.toLowerCase().replaceAll(/[\\s_-]/g, \"\");\n}"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":233,"symbol":"getEditDistance","kind":"function","lang":"typescript","code":"function getEditDistance(left: string, right: string): number {\n let previousRow = Array.from({ length: right.length + 1 }, (_, index) => index);\n\n for (let leftIndex = 0; leftIndex < left.length; leftIndex++) {\n const currentRow = [leftIndex + 1];\n\n for (let rightIndex = 0; rightIndex < right.length; rightIndex++) {\n const substitutionCost = left[leftIndex] === right[rightIndex] ? 0 : 1;\n currentRow.push(\n Math.min(\n currentRow[rightIndex] + 1,\n previousRow[rightIndex + 1] + 1,\n previousRow[rightIndex] + substitutionCost\n )\n );\n }\n\n previousRow = currentRow;\n }\n\n return previousRow[right.length] ?? 0;\n}"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":237,"symbol":"currentRow","kind":"constant","lang":"typescript","code":"const currentRow = [leftIndex + 1];"} {"repo":"zod","file":"packages/docs/content/api.test.ts","line":240,"symbol":"substitutionCost","kind":"constant","lang":"typescript","code":"const substitutionCost = left[leftIndex] === right[rightIndex] ? 0 : 1;"} {"repo":"zod","file":"packages/docs/loaders/get-llm-text.ts","line":12,"symbol":"processor","kind":"constant","lang":"typescript","code":"const processor = remark().use(remarkMdx).use(remarkInclude).use(remarkGfm).use(remarkStringify);"} {"repo":"zod","file":"packages/docs/loaders/get-llm-text.ts","line":14,"symbol":"getLLMText","kind":"function","lang":"typescript","code":"async function getLLMText(page: InferPageType<typeof source>): Promise<string> {\n // Resolve file path relative to project root to handle ISR correctly\n // During ISR on Vercel, absolutePath might not be correct, so we resolve it ourselves\n // process.cwd() is already packages/docs during build/ISR\n const relativePath = page.file.path;\n const resolvedPath = path.join(process.cwd(), \"content\", relativePath);\n\n // Try resolved path first, fallback to absolutePath if it doesn't exist\n let filePath: string;\n let fileContent: Buffer;\n try {\n filePath = resolvedPath;\n fileContent = await fs.readFile(filePath);\n } catch {\n // If the resolved path doesn't work, try the absolutePath as fallback\n filePath = page.data._file.absolutePath;\n fileContent = await fs.readFile(filePath);\n }\n\n const { content } = matter(fileContent.toString());\n\n const processed = await processor.process({\n path: filePath,\n value: content,\n });\n\n return `# ${page.data.title}\n\n${processed}`;\n}"} {"repo":"zod","file":"packages/docs/loaders/get-llm-text.ts","line":18,"symbol":"relativePath","kind":"constant","lang":"typescript","doc":"Resolve file path relative to project root to handle ISR correctly During ISR on Vercel, absolutePath might not be correct, so we resolve it ourselves process.cwd() is already packages/docs during build/ISR","code":"const relativePath = page.file.path;"} {"repo":"zod","file":"packages/docs/loaders/get-llm-text.ts","line":19,"symbol":"resolvedPath","kind":"constant","lang":"typescript","code":"const resolvedPath = path.join(process.cwd(), \"content\", relativePath);"} {"repo":"zod","file":"packages/docs/loaders/get-llm-text.ts","line":35,"symbol":"processed","kind":"constant","lang":"typescript","code":"const processed = await processor.process({\n path: filePath,\n value: content,\n });"} {"repo":"zod","file":"packages/docs/loaders/source.ts","line":9,"symbol":"source","kind":"constant","lang":"typescript","doc":"`loader()` also assign a URL to your pages See https://fumadocs.vercel.app/docs/headless/source-api for more info","code":"const source = loader({\n baseUrl: \"/\",\n source: docs.toFumadocsSource(),\n icon(icon) {\n if (!icon) {\n // You may set a default icon\n return;\n }\n\n if (icon in icons) return createElement(icons[icon as keyof typeof icons]);\n },\n});"} {"repo":"zod","file":"packages/docs/loaders/source.ts","line":12,"symbol":"icon","kind":"method","lang":"typescript","code":"icon(icon) {\n if (!icon) {\n // You may set a default icon\n return;\n }\n\n if (icon in icons) return createElement(icons[icon as keyof typeof icons]);\n }"} {"repo":"zod","file":"packages/docs/loaders/source.ts","line":23,"symbol":"blog","kind":"constant","lang":"typescript","doc":"Blog content loader","code":"const blog = loader({\n baseUrl: \"/blog\",\n source: createMDXSource(blogPosts),\n});"} {"repo":"zod","file":"packages/docs/loaders/source.ts","line":28,"symbol":"PostSummary","kind":"type","lang":"typescript","code":"type PostSummary = { url: string; title: string; description: string; date: Date };"} {"repo":"zod","file":"packages/docs/loaders/source.ts","line":30,"symbol":"latestPosts","kind":"function","lang":"typescript","code":"function latestPosts(count: number): PostSummary[] {\n return (blog.getPages() as any[])\n .filter((post) => !post.data?.draft)\n .sort((a, b) => new Date(b.data?.date ?? 0).getTime() - new Date(a.data?.date ?? 0).getTime())\n .slice(0, count)\n .map((post) => ({\n url: post.url,\n title: post.data?.title ?? post.slugs.join(\"/\"),\n description: post.data?.description ?? \"\",\n date: new Date(post.data?.date ?? 0),\n }));\n}"} {"repo":"zod","file":"packages/docs/loaders/source.ts","line":43,"symbol":"formatDate","kind":"function","lang":"typescript","code":"function formatDate(value: string | Date, style: \"short\" | \"long\" = \"short\"): string {\n return new Date(value).toLocaleDateString(\"en-US\", {\n month: style === \"long\" ? \"long\" : \"short\",\n day: \"numeric\",\n year: \"numeric\",\n timeZone: \"UTC\",\n });\n}"} {"repo":"zod","file":"packages/docs/loaders/stars.ts","line":1,"symbol":"GITHUB_TOKEN","kind":"constant","lang":"typescript","code":"const GITHUB_TOKEN = process.env.GITHUB_TOKEN!;"} {"repo":"zod","file":"packages/docs/loaders/stars.ts","line":2,"symbol":"API_URL","kind":"constant","lang":"typescript","code":"const API_URL = \"https://api.github.com/graphql\";"} {"repo":"zod","file":"packages/docs/loaders/stars.ts","line":3,"symbol":"ATTEMPTS","kind":"constant","lang":"typescript","code":"const ATTEMPTS = 3;"} {"repo":"zod","file":"packages/docs/loaders/stars.ts","line":6,"symbol":"query","kind":"function","lang":"typescript","doc":"retries transient github failures (5xx, secondary rate limits) so one bad response doesn't fail the whole build","code":"async function query(body: string): Promise<any> {\n let lastError: unknown;\n for (let attempt = 1; attempt <= ATTEMPTS; attempt++) {\n try {\n const res = await fetch(API_URL, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${GITHUB_TOKEN}`,\n \"Content-Type\": \"application/json\",\n },\n body,\n next: { revalidate: 86400 }, // Cache for 1 day to match route revalidation\n });\n if (res.status >= 400) {\n throw new Error(`GitHub GraphQL responded ${res.status}: ${(await res.text()).slice(0, 500)}`);\n }\n const json = await res.json();\n if (json.errors) {\n throw new Error(`GitHub GraphQL errors: ${JSON.stringify(json.errors).slice(0, 500)}`);\n }\n return json;\n } catch (err) {\n lastError = err;\n console.error(`Failed to fetch GitHub stars (attempt ${attempt}/${ATTEMPTS}):`, err);\n if (attempt < ATTEMPTS) await new Promise((r) => setTimeout(r, 1000 * 2 ** (attempt - 1)));\n }\n }\n throw lastError;\n}"} {"repo":"zod","file":"packages/docs/loaders/stars.ts","line":10,"symbol":"res","kind":"constant","lang":"typescript","code":"const res = await fetch(API_URL, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${GITHUB_TOKEN}`,\n \"Content-Type\": \"application/json\",\n },\n body,\n next: { revalidate: 86400 }, // Cache for 1 day to match route revalidation\n });"} {"repo":"zod","file":"packages/docs/loaders/stars.ts","line":22,"symbol":"json","kind":"constant","lang":"typescript","code":"const json = await res.json();"} {"repo":"zod","file":"packages/docs/loaders/stars.ts","line":36,"symbol":"fetchStars","kind":"function","lang":"typescript","code":"async function fetchStars(resources: { slug: string; stars?: number }[]) {\n try {\n if (resources.length === 0) return;\n const uniqueSlugs = Array.from(\n new Set(\n resources\n .filter((r) => r.stars === undefined)\n .map((r, id) => ({\n id,\n slug: r.slug,\n }))\n )\n );\n\n if (uniqueSlugs.length === 0) return;\n\n const queryParts = uniqueSlugs.map(({ id, slug }) => {\n const [owner, name] = slug.split(\"/\");\n return `\n repo${id}: repository(owner: \"${owner}\", name: \"${name}\") {\n stargazerCount\n }\n `;\n });\n\n const json = await query(JSON.stringify({ query: `{ ${queryParts.join(\"\\n\")} }` }));\n\n // Create a map of slug → star count\n const starsMap = new Map<string, number>();\n for (const slug of uniqueSlugs) {\n const count = json.data[`repo${slug.id}`]?.stargazerCount;\n if (typeof count === \"number\") {\n starsMap.set(slug.slug, count);\n }\n }\n\n // Mutate in-place\n for (const r of resources) {\n r.stars = starsMap.get(r.slug);\n }\n\n // sort by star coun (descending) in place\n resources.sort((a, b) => (b.stars || 0) - (a.stars || 0)"} {"repo":"zod","file":"packages/docs/loaders/stars.ts","line":39,"symbol":"uniqueSlugs","kind":"constant","lang":"typescript","code":"const uniqueSlugs = Array.from(\n new Set(\n resources\n .filter((r) => r.stars === undefined)\n .map((r, id) => ({\n id,\n slug: r.slug,\n }))\n )\n );"} {"repo":"zod","file":"packages/docs/loaders/stars.ts","line":52,"symbol":"queryParts","kind":"constant","lang":"typescript","code":"const queryParts = uniqueSlugs.map(({ id, slug }) => {\n const [owner, name] = slug.split(\"/\");\n return `\n repo${id}: repository(owner: \"${owner}\", name: \"${name}\") {\n stargazerCount\n }\n `;\n });"} {"repo":"zod","file":"packages/docs/loaders/stars.ts","line":61,"symbol":"json","kind":"constant","lang":"typescript","code":"const json = await query(JSON.stringify({ query: `{ ${queryParts.join(\"\\n\")} }` }));"} {"repo":"zod","file":"packages/docs/loaders/stars.ts","line":64,"symbol":"starsMap","kind":"constant","lang":"typescript","doc":"Create a map of slug → star count","code":"const starsMap = new Map<string, number>();"} {"repo":"zod","file":"packages/docs/loaders/stars.ts","line":66,"symbol":"count","kind":"constant","lang":"typescript","code":"const count = json.data[`repo${slug.id}`]?.stargazerCount;"} {"repo":"zod","file":"packages/docs/next.config.mjs","line":11,"symbol":"generateRedirects","kind":"function","lang":"javascript","doc":"@param {object} idmap @param {string} page * @param {string?} origin","code":"function generateRedirects(idmap, page, origin = \"/\") {\n /** @type import(\"next\").Redirect */\n const redirects = [];\n\n for (const [key, value] of Object.entries(idmap)) {\n if (key === value && origin === page) {\n continue;\n }\n\n if (page[0] !== \"/\") throw new Error(\"page must start with /\");\n redirects.push({\n source: origin,\n has: [\n {\n type: \"query\",\n key: \"id\",\n value: key,\n },\n ],\n destination: `${page}?id=${value}`,\n permanent: true,\n });\n }\n return redirects;\n}"} {"repo":"zod","file":"packages/docs/next.config.mjs","line":41,"symbol":"redirects","kind":"method","lang":"javascript","code":"redirects() {\n const mainPageRedirects = [\n // INTRO\n ...generateRedirects(\n {\n introduction: \"introduction\",\n sponsors: \"sponsors\",\n platinum: \"platinum\",\n gold: \"gold\",\n silver: \"silver\",\n bronze: \"bronze\",\n copper: \"bronze\",\n installation: \"installation\",\n requirements: \"requirements\",\n \"from-npm\": \"installation\",\n },\n \"/\"\n ),\n\n // ECOSYSTEM\n ...generateRedirects(\n {\n ecosystem: \"ecosystem\",\n resources: \"resources\",\n \"api-libraries\": \"api-libraries\",\n \"form-integrations\": \"form-integrations\",\n \"zod-to-x\": \"zod-to-x\",\n \"x-to-zod\": \"x-to-zod\",\n mocking: \"mocking-libraries\",\n \"powered-by-zod\": \"powered-by-zod\",\n \"utilities-for-zod\": \"zod-utilities\",\n },\n \"/ecosystem\"\n ),\n\n // BASIC USAGE\n ...generateRedirects(\n {\n \"basic-usage\": \"\",\n \"type-inference\": \"inferring-types\",\n \"schema-methods\": \"schema-methods\",\n parse: \"parsing-data\",\n parseasync: \"parsing-data\",\n safeparse: "} {"repo":"zod","file":"packages/docs/pages/api/_og.tsx","line":11,"symbol":"HTMLAttributes","kind":"interface","lang":"tsx","code":"interface HTMLAttributes<T> {\n /**\n * Specify styles using Tailwind CSS classes. This feature is currently experimental.\n * If `style` prop is also specified, styles generated with `tw` prop will be overridden.\n *\n * Example:\n * - `tw='w-full h-full bg-blue-200'`\n * - `tw='text-9xl'`\n * - `tw='text-[80px]'`\n *\n * @type {string}\n */\n tw?: string;\n }"} {"repo":"zod","file":"packages/docs/source.config.ts","line":3,"symbol":"docs","kind":"constant","lang":"typescript","code":"const docs = defineDocs({\n dir: \"content\",\n // posts belong to blogPosts only; here they would also prerender through the docs route, which has no Tab\n docs: { files: [\"**/*\", \"!blog/**\"] },\n});"} {"repo":"zod","file":"packages/docs/source.config.ts","line":10,"symbol":"blogPosts","kind":"constant","lang":"typescript","doc":"Blog collection (for content under `content/blog`)","code":"const blogPosts = defineCollections({\n type: \"doc\",\n dir: \"content/blog\",\n // No schema to avoid zod version mismatch; frontmatter is optional\n});"} {"repo":"zod","file":"packages/docs-v3/.editorconfig","line":4,"symbol":"root","kind":"field","lang":"editorconfig","code":"root = true"} {"repo":"zod","file":"packages/docs-v3/.editorconfig","line":7,"symbol":"[*]\n","kind":"section","lang":"editorconfig","code":"[*]\nend_of_line = lf\ninsert_final_newline = true\nindent_style = space\nindent_size = 2\ncharset = utf-8"} {"repo":"zod","file":"packages/docs-v3/.editorconfig","line":8,"symbol":"end_of_line","kind":"field","lang":"editorconfig","code":"end_of_line = lf"} {"repo":"zod","file":"packages/docs-v3/.editorconfig","line":9,"symbol":"insert_final_newline","kind":"field","lang":"editorconfig","code":"insert_final_newline = true"} {"repo":"zod","file":"packages/docs-v3/.editorconfig","line":10,"symbol":"indent_style","kind":"field","lang":"editorconfig","code":"indent_style = space"} {"repo":"zod","file":"packages/docs-v3/.editorconfig","line":11,"symbol":"indent_size","kind":"field","lang":"editorconfig","code":"indent_size = 2"} {"repo":"zod","file":"packages/docs-v3/.editorconfig","line":12,"symbol":"charset","kind":"field","lang":"editorconfig","code":"charset = utf-8"} {"repo":"zod","file":"packages/integration/fixtures/ai-sdk/index.ts","line":8,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await generateObject({\n model: openai(\"gpt-4.1-nano\"),\n prompt: \"Who is or was the greatest scientist of all time?\",\n schema: z.object({\n name: z.string(),\n age: z.number(),\n }),\n});"} {"repo":"zod","file":"packages/integration/fixtures/drizzle-zod/index.ts","line":11,"symbol":"labelEnum","kind":"constant","lang":"typescript","code":"const labelEnum = pgEnum(\"label\", [\"a\", \"b\"]);"} {"repo":"zod","file":"packages/integration/fixtures/drizzle-zod/index.ts","line":13,"symbol":"table","kind":"constant","lang":"typescript","code":"const table = pgTable(\"table\", {\n id: serial(\"id\").primaryKey(),\n labels: labelEnum(\"labels\").array(),\n});"} {"repo":"zod","file":"packages/integration/fixtures/drizzle-zod/index.ts","line":19,"symbol":"schema","kind":"constant","lang":"typescript","doc":"This line was causing \"Type instantiation is excessively deep\" before the fix","code":"const schema = createInsertSchema(table);"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/cjs-test.cts","line":6,"symbol":"userSchema","kind":"constant","lang":"typescript","doc":"Basic schema usage","code":"const userSchema = z.object({\n name: z.string(),\n age: z.number().int().positive(),\n email: z.string().email(),\n tags: z.array(z.string()),\n role: z.enum([\"admin\", \"user\", \"guest\"]),\n metadata: z.record(z.string(), z.unknown()),\n createdAt: z.date(),\n});"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/cjs-test.cts","line":16,"symbol":"User","kind":"type","lang":"typescript","code":"type User = z.infer<typeof userSchema>;"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/cjs-test.cts","line":19,"symbol":"result","kind":"constant","lang":"typescript","doc":"Parse some data","code":"const result = userSchema.safeParse({\n name: \"Alice\",\n age: 30,\n email: \"alice@example.com\",\n tags: [\"developer\"],\n role: \"admin\",\n metadata: { foo: \"bar\" },\n createdAt: new Date(),\n});"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/cjs-test.cts","line":30,"symbol":"user","kind":"constant","lang":"typescript","code":"const user: User = result.data;"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/cjs-test.cts","line":35,"symbol":"complexSchema","kind":"constant","lang":"typescript","doc":"Test various schema types","code":"const complexSchema = z.union([\n z.object({ type: z.literal(\"a\"), value: z.string() }),\n z.object({ type: z.literal(\"b\"), value: z.number() }),\n]);"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/cjs-test.cts","line":40,"symbol":"tupleSchema","kind":"constant","lang":"typescript","code":"const tupleSchema = z.tuple([z.string(), z.number(), z.boolean()]);"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/cjs-test.cts","line":41,"symbol":"intersectionSchema","kind":"constant","lang":"typescript","code":"const intersectionSchema = z.intersection(z.object({ a: z.string() }), z.object({ b: z.number() }));"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/cjs-test.cts","line":44,"symbol":"refinedSchema","kind":"constant","lang":"typescript","doc":"Refinements and transforms","code":"const refinedSchema = z.string().refine((s) => s.length > 0);"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/cjs-test.cts","line":45,"symbol":"transformedSchema","kind":"constant","lang":"typescript","code":"const transformedSchema = z.string().transform((s) => s.toUpperCase());"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/cjs-test.cts","line":46,"symbol":"pipedSchema","kind":"constant","lang":"typescript","code":"const pipedSchema = z.string().pipe(z.string().min(1));"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/cjs-test.cts","line":49,"symbol":"optionalSchema","kind":"constant","lang":"typescript","doc":"Optional/nullable","code":"const optionalSchema = z.object({\n required: z.string(),\n optional: z.string().optional(),\n nullable: z.string().nullable(),\n nullish: z.string().nullish(),\n withDefault: z.string().default(\"default\"),\n});"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/index.ts","line":7,"symbol":"userSchema","kind":"constant","lang":"typescript","doc":"Basic schema usage","code":"const userSchema = z.object({\n name: z.string(),\n age: z.number().int().positive(),\n email: z.string().email(),\n tags: z.array(z.string()),\n role: z.enum([\"admin\", \"user\", \"guest\"]),\n metadata: z.record(z.string(), z.unknown()),\n createdAt: z.date(),\n});"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/index.ts","line":17,"symbol":"User","kind":"type","lang":"typescript","code":"type User = z.infer<typeof userSchema>;"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/index.ts","line":20,"symbol":"result","kind":"constant","lang":"typescript","doc":"Parse some data","code":"const result = userSchema.safeParse({\n name: \"Alice\",\n age: 30,\n email: \"alice@example.com\",\n tags: [\"developer\"],\n role: \"admin\",\n metadata: { foo: \"bar\" },\n createdAt: new Date(),\n});"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/index.ts","line":31,"symbol":"user","kind":"constant","lang":"typescript","code":"const user: User = result.data;"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/index.ts","line":36,"symbol":"complexSchema","kind":"constant","lang":"typescript","doc":"Test various schema types","code":"const complexSchema = z.union([\n z.object({ type: z.literal(\"a\"), value: z.string() }),\n z.object({ type: z.literal(\"b\"), value: z.number() }),\n]);"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/index.ts","line":41,"symbol":"tupleSchema","kind":"constant","lang":"typescript","code":"const tupleSchema = z.tuple([z.string(), z.number(), z.boolean()]);"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/index.ts","line":42,"symbol":"intersectionSchema","kind":"constant","lang":"typescript","code":"const intersectionSchema = z.intersection(z.object({ a: z.string() }), z.object({ b: z.number() }));"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/index.ts","line":45,"symbol":"_refinedSchema","kind":"constant","lang":"typescript","doc":"Refinements and transforms","code":"const _refinedSchema = z.string().refine((s) => s.length > 0);"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/index.ts","line":46,"symbol":"_transformedSchema","kind":"constant","lang":"typescript","code":"const _transformedSchema = z.string().transform((s) => s.toUpperCase());"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/index.ts","line":47,"symbol":"_pipedSchema","kind":"constant","lang":"typescript","code":"const _pipedSchema = z.string().pipe(z.string().min(1));"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/index.ts","line":50,"symbol":"_optionalSchema","kind":"constant","lang":"typescript","doc":"Optional/nullable","code":"const _optionalSchema = z.object({\n required: z.string(),\n optional: z.string().optional(),\n nullable: z.string().nullable(),\n nullish: z.string().nullish(),\n withDefault: z.string().default(\"default\"),\n});"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/mini-cjs-test.cts","line":5,"symbol":"userSchema","kind":"constant","lang":"typescript","code":"const userSchema = z.object({\n name: z.string(),\n age: z.number().check(z.int(), z.positive()),\n tags: z.array(z.string()),\n});"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/mini-cjs-test.cts","line":11,"symbol":"User","kind":"type","lang":"typescript","code":"type User = z.infer<typeof userSchema>;"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/mini-cjs-test.cts","line":13,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.safeParse(userSchema, { name: \"Alice\", age: 30, tags: [] });"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/mini-cjs-test.cts","line":16,"symbol":"user","kind":"constant","lang":"typescript","code":"const user: User = result.data;"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/mini.ts","line":7,"symbol":"userSchema","kind":"constant","lang":"typescript","code":"const userSchema = z.object({\n name: z.string(),\n age: z.number().check(z.int(), z.positive()),\n tags: z.array(z.string()),\n role: z.enum([\"admin\", \"user\", \"guest\"]),\n metadata: z.record(z.string(), z.unknown()),\n});"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/mini.ts","line":15,"symbol":"User","kind":"type","lang":"typescript","code":"type User = z.infer<typeof userSchema>;"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/mini.ts","line":17,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.safeParse(userSchema, {\n name: \"Alice\",\n age: 30,\n tags: [\"developer\"],\n role: \"admin\",\n metadata: { foo: \"bar\" },\n});"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/mini.ts","line":26,"symbol":"user","kind":"constant","lang":"typescript","code":"const user: User = result.data;"} {"repo":"zod","file":"packages/integration/fixtures/internal-types/mini.ts","line":31,"symbol":"_sameTree","kind":"constant","lang":"typescript","doc":"the scoped package and the subpath are one declaration tree","code":"const _sameTree: zm.ZodMiniObject = userSchema;"} {"repo":"zod","file":"packages/mini/src/tests/index.test.ts","line":12,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = mini.object({ name: mini.string(), tags: mini.array(mini.string()) });"} {"repo":"zod","file":"packages/resolution/attw.test.ts","line":7,"symbol":"__filename","kind":"constant","lang":"typescript","code":"const __filename = fileURLToPath(import.meta.url);"} {"repo":"zod","file":"packages/resolution/attw.test.ts","line":8,"symbol":"__dirname","kind":"constant","lang":"typescript","code":"const __dirname = path.dirname(__filename);"} {"repo":"zod","file":"packages/resolution/attw.test.ts","line":13,"symbol":"zodIndexPath","kind":"constant","lang":"typescript","doc":"check if node_modules/zod/index.js exists","code":"const zodIndexPath = path.join(__dirname, \"node_modules\", \"zod\", \"index.js\");"} {"repo":"zod","file":"packages/resolution/attw.test.ts","line":30,"symbol":"zodPackagePath","kind":"constant","lang":"typescript","code":"const zodPackagePath = path.join(__dirname, \"node_modules\", \"zod\");"} {"repo":"zod","file":"packages/resolution/attw.test.ts","line":31,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await execa(\"nub\", [\"exec\", \"--node\", \"attw\", \"--pack\", zodPackagePath, \"--format\", \"ascii\"], {\n cwd: __dirname,\n reject: false, // Don't throw on non-zero exit codes\n });"} {"repo":"zod","file":"packages/resolution/attw.test.ts","line":37,"symbol":"stderr","kind":"constant","lang":"typescript","doc":"exclude package-manager warnings from the attw snapshot","code":"const stderr = result.stderr\n .split(\"\\n\")\n .filter((line) => !/^\\s*WARN\\b/.test(line))\n .join(\"\\n\")\n .trim();"} {"repo":"zod","file":"packages/resolution/attw.test.ts","line":42,"symbol":"output","kind":"constant","lang":"typescript","code":"const output = result.stdout + (stderr ? \"\\n\" + stderr : \"\");"} {"repo":"zod","file":"packages/resolution/attw.test.ts","line":44,"symbol":"outputWithoutFirstLine","kind":"constant","lang":"typescript","doc":"remove first line","code":"const outputWithoutFirstLine = output.split(\"\\n\").slice(2).join(\"\\n\").trim();"} {"repo":"zod","file":"packages/resolution/attw.test.ts","line":160,"symbol":"miniIndexPath","kind":"constant","lang":"typescript","code":"const miniIndexPath = path.join(__dirname, \"node_modules\", \"@zod\", \"mini\", \"index.js\");"} {"repo":"zod","file":"packages/resolution/attw.test.ts","line":173,"symbol":"miniPackagePath","kind":"constant","lang":"typescript","code":"const miniPackagePath = path.join(__dirname, \"node_modules\", \"@zod\", \"mini\");"} {"repo":"zod","file":"packages/resolution/attw.test.ts","line":174,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await execa(\"nub\", [\"exec\", \"--node\", \"attw\", \"--pack\", miniPackagePath, \"--format\", \"ascii\"], {\n cwd: __dirname,\n reject: false,\n });"} {"repo":"zod","file":"packages/resolution/attw.test.ts","line":179,"symbol":"stderr","kind":"constant","lang":"typescript","code":"const stderr = result.stderr\n .split(\"\\n\")\n .filter((line) => !/^\\s*WARN\\b/.test(line))\n .join(\"\\n\")\n .trim();"} {"repo":"zod","file":"packages/resolution/attw.test.ts","line":184,"symbol":"output","kind":"constant","lang":"typescript","code":"const output = result.stdout + (stderr ? \"\\n\" + stderr : \"\");"} {"repo":"zod","file":"packages/resolution/attw.test.ts","line":185,"symbol":"outputWithoutFirstLine","kind":"constant","lang":"typescript","code":"const outputWithoutFirstLine = output.split(\"\\n\").slice(2).join(\"\\n\").trim();"} {"repo":"zod","file":"packages/resolution/src/index.cts","line":23,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z4.object({\n name: z4.string(),\n});"} {"repo":"zod","file":"packages/resolution/src/index.cts","line":26,"symbol":"success","kind":"constant","lang":"typescript","code":"const success = JSON.stringify(schema.safeParse({ name: \"John Doe\" }));"} {"repo":"zod","file":"packages/resolution/src/index.cts","line":31,"symbol":"failure","kind":"constant","lang":"typescript","code":"const failure = JSON.stringify(schema.safeParse({ name: 123 }));"} {"repo":"zod","file":"packages/resolution/src/index.cts","line":40,"symbol":"validateDescriptor","kind":"constant","lang":"typescript","doc":"the CommonJS entrypoint settles its re-export accessors into data properties, so callers do not read every API through a getter","code":"const validateDescriptor = Object.getOwnPropertyDescriptor(z1, \"validate\");"} {"repo":"zod","file":"packages/resolution/src/index.mts","line":23,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z4.object({\n name: z4.string(),\n});"} {"repo":"zod","file":"packages/resolution/src/index.mts","line":26,"symbol":"success","kind":"constant","lang":"typescript","code":"const success = JSON.stringify(schema.safeParse({ name: \"John Doe\" }));"} {"repo":"zod","file":"packages/resolution/src/index.mts","line":31,"symbol":"failure","kind":"constant","lang":"typescript","code":"const failure = JSON.stringify(schema.safeParse({ name: 123 }));"} {"repo":"zod","file":"packages/resolution/src/index.ts","line":23,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z4.object({\n name: z4.string(),\n});"} {"repo":"zod","file":"packages/resolution/src/index.ts","line":26,"symbol":"success","kind":"constant","lang":"typescript","code":"const success = JSON.stringify(schema.safeParse({ name: \"John Doe\" }));"} {"repo":"zod","file":"packages/resolution/src/index.ts","line":31,"symbol":"failure","kind":"constant","lang":"typescript","code":"const failure = JSON.stringify(schema.safeParse({ name: 123 }));"} {"repo":"zod","file":"packages/resolution/test-resolution.ts","line":5,"symbol":"__filename","kind":"constant","lang":"typescript","code":"const __filename = fileURLToPath(import.meta.url);"} {"repo":"zod","file":"packages/resolution/test-resolution.ts","line":6,"symbol":"__dirname","kind":"constant","lang":"typescript","code":"const __dirname = path.dirname(__filename);"} {"repo":"zod","file":"packages/resolution/test-resolution.ts","line":8,"symbol":"buildZshy","kind":"function","lang":"typescript","code":"async function buildZshy() {\n console.log(\"🔨 Building project with zshy...\");\n try {\n await execa(\"nub\", [\"exec\", \"--node\", \"zshy\"], {\n cwd: __dirname,\n stdio: \"inherit\",\n });\n // console.log('✅ Build completed successfully!');\n } catch (error) {\n console.error(\"❌ Error building project:\", error);\n process.exit(1);\n }\n}"} {"repo":"zod","file":"packages/resolution/test-resolution.ts","line":22,"symbol":"buildTsc","kind":"function","lang":"typescript","code":"async function buildTsc() {\n console.log(\"🔨 Building project with tsc...\");\n try {\n await execa(\"nub\", [\"exec\", \"--node\", \"tsc\", \"--project\", \"tsconfig.build.json\"], {\n cwd: __dirname,\n stdio: \"inherit\",\n });\n // console.log('✅ Build completed successfully!');\n } catch (error) {\n console.error(\"❌ Error building project:\", error);\n process.exit(1);\n }\n}"} {"repo":"zod","file":"packages/resolution/test-resolution.ts","line":36,"symbol":"testCjs","kind":"function","lang":"typescript","code":"async function testCjs() {\n console.log(\"🧪 Testing CommonJS build...\");\n try {\n await execa(\"nub\", [\"--node\", \"./dist/index.cjs\"], {\n cwd: __dirname,\n stdio: \"inherit\",\n });\n console.log(\"✅ CommonJS test passed!\");\n } catch (error) {\n console.error(\"❌ CommonJS test failed:\", error);\n process.exit(1);\n }\n}"} {"repo":"zod","file":"packages/resolution/test-resolution.ts","line":50,"symbol":"testMjs","kind":"function","lang":"typescript","code":"async function testMjs() {\n console.log(\"🧪 Testing CommonJS build...\");\n try {\n await execa(\"nub\", [\"--node\", \"./dist/index.mjs\"], {\n cwd: __dirname,\n stdio: \"inherit\",\n });\n console.log(\"✅ CommonJS test passed!\");\n } catch (error) {\n console.error(\"❌ CommonJS test failed:\", error);\n process.exit(1);\n }\n}"} {"repo":"zod","file":"packages/resolution/test-resolution.ts","line":64,"symbol":"testJs","kind":"function","lang":"typescript","code":"async function testJs() {\n console.log(\"🧪 Testing ES Module build...\");\n try {\n await execa(\"nub\", [\"--node\", \"./dist/index.js\"], {\n cwd: __dirname,\n stdio: \"inherit\",\n });\n console.log(\"✅ ES Module test passed!\");\n } catch (error) {\n console.error(\"❌ ES Module test failed:\", error);\n process.exit(1);\n }\n}"} {"repo":"zod","file":"packages/resolution/test-resolution.ts","line":78,"symbol":"runAllTests","kind":"function","lang":"typescript","code":"async function runAllTests() {\n console.log(\"🚀 Starting comprehensive resolution tests...\\n\");\n\n try {\n await buildZshy();\n await testCjs();\n await testJs();\n\n await buildTsc();\n await testMjs();\n await testCjs();\n\n console.log(\"🎉 All tests passed successfully!\");\n } catch (error) {\n console.error(\"💥 Test suite failed:\", error);\n process.exit(1);\n }\n}"} {"repo":"zod","file":"packages/treeshake/bundle-size.test.ts","line":8,"symbol":"__dirname","kind":"constant","lang":"typescript","code":"const __dirname = path.dirname(fileURLToPath(import.meta.url));"} {"repo":"zod","file":"packages/treeshake/bundle-size.test.ts","line":14,"symbol":"BUILT_ENTRY","kind":"constant","lang":"typescript","doc":"Like the other tests here, this bundles the BUILT package: esbuild is given no `@zod/source` condition, so `zod/mini` resolves through `exports` to what a consumer actually installs. That makes the numbers meaningful and the file stale until `nub run build` has run — fine in CI, which builds first.","code":"const BUILT_ENTRY = path.join(__dirname, \"node_modules\", \"zod\", \"index.js\");"} {"repo":"zod","file":"packages/treeshake/bundle-size.test.ts","line":40,"symbol":"CEILINGS","kind":"constant","lang":"typescript","doc":"decides it should. nub run build && nub exec --node vitest run packages/treeshake/bundle-size.test.ts The failure message prints the measured size, so updating is mechanical.","code":"const CEILINGS: Record<string, number> = {\n // raised from 2903 / 3366 / 4437 by the commit that caused it: installing a trait's members from `$constructor` rather than from its initializer costs mini +70 / +83 / +95, and every bundle carries `core.ts`; measured 2946 / 3420 / 4503 plus 28 headroom, and the per-fixture notes below record what each already carried. About half of it is the guard that keeps the install off a user subclass's prototype; the rest is writing the members as `this`-methods, since `this` is not renameable and a block body cannot collapse to an arrow.\n // Also carries the Standard Schema issue bag: a failing `~standard.validate` parses with a plain issue holder instead of constructing a ZodError. Measured 2974 / 3455 / 4540 locally plus 28 headroom.\n // Also carries the lazy `safeParse` error: a getter and a setter on the failing result, and the async wrapper that keeps a sync throw a rejection. Measured 3021 / 3497 / 4581 locally plus 18 headroom.\n // Also carries the symbol-key loop in `util.members`, which is what installs `$ZodProperties`'s `Symbol.iterator` on its prototype, and the memoizer's shared reference predicate. Measured 3036 / 3516 / 4611 lo"} {"repo":"zod","file":"packages/treeshake/bundle-size.test.ts","line":74,"symbol":"MUST_NOT_APPEAR","kind":"constant","lang":"typescript","doc":"Identifiers that must not appear in a bundle that never uses the feature they belong to. A byte ceiling drifts with unrelated churn; this does not, and it names the exact regression rather than its symptom.","code":"const MUST_NOT_APPEAR = [\"canParse\", \"constantCatch\"];"} {"repo":"zod","file":"packages/treeshake/bundle-size.test.ts","line":82,"symbol":"bundle","kind":"function","lang":"typescript","code":"async function bundle(fixture: string): Promise<string> {\n const result = await build({\n entryPoints: [path.join(__dirname, `${fixture}.ts`)],\n bundle: true,\n minify: true,\n format: \"esm\",\n write: false,\n logLevel: \"silent\",\n });\n return Buffer.from(result.outputFiles[0]!.contents).toString(\"utf8\");\n}"} {"repo":"zod","file":"packages/treeshake/bundle-size.test.ts","line":83,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await build({\n entryPoints: [path.join(__dirname, `${fixture}.ts`)],\n bundle: true,\n minify: true,\n format: \"esm\",\n write: false,\n logLevel: \"silent\",\n });"} {"repo":"zod","file":"packages/treeshake/bundle-size.test.ts","line":96,"symbol":"code","kind":"constant","lang":"typescript","code":"const code = await bundle(fixture);"} {"repo":"zod","file":"packages/treeshake/bundle-size.test.ts","line":97,"symbol":"size","kind":"constant","lang":"typescript","code":"const size = gzipSync(Buffer.from(code), { level: 9 }).length;"} {"repo":"zod","file":"packages/treeshake/bundle-size.test.ts","line":106,"symbol":"code","kind":"constant","lang":"typescript","code":"const code = await bundle(\"zod-mini-boolean\");"} {"repo":"zod","file":"packages/treeshake/bundle-size.test.ts","line":114,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await build({\n stdin: { contents: `import * as z from \"zod/mini\"; console.log(z.hostname().parse(\"a.com\"));`, resolveDir: __dirname, loader: \"ts\" },\n bundle: true,\n minify: true,\n format: \"esm\",\n write: false,\n logLevel: \"silent\",\n });"} {"repo":"zod","file":"packages/treeshake/bundle-size.test.ts","line":122,"symbol":"code","kind":"constant","lang":"typescript","code":"const code = Buffer.from(result.outputFiles[0]!.contents).toString(\"utf8\");"} {"repo":"zod","file":"packages/treeshake/default-locale.test.ts","line":9,"symbol":"__dirname","kind":"constant","lang":"typescript","code":"const __dirname = path.dirname(fileURLToPath(import.meta.url));"} {"repo":"zod","file":"packages/treeshake/default-locale.test.ts","line":21,"symbol":"zodRoot","kind":"constant","lang":"typescript","code":"const zodRoot = path.resolve(__dirname, \"../zod\");"} {"repo":"zod","file":"packages/treeshake/default-locale.test.ts","line":22,"symbol":"builtEntry","kind":"constant","lang":"typescript","code":"const builtEntry = path.join(zodRoot, \"v4/index.js\");"} {"repo":"zod","file":"packages/treeshake/default-locale.test.ts","line":24,"symbol":"newestMtime","kind":"function","lang":"typescript","code":"function newestMtime(dir: string): number {\n let newest = 0;\n for (const item of readdirSync(dir, { withFileTypes: true })) {\n const full = path.join(dir, item.name);\n newest = Math.max(newest, item.isDirectory() ? newestMtime(full) : statSync(full).mtimeMs);\n }\n return newest;\n}"} {"repo":"zod","file":"packages/treeshake/default-locale.test.ts","line":27,"symbol":"full","kind":"constant","lang":"typescript","code":"const full = path.join(dir, item.name);"} {"repo":"zod","file":"packages/treeshake/default-locale.test.ts","line":40,"symbol":"tmp","kind":"constant","lang":"typescript","code":"const tmp = mkdtempSync(path.join(tmpdir(), \"zod-treeshake-\"));"} {"repo":"zod","file":"packages/treeshake/default-locale.test.ts","line":43,"symbol":"entry","kind":"function","lang":"typescript","code":"function entry(code: string): Plugin {\n const id = path.join(__dirname, \"__default_locale_entry__.mjs\");\n return {\n name: \"entry\",\n resolveId: (source) => (source === id ? id : null),\n load: (loaded) => (loaded === id ? code : null),\n options: (opts) => ({ ...opts, input: id }),\n };\n}"} {"repo":"zod","file":"packages/treeshake/default-locale.test.ts","line":44,"symbol":"id","kind":"constant","lang":"typescript","code":"const id = path.join(__dirname, \"__default_locale_entry__.mjs\");"} {"repo":"zod","file":"packages/treeshake/default-locale.test.ts","line":53,"symbol":"bundleAndRun","kind":"function","lang":"typescript","code":"async function bundleAndRun(code: string): Promise<Record<string, string>> {\n const build = await rollup({\n input: \"ignored\",\n plugins: [entry(code), resolve()],\n treeshake: { preset: \"smallest\", annotations: true },\n onwarn: () => {},\n });\n const { output } = await build.generate({ format: \"esm\" });\n await build.close();\n const file = path.join(tmp, `${Math.random().toString(36).slice(2)}.mjs`);\n writeFileSync(file, output.map((chunk) => (chunk.type === \"chunk\" ? chunk.code : \"\")).join(\"\"));\n return import(pathToFileURL(file).href);\n}"} {"repo":"zod","file":"packages/treeshake/default-locale.test.ts","line":54,"symbol":"build","kind":"constant","lang":"typescript","code":"const build = await rollup({\n input: \"ignored\",\n plugins: [entry(code), resolve()],\n treeshake: { preset: \"smallest\", annotations: true },\n onwarn: () => {},\n });"} {"repo":"zod","file":"packages/treeshake/default-locale.test.ts","line":62,"symbol":"file","kind":"constant","lang":"typescript","code":"const file = path.join(tmp, `${Math.random().toString(36).slice(2)}.mjs`);"} {"repo":"zod","file":"packages/treeshake/locale-treeshake.test.ts","line":8,"symbol":"__dirname","kind":"constant","lang":"typescript","code":"const __dirname = path.dirname(fileURLToPath(import.meta.url));"} {"repo":"zod","file":"packages/treeshake/locale-treeshake.test.ts","line":15,"symbol":"BUILT_ENTRY","kind":"constant","lang":"typescript","doc":"Unlike the rest of the suite, this file bundles the BUILT package: `resolve()` knows nothing about vitest's `@zod/source` condition, so `zod` resolves through `exports` to `packages/zod/index.js`. That is the faithful thing to measure — it is what consumers actually bundle — but it means the assertions are stale until you `nub run build`. CI is fine, since `nub run build` precedes `nub run test`.","code":"const BUILT_ENTRY = path.join(__dirname, \"node_modules\", \"zod\", \"index.js\");"} {"repo":"zod","file":"packages/treeshake/locale-treeshake.test.ts","line":19,"symbol":"GERMAN","kind":"constant","lang":"typescript","doc":"Strings unique to a single locale. Grepping the bundle for them proves inclusion rather than inferring it from byte counts.","code":"const GERMAN = \"Zu klein: erwartet\";"} {"repo":"zod","file":"packages/treeshake/locale-treeshake.test.ts","line":20,"symbol":"JAPANESE","kind":"constant","lang":"typescript","code":"const JAPANESE = \"小さすぎる値\";"} {"repo":"zod","file":"packages/treeshake/locale-treeshake.test.ts","line":31,"symbol":"SPECIFIERS","kind":"constant","lang":"typescript","doc":"were fixed by the same one-line change, so guarding Rollup guards both; esbuild cannot shake a re-exported namespace at all (evanw/esbuild#1420) and is out of scope here. Both specifiers are covered because they were fixed in separate files — a regression in `src/v4/index.ts` alone would otherwise go unnoticed. `zod/mini` and `zod/v4-mini` are deliberately absent: they have no default export, so Rollup errors on `import z from`.","code":"const SPECIFIERS = [\"zod\", \"zod/v4\"];"} {"repo":"zod","file":"packages/treeshake/locale-treeshake.test.ts","line":33,"symbol":"entry","kind":"function","lang":"typescript","code":"function entry(code: string): Plugin {\n const id = path.join(__dirname, \"__entry__.mjs\");\n return {\n name: \"entry\",\n resolveId: (source) => (source === id ? id : null),\n load: (loaded) => (loaded === id ? code : null),\n options: (opts) => ({ ...opts, input: id }),\n };\n}"} {"repo":"zod","file":"packages/treeshake/locale-treeshake.test.ts","line":34,"symbol":"id","kind":"constant","lang":"typescript","code":"const id = path.join(__dirname, \"__entry__.mjs\");"} {"repo":"zod","file":"packages/treeshake/locale-treeshake.test.ts","line":43,"symbol":"bundle","kind":"function","lang":"typescript","code":"async function bundle(code: string): Promise<string> {\n const build = await rollup({\n input: \"ignored\",\n plugins: [entry(code), resolve()],\n treeshake: { preset: \"smallest\", annotations: true },\n onwarn: () => {},\n });\n const { output } = await build.generate({ format: \"esm\" });\n await build.close();\n return output.map((chunk) => (chunk.type === \"chunk\" ? chunk.code : \"\")).join(\"\");\n}"} {"repo":"zod","file":"packages/treeshake/locale-treeshake.test.ts","line":44,"symbol":"build","kind":"constant","lang":"typescript","code":"const build = await rollup({\n input: \"ignored\",\n plugins: [entry(code), resolve()],\n treeshake: { preset: \"smallest\", annotations: true },\n onwarn: () => {},\n });"} {"repo":"zod","file":"packages/treeshake/locale-treeshake.test.ts","line":62,"symbol":"code","kind":"constant","lang":"typescript","code":"const code = await bundle(`import z from \"${spec}\";\\nconsole.log(z.string().min(5).safeParse(\"hi\"));`);"} {"repo":"zod","file":"packages/treeshake/locale-treeshake.test.ts","line":68,"symbol":"code","kind":"constant","lang":"typescript","code":"const code = await bundle(`import { z } from \"${spec}\";\\nconsole.log(z.string().min(5).safeParse(\"hi\"));`);"} {"repo":"zod","file":"packages/treeshake/locale-treeshake.test.ts","line":74,"symbol":"code","kind":"constant","lang":"typescript","code":"const code = await bundle(\n `import z from \"${spec}\";\\nz.config(z.locales.de());\\nconsole.log(z.string().min(5).safeParse(\"hi\"));`\n );"} {"repo":"zod","file":"packages/treeshake/valibot-boolean.ts","line":3,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.boolean()"} {"repo":"zod","file":"packages/treeshake/valibot-object.ts","line":3,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string(), b: z.number(), c: z.boolean() });"} {"repo":"zod","file":"packages/treeshake/valibot-simple-object.ts","line":3,"symbol":"Valibot","kind":"constant","lang":"typescript","code":"const Valibot = v.object({\n email: v.pipe(\n v.string(),\n v.nonEmpty(\"Please enter your email.\"),\n v.email(\"The email address is badly formatted.\")\n ),\n password: v.pipe(\n v.string(),\n v.nonEmpty(\"Please enter your password.\"),\n v.minLength(8, \"Your password must have 8 characters or more.\")\n ),\n});"} {"repo":"zod","file":"packages/treeshake/valibot-string.ts","line":3,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.pipe(z.string(), z.minLength(1));"} {"repo":"zod","file":"packages/treeshake/zod-boolean.ts","line":3,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.boolean();"} {"repo":"zod","file":"packages/treeshake/zod-default-import.ts","line":3,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ title: z.string().min(5) });"} {"repo":"zod","file":"packages/treeshake/zod-full.ts","line":3,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n name: z.string(),\n age: z.number(),\n email: z.boolean(),\n});"} {"repo":"zod","file":"packages/treeshake/zod-mini-boolean.ts","line":3,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.boolean();"} {"repo":"zod","file":"packages/treeshake/zod-mini-full.ts","line":3,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n name: z.string(),\n age: z.number(),\n email: z.boolean(),\n});"} {"repo":"zod","file":"packages/treeshake/zod-mini-object.ts","line":3,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string(), b: z.number(), c: z.boolean() });"} {"repo":"zod","file":"packages/treeshake/zod-mini-simple-object.ts","line":3,"symbol":"Zod","kind":"constant","lang":"typescript","code":"const Zod = z.object({\n email: z\n .string()\n .check(\n z.minLength(1, \"Please enter your email.\"),\n z.email(\"The email address is badly formatted.\")\n ),\n password: z.string()\n .check(\n z.minLength(1, \"Please enter your password.\"),\n z.minLength(8, \"Your password must have 8 characters or more.\")\n ),\n});"} {"repo":"zod","file":"packages/treeshake/zod-mini-string.ts","line":3,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().check(z.minLength(5));"} {"repo":"zod","file":"packages/treeshake/zod-named-import.ts","line":3,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ title: z.string().min(5) });"} {"repo":"zod","file":"packages/treeshake/zod-object.ts","line":3,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string(), b: z.number(), c: z.boolean() });"} {"repo":"zod","file":"packages/treeshake/zod-string.ts","line":3,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().min(5);"} {"repo":"zod","file":"packages/treeshake/zod3-boolean.ts","line":3,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.boolean();"} {"repo":"zod","file":"packages/treeshake/zod3-full.ts","line":3,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n name: z.string(),\n age: z.number(),\n email: z.boolean(),\n});"} {"repo":"zod","file":"packages/treeshake/zod3-object.ts","line":3,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string(), b: z.number(), c: z.boolean() });"} {"repo":"zod","file":"packages/treeshake/zod3-string.ts","line":3,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().min(5);"} {"repo":"zod","file":"packages/tsc/bench/index.ts","line":3,"symbol":"$","kind":"constant","lang":"typescript","code":"const $ = execa({ stdout: \"inherit\", stderr: \"inherit\" });"} {"repo":"zod","file":"packages/tsc/bench/index.ts","line":5,"symbol":"run","kind":"function","lang":"typescript","code":"async function run() {\n const fileNames = process.argv[2];\n\n if (!fileNames) {\n console.error(\"Specify a benchmark name(s), e.g. `nub run bench object-with-extend`\");\n process.exit(1);\n }\n const files = fileNames.split(\",\").map((file) => import.meta.resolve(`./${file}`).replace(\"file://\", \"\"));\n\n for (const file of files) {\n await $`nub --conditions @zod/source ${file}`;\n }\n}"} {"repo":"zod","file":"packages/tsc/bench/index.ts","line":6,"symbol":"fileNames","kind":"constant","lang":"typescript","code":"const fileNames = process.argv[2];"} {"repo":"zod","file":"packages/tsc/bench/index.ts","line":12,"symbol":"files","kind":"constant","lang":"typescript","code":"const files = fileNames.split(\",\").map((file) => import.meta.resolve(`./${file}`).replace(\"file://\", \"\"));"} {"repo":"zod","file":"packages/tsc/bench/lots-of-objects.ts","line":3,"symbol":"$","kind":"constant","lang":"typescript","code":"const $ = execa({ stdout: \"inherit\", stderr: \"inherit\" });"} {"repo":"zod","file":"packages/tsc/bench/lots-of-objects.ts","line":6,"symbol":"SHARED","kind":"constant","lang":"typescript","code":"const SHARED = {\n numSchemas: 500,\n numKeys: 5,\n numExtends: 1,\n};"} {"repo":"zod","file":"packages/tsc/bench/object-with-extend.ts","line":3,"symbol":"$","kind":"constant","lang":"typescript","code":"const $ = execa({ stdout: \"inherit\", stderr: \"inherit\" });"} {"repo":"zod","file":"packages/tsc/bench/omit-extend.ts","line":3,"symbol":"$","kind":"constant","lang":"typescript","code":"const $ = execa({ stdout: \"inherit\", stderr: \"inherit\" });"} {"repo":"zod","file":"packages/tsc/bench/string.ts","line":3,"symbol":"$","kind":"constant","lang":"typescript","code":"const $ = execa({ stdout: \"inherit\", stderr: \"inherit\" });"} {"repo":"zod","file":"packages/tsc/bench/strongly-connected.ts","line":3,"symbol":"$","kind":"constant","lang":"typescript","code":"const $ = execa({ stdout: \"inherit\", stderr: \"inherit\" });"} {"repo":"zod","file":"packages/tsc/bisect.ts","line":31,"symbol":"procs","kind":"constant","lang":"typescript","doc":"1, null, 256 1, null, 512 (fail) 1, 256, 512 1, 256, 384","code":"const procs: any[] = [];"} {"repo":"zod","file":"packages/tsc/bisect.ts","line":48,"symbol":"_proc","kind":"constant","lang":"typescript","code":"const _proc = $`nub run build:bench`;"} {"repo":"zod","file":"packages/tsc/bisect.ts","line":53,"symbol":"proc","kind":"constant","lang":"typescript","code":"const proc = await _proc;"} {"repo":"zod","file":"packages/tsc/bisect.ts","line":56,"symbol":"time","kind":"constant","lang":"typescript","doc":"get instantiations","code":"const time = proc.stdout.match(/total time:\\s+(.+)/i)![1];"} {"repo":"zod","file":"packages/tsc/bisect.ts","line":57,"symbol":"instantiations","kind":"constant","lang":"typescript","code":"const instantiations = proc.stdout.match(/instantiations:\\s+(.+)/i)![1];"} {"repo":"zod","file":"packages/tsc/bisect.ts","line":58,"symbol":"memory","kind":"constant","lang":"typescript","code":"const memory = proc.stdout.match(/memory used:\\s+(.+)/i)![1];"} {"repo":"zod","file":"packages/tsc/generate.ts","line":4,"symbol":"ZOD","kind":"constant","lang":"typescript","code":"const ZOD = {\n imports: [`import * as z from \"zod/v4\";`],\n schemaType: \"z.object\" as const,\n valueTypes: [`z.string()`],\n};"} {"repo":"zod","file":"packages/tsc/generate.ts","line":10,"symbol":"ZOD3","kind":"constant","lang":"typescript","code":"const ZOD3 = {\n imports: [`import * as z from \"zod3\";`],\n schemaType: \"z.object\" as const,\n valueTypes: [`z.string()`],\n};"} {"repo":"zod","file":"packages/tsc/generate.ts","line":16,"symbol":"VALIBOT","kind":"constant","lang":"typescript","code":"const VALIBOT = {\n imports: [`import * as v from \"valibot\";`],\n schemaType: \"valibot\" as const,\n valueTypes: [`v.string()`],\n};"} {"repo":"zod","file":"packages/tsc/generate.ts","line":22,"symbol":"ARKTYPE","kind":"constant","lang":"typescript","code":"const ARKTYPE = {\n imports: [`import {type} from \"arktype\";`],\n schemaType: \"arktype\" as const,\n valueTypes: [`\"string\"`],\n};"} {"repo":"zod","file":"packages/tsc/generate.ts","line":34,"symbol":"GenerateObjectsParams","kind":"interface","lang":"typescript","code":"interface GenerateObjectsParams {\n // path?: string;\n imports: string[];\n schemaType: \"z.object\" | \"arktype\" | \"valibot\";\n valueTypes: string[];\n methods?: string[];\n numSchemas: number;\n numKeys: number;\n numRefs?: number;\n numOmits?: number;\n numPicks?: number;\n numExtends?: number;\n custom?: string;\n}"} {"repo":"zod","file":"packages/tsc/generate.ts","line":49,"symbol":"generate","kind":"function","lang":"typescript","doc":"Step 4: Write the generated schemas to a file","code":"function generate(params: GenerateObjectsParams) {\n const {\n imports,\n schemaType,\n numSchemas,\n numRefs = 0,\n numOmits = 0,\n numPicks = 0,\n numExtends = 0,\n\n custom = \"\",\n } = params;\n const path = \"src/index.ts\";\n // console.log(params);\n let file: string[] = [];\n // const file: string[] = params.imports;\n file = file.concat(imports);\n const names = Array.from({ length: numSchemas }, () => randomStr(17));\n const generated: Array<string> = [...names];\n\n console.log(`Generating ${numSchemas} schemas w/ ${params.numKeys} keys and ${numRefs} refs.`);\n\n for (const variableName of names) {\n // file.push(`export const ${variableName} = { name: \"${variableName}\" };`);\n // if (1 > 0) continue;\n\n // open\n if (schemaType === \"arktype\") {\n file.push(`export const ${variableName} = type({`);\n } else if (schemaType === \"valibot\") {\n file.push(`export const ${variableName} = v.object({`);\n } else {\n file.push(`export const ${variableName} = ${schemaType}({`);\n }\n\n // fields\n const fields = generateFields(params);\n for (const { key, schema } of fields) {\n file.push(` ${key}: ${schema},`);\n }\n\n // refs\n "} {"repo":"zod","file":"packages/tsc/generate.ts","line":61,"symbol":"path","kind":"constant","lang":"typescript","code":"const path = \"src/index.ts\";"} {"repo":"zod","file":"packages/tsc/generate.ts","line":66,"symbol":"names","kind":"constant","lang":"typescript","code":"const names = Array.from({ length: numSchemas }, () => randomStr(17));"} {"repo":"zod","file":"packages/tsc/generate.ts","line":67,"symbol":"generated","kind":"constant","lang":"typescript","code":"const generated: Array<string> = [...names];"} {"repo":"zod","file":"packages/tsc/generate.ts","line":85,"symbol":"fields","kind":"constant","lang":"typescript","doc":"fields","code":"const fields = generateFields(params);"} {"repo":"zod","file":"packages/tsc/generate.ts","line":93,"symbol":"randomIndex","kind":"constant","lang":"typescript","code":"const randomIndex = Math.floor(Math.random() * generated.length);"} {"repo":"zod","file":"packages/tsc/generate.ts","line":94,"symbol":"linked","kind":"constant","lang":"typescript","code":"const linked = generated[randomIndex];"} {"repo":"zod","file":"packages/tsc/generate.ts","line":116,"symbol":"keys","kind":"constant","lang":"typescript","code":"const keys = fields.map((field) => field.key);"} {"repo":"zod","file":"packages/tsc/generate.ts","line":120,"symbol":"varname","kind":"constant","lang":"typescript","code":"const varname = randomStr(7);"} {"repo":"zod","file":"packages/tsc/generate.ts","line":121,"symbol":"omitKeys","kind":"constant","lang":"typescript","code":"const omitKeys = keys.slice(0, keys.length - 1).filter(() => Math.random() > 0.5);"} {"repo":"zod","file":"packages/tsc/generate.ts","line":133,"symbol":"varname","kind":"constant","lang":"typescript","code":"const varname = randomStr(7);"} {"repo":"zod","file":"packages/tsc/generate.ts","line":134,"symbol":"pickKeys","kind":"constant","lang":"typescript","code":"const pickKeys = keys.slice(0, keys.length - 1).filter(() => Math.random() > 0.5);"} {"repo":"zod","file":"packages/tsc/generate.ts","line":147,"symbol":"fields","kind":"constant","lang":"typescript","code":"const fields = generateFields({ ...params, numKeys: numExtends });"} {"repo":"zod","file":"packages/tsc/generate.ts","line":151,"symbol":"varname","kind":"constant","lang":"typescript","doc":"for (const { key, schema } of fields) { file.push(` ${key}: ${schema},`); }","code":"const varname = randomStr(7);"} {"repo":"zod","file":"packages/tsc/generate.ts","line":184,"symbol":"GenerateExtendChainParams","kind":"interface","lang":"typescript","code":"interface GenerateExtendChainParams {\n // path?: string;\n imports: string[];\n schemaType: \"z.object\" | \"arktype\" | \"valibot\";\n valueTypes: string[];\n methods?: string[];\n numSchemas: number;\n numKeys: number;\n // numRefs?: number;\n numOmits?: number;\n numPicks?: number;\n numExtends?: number;\n custom?: string;\n}"} {"repo":"zod","file":"packages/tsc/generate.ts","line":198,"symbol":"generateExtendChain","kind":"function","lang":"typescript","code":"function generateExtendChain(params: GenerateExtendChainParams) {\n const {\n imports,\n schemaType,\n numSchemas,\n\n // numRefs = 0,\n // numOmits = 0,\n // numPicks = 0,\n // numExtends = 0,\n // methods = [\"\"],\n // custom = \"\",\n } = params;\n\n // let counter = 0;\n\n const path = \"src/index.ts\";\n // console.log(params);\n let file: string[] = [];\n // const file: string[] = params.imports;\n file = file.concat(imports);\n const initialName = randomStr(17);\n // const generated: Array<string> = [...names];\n\n console.log(`Generating ${numSchemas} chained calls to .extend() w/ ${params.numKeys} keys...`);\n if (schemaType === \"arktype\") {\n file.push(`export const ${initialName}_0 = type({`);\n } else if (schemaType === \"valibot\") {\n // throw new Error(\"Not supported yet.\")\n file.push(`export const ${initialName}_0 = v.object({`);\n } else {\n file.push(`export const ${initialName}_0 = ${schemaType}({`);\n }\n\n // fields\n let fields = generateFields(params);\n for (const { key, schema } of fields) {\n file.push(` ${key}: ${schema},`);\n }\n\n file.push(\"});\");\n\n // while(let counter = 0; counter < numSchemas; counter++) {\n\n // }\n // let counter "} {"repo":"zod","file":"packages/tsc/generate.ts","line":214,"symbol":"path","kind":"constant","lang":"typescript","code":"const path = \"src/index.ts\";"} {"repo":"zod","file":"packages/tsc/generate.ts","line":219,"symbol":"initialName","kind":"constant","lang":"typescript","code":"const initialName = randomStr(17);"} {"repo":"zod","file":"packages/tsc/generate.ts","line":248,"symbol":"prevName","kind":"constant","lang":"typescript","code":"const prevName = `${initialName}_${counter - 1}`;"} {"repo":"zod","file":"packages/tsc/generate.ts","line":249,"symbol":"newName","kind":"constant","lang":"typescript","code":"const newName = `${initialName}_${counter}`;"} {"repo":"zod","file":"packages/tsc/generate.ts","line":252,"symbol":"omitFields","kind":"constant","lang":"typescript","doc":"omit three keys from `fields`","code":"const omitFields = fields.slice(0, 3);"} {"repo":"zod","file":"packages/tsc/generate.ts","line":275,"symbol":"newFields","kind":"constant","lang":"typescript","doc":"extend three keys to `fields`","code":"const newFields = generateFields({ ...params, numKeys: 3 });"} {"repo":"zod","file":"packages/tsc/generate.ts","line":316,"symbol":"randomStr","kind":"function","lang":"typescript","doc":"Step 2: Generate a random string for keys and variable names","code":"function randomStr(length: number) {\n const charset = \"abcdefghijklmnopqrstuvwxyz\";\n let result = \"\";\n for (let i = 0; i < length; i++) {\n const randomIndex = Math.floor(Math.random() * charset.length);\n result += charset[randomIndex];\n }\n return result;\n}"} {"repo":"zod","file":"packages/tsc/generate.ts","line":317,"symbol":"charset","kind":"constant","lang":"typescript","code":"const charset = \"abcdefghijklmnopqrstuvwxyz\";"} {"repo":"zod","file":"packages/tsc/generate.ts","line":320,"symbol":"randomIndex","kind":"constant","lang":"typescript","code":"const randomIndex = Math.floor(Math.random() * charset.length);"} {"repo":"zod","file":"packages/tsc/generate.ts","line":327,"symbol":"generateFields","kind":"function","lang":"typescript","doc":"Step 3: Generate a random Zod schema","code":"function generateFields(\n params: Pick<GenerateObjectsParams, \"numKeys\" | \"valueTypes\" | \"methods\">\n): { key: string; schema: string }[] {\n //Math.floor(Math.random() * 30) + 1; // 1-30 keys\n const { methods = [\"\"] } = params;\n\n // const keys = [];\n const fields: { key: string; schema: string }[] = [];\n for (let i = 0; i < params.numKeys; i++) {\n const key = randomStr(8); // Key name of 8 chars\n // keys.push(key);\n const randomTypeIndex = Math.floor(Math.random() * params.valueTypes.length);\n const randomChainMethodIndex = Math.floor(Math.random() * methods.length);\n const randomType = params.valueTypes[randomTypeIndex]!;\n // const randomChance = Math.random();\n // if (randomChance > 0.98) {\n // const { schema: nestedSchema } = generateRandomZodSchema();\n // schema += ` ${key}: ${nestedSchema},`;\n // continue;\n // }\n const type = randomType + methods[randomChainMethodIndex]!;\n\n fields.push({ key, schema: type });\n // schema += ` ${key}: ${type},`;\n }\n\n // schema += \" })\";\n return fields;\n}"} {"repo":"zod","file":"packages/tsc/generate.ts","line":334,"symbol":"fields","kind":"constant","lang":"typescript","doc":"const keys = [];","code":"const fields: { key: string; schema: string }[] = [];"} {"repo":"zod","file":"packages/tsc/generate.ts","line":336,"symbol":"key","kind":"constant","lang":"typescript","code":"const key = randomStr(8);"} {"repo":"zod","file":"packages/tsc/generate.ts","line":338,"symbol":"randomTypeIndex","kind":"constant","lang":"typescript","doc":"keys.push(key);","code":"const randomTypeIndex = Math.floor(Math.random() * params.valueTypes.length);"} {"repo":"zod","file":"packages/tsc/generate.ts","line":339,"symbol":"randomChainMethodIndex","kind":"constant","lang":"typescript","code":"const randomChainMethodIndex = Math.floor(Math.random() * methods.length);"} {"repo":"zod","file":"packages/tsc/generate.ts","line":340,"symbol":"randomType","kind":"constant","lang":"typescript","code":"const randomType = params.valueTypes[randomTypeIndex]!;"} {"repo":"zod","file":"packages/tsc/generate.ts","line":347,"symbol":"type","kind":"constant","lang":"typescript","doc":"const randomChance = Math.random(); if (randomChance > 0.98) { const { schema: nestedSchema } = generateRandomZodSchema(); schema += ` ${key}: ${nestedSchema},`; continue; }","code":"const type = randomType + methods[randomChainMethodIndex]!;"} {"repo":"zod","file":"packages/zod/src/compile.ts","line":20,"symbol":"originalRun","kind":"constant","lang":"typescript","code":"const originalRun = inst._zod?.run;"} {"repo":"zod","file":"packages/zod/src/compile.ts","line":23,"symbol":"shim","kind":"constant","lang":"typescript","code":"const shim = (payload: any, ctx: any): any => {\n // Bypass the fast path for any non-forward / non-sync / check-skipping call. The runtime owns those contracts.\n if (ctx?.async || ctx?.direction === \"backward\" || ctx?.skipChecks) {\n return originalRun(payload, ctx);\n }\n\n compiling = true;\n try {\n // Respect the jitless config: it exists precisely so CSP/no-eval environments never reach `new Function`. Global mode must not bypass it (explicit z.compile calls remain an explicit opt-in).\n if (core.globalConfig.jitless) {\n inst._zod.run = originalRun;\n return originalRun(payload, ctx);\n }\n // Strict: the shim owns its own fallback below, and a non-strict compile would hand back `inst` — whose run is this shim — and reinstall it on itself.\n const compiled = compile(inst, { strict: true });\n // Only the run wrapper. Copying the compiled parse/safeParse closures would make their fallback re-enter this instance and run user callbacks a third time.\n inst._zod.run = compiled._zod.run;\n inst._zod.bag.fallbackRun = compiled._zod.bag.fallbackRun;\n inst._zod.bag.validator = compiled._zod.bag.validator;\n } catch {\n "} {"repo":"zod","file":"packages/zod/src/compile.ts","line":37,"symbol":"compiled","kind":"constant","lang":"typescript","doc":"Strict: the shim owns its own fallback below, and a non-strict compile would hand back `inst` — whose run is this shim — and reinstall it on itself.","code":"const compiled = compile(inst, { strict: true });"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":5,"symbol":"allKeys","kind":"type","lang":"typescript","code":"type allKeys<T> = T extends any ? keyof T : never;"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":7,"symbol":"inferFlattenedErrors","kind":"type","lang":"typescript","code":"type inferFlattenedErrors<T extends ZodType<any, any, any>, U = string> = typeToFlattenedError<TypeOf<T>, U>;"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":8,"symbol":"typeToFlattenedError","kind":"type","lang":"typescript","code":"type typeToFlattenedError<T, U = string> = {\n formErrors: U[];\n fieldErrors: {\n [P in allKeys<T>]?: U[];\n };\n};"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":15,"symbol":"ZodIssueCode","kind":"constant","lang":"typescript","code":"const ZodIssueCode = util.arrayToEnum([\n \"invalid_type\",\n \"invalid_literal\",\n \"custom\",\n \"invalid_union\",\n \"invalid_union_discriminator\",\n \"invalid_enum_value\",\n \"unrecognized_keys\",\n \"invalid_arguments\",\n \"invalid_return_type\",\n \"invalid_date\",\n \"invalid_string\",\n \"too_small\",\n \"too_big\",\n \"invalid_intersection_types\",\n \"not_multiple_of\",\n \"not_finite\",\n]);"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":34,"symbol":"ZodIssueCode","kind":"type","lang":"typescript","code":"type ZodIssueCode = keyof typeof ZodIssueCode;"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":36,"symbol":"ZodIssueBase","kind":"type","lang":"typescript","code":"type ZodIssueBase = {\n path: (string | number)[];\n message?: string | undefined;\n};"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":41,"symbol":"ZodInvalidTypeIssue","kind":"interface","lang":"typescript","code":"interface ZodInvalidTypeIssue extends ZodIssueBase {\n code: typeof ZodIssueCode.invalid_type;\n expected: ZodParsedType;\n received: ZodParsedType;\n}"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":47,"symbol":"ZodInvalidLiteralIssue","kind":"interface","lang":"typescript","code":"interface ZodInvalidLiteralIssue extends ZodIssueBase {\n code: typeof ZodIssueCode.invalid_literal;\n expected: unknown;\n received: unknown;\n}"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":53,"symbol":"ZodUnrecognizedKeysIssue","kind":"interface","lang":"typescript","code":"interface ZodUnrecognizedKeysIssue extends ZodIssueBase {\n code: typeof ZodIssueCode.unrecognized_keys;\n keys: string[];\n}"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":58,"symbol":"ZodInvalidUnionIssue","kind":"interface","lang":"typescript","code":"interface ZodInvalidUnionIssue extends ZodIssueBase {\n code: typeof ZodIssueCode.invalid_union;\n unionErrors: ZodError[];\n}"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":63,"symbol":"ZodInvalidUnionDiscriminatorIssue","kind":"interface","lang":"typescript","code":"interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase {\n code: typeof ZodIssueCode.invalid_union_discriminator;\n options: Primitive[];\n}"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":68,"symbol":"ZodInvalidEnumValueIssue","kind":"interface","lang":"typescript","code":"interface ZodInvalidEnumValueIssue extends ZodIssueBase {\n received: string | number;\n code: typeof ZodIssueCode.invalid_enum_value;\n options: (string | number)[];\n}"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":74,"symbol":"ZodInvalidArgumentsIssue","kind":"interface","lang":"typescript","code":"interface ZodInvalidArgumentsIssue extends ZodIssueBase {\n code: typeof ZodIssueCode.invalid_arguments;\n argumentsError: ZodError;\n}"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":79,"symbol":"ZodInvalidReturnTypeIssue","kind":"interface","lang":"typescript","code":"interface ZodInvalidReturnTypeIssue extends ZodIssueBase {\n code: typeof ZodIssueCode.invalid_return_type;\n returnTypeError: ZodError;\n}"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":84,"symbol":"ZodInvalidDateIssue","kind":"interface","lang":"typescript","code":"interface ZodInvalidDateIssue extends ZodIssueBase {\n code: typeof ZodIssueCode.invalid_date;\n}"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":88,"symbol":"StringValidation","kind":"type","lang":"typescript","code":"type StringValidation =\n | \"email\"\n | \"url\"\n | \"emoji\"\n | \"uuid\"\n | \"nanoid\"\n | \"regex\"\n | \"cuid\"\n | \"cuid2\"\n | \"ulid\"\n | \"datetime\"\n | \"date\"\n | \"time\"\n | \"duration\"\n | \"ip\"\n | \"cidr\"\n | \"base64\"\n | \"jwt\"\n | \"base64url\"\n | { includes: string; position?: number | undefined }\n | { startsWith: string }\n | { endsWith: string };"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":111,"symbol":"ZodInvalidStringIssue","kind":"interface","lang":"typescript","code":"interface ZodInvalidStringIssue extends ZodIssueBase {\n code: typeof ZodIssueCode.invalid_string;\n validation: StringValidation;\n}"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":116,"symbol":"ZodTooSmallIssue","kind":"interface","lang":"typescript","code":"interface ZodTooSmallIssue extends ZodIssueBase {\n code: typeof ZodIssueCode.too_small;\n minimum: number | bigint;\n inclusive: boolean;\n exact?: boolean;\n type: \"array\" | \"string\" | \"number\" | \"set\" | \"date\" | \"bigint\";\n}"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":124,"symbol":"ZodTooBigIssue","kind":"interface","lang":"typescript","code":"interface ZodTooBigIssue extends ZodIssueBase {\n code: typeof ZodIssueCode.too_big;\n maximum: number | bigint;\n inclusive: boolean;\n exact?: boolean;\n type: \"array\" | \"string\" | \"number\" | \"set\" | \"date\" | \"bigint\";\n}"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":132,"symbol":"ZodInvalidIntersectionTypesIssue","kind":"interface","lang":"typescript","code":"interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase {\n code: typeof ZodIssueCode.invalid_intersection_types;\n}"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":136,"symbol":"ZodNotMultipleOfIssue","kind":"interface","lang":"typescript","code":"interface ZodNotMultipleOfIssue extends ZodIssueBase {\n code: typeof ZodIssueCode.not_multiple_of;\n multipleOf: number | bigint;\n}"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":141,"symbol":"ZodNotFiniteIssue","kind":"interface","lang":"typescript","code":"interface ZodNotFiniteIssue extends ZodIssueBase {\n code: typeof ZodIssueCode.not_finite;\n}"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":145,"symbol":"ZodCustomIssue","kind":"interface","lang":"typescript","code":"interface ZodCustomIssue extends ZodIssueBase {\n code: typeof ZodIssueCode.custom;\n params?: { [k: string]: any };\n}"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":150,"symbol":"DenormalizedError","kind":"type","lang":"typescript","code":"type DenormalizedError = { [k: string]: DenormalizedError | string[] };"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":152,"symbol":"ZodIssueOptionalMessage","kind":"type","lang":"typescript","code":"type ZodIssueOptionalMessage =\n | ZodInvalidTypeIssue\n | ZodInvalidLiteralIssue\n | ZodUnrecognizedKeysIssue\n | ZodInvalidUnionIssue\n | ZodInvalidUnionDiscriminatorIssue\n | ZodInvalidEnumValueIssue\n | ZodInvalidArgumentsIssue\n | ZodInvalidReturnTypeIssue\n | ZodInvalidDateIssue\n | ZodInvalidStringIssue\n | ZodTooSmallIssue\n | ZodTooBigIssue\n | ZodInvalidIntersectionTypesIssue\n | ZodNotMultipleOfIssue\n | ZodNotFiniteIssue\n | ZodCustomIssue;"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":170,"symbol":"ZodIssue","kind":"type","lang":"typescript","code":"type ZodIssue = ZodIssueOptionalMessage & {\n fatal?: boolean | undefined;\n message: string;\n};"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":175,"symbol":"quotelessJson","kind":"constant","lang":"typescript","code":"const quotelessJson = (obj: any) => {\n const json = JSON.stringify(obj, null, 2);\n return json.replace(/\"([^\"]+)\":/g, \"$1:\");\n};"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":176,"symbol":"json","kind":"constant","lang":"typescript","code":"const json = JSON.stringify(obj, null, 2);"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":180,"symbol":"recursiveZodFormattedError","kind":"type","lang":"typescript","code":"type recursiveZodFormattedError<T> = T extends [any, ...any[]]\n ? { [K in keyof T]?: ZodFormattedError<T[K]> }\n : T extends any[]\n ? { [k: number]: ZodFormattedError<T[number]> }\n : T extends object\n ? { [K in keyof T]?: ZodFormattedError<T[K]> }\n : unknown;"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":188,"symbol":"ZodFormattedError","kind":"type","lang":"typescript","code":"type ZodFormattedError<T, U = string> = {\n _errors: U[];\n} & recursiveZodFormattedError<NonNullable<T>>;"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":192,"symbol":"inferFormattedError","kind":"type","lang":"typescript","code":"type inferFormattedError<T extends ZodType<any, any, any>, U = string> = ZodFormattedError<TypeOf<T>, U>;"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":194,"symbol":"ZodError","kind":"class","lang":"typescript","code":"class ZodError<T = any> extends Error {\n issues: ZodIssue[] = [];\n\n get errors() {\n return this.issues;\n }\n\n constructor(issues: ZodIssue[]) {\n super();\n\n const actualProto = new.target.prototype;\n if (Object.setPrototypeOf) {\n // eslint-disable-next-line ban/ban\n Object.setPrototypeOf(this, actualProto);\n } else {\n (this as any).__proto__ = actualProto;\n }\n this.name = \"ZodError\";\n this.issues = issues;\n }\n\n format(): ZodFormattedError<T>;\n format<U>(mapper: (issue: ZodIssue) => U): ZodFormattedError<T, U>;\n format(_mapper?: any) {\n const mapper: (issue: ZodIssue) => any =\n _mapper ||\n function (issue: ZodIssue) {\n return issue.message;\n };\n const fieldErrors: ZodFormattedError<T> = { _errors: [] } as any;\n const processError = (error: ZodError) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\") {\n issue.unionErrors.map(processError);\n } else if (issue.code === \"invalid_return_type\") {\n processError(issue.returnTypeError);\n } else if (issue.code === \"invalid_arguments\") {\n processError(issue.argumentsError);\n } else i"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":197,"symbol":"errors","kind":"method","lang":"typescript","code":"get errors() {\n return this.issues;\n }"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":201,"symbol":"constructor","kind":"method","lang":"typescript","code":"constructor(issues: ZodIssue[]) {\n super();\n\n const actualProto = new.target.prototype;\n if (Object.setPrototypeOf) {\n // eslint-disable-next-line ban/ban\n Object.setPrototypeOf(this, actualProto);\n } else {\n (this as any).__proto__ = actualProto;\n }\n this.name = \"ZodError\";\n this.issues = issues;\n }"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":204,"symbol":"actualProto","kind":"constant","lang":"typescript","code":"const actualProto = new.target.prototype;"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":217,"symbol":"format","kind":"method","lang":"typescript","code":"format(_mapper?: any) {\n const mapper: (issue: ZodIssue) => any =\n _mapper ||\n function (issue: ZodIssue) {\n return issue.message;\n };\n const fieldErrors: ZodFormattedError<T> = { _errors: [] } as any;\n const processError = (error: ZodError) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\") {\n issue.unionErrors.map(processError);\n } else if (issue.code === \"invalid_return_type\") {\n processError(issue.returnTypeError);\n } else if (issue.code === \"invalid_arguments\") {\n processError(issue.argumentsError);\n } else if (issue.path.length === 0) {\n (fieldErrors as any)._errors.push(mapper(issue));\n } else {\n let curr: any = fieldErrors;\n let i = 0;\n while (i < issue.path.length) {\n const el = issue.path[i]!;\n const terminal = i === issue.path.length - 1;\n\n // `_errors` is reserved by this legacy format, so merge a matching path segment into the current node instead of treating its array as a child.\n if (el === \"_errors\") {\n if (terminal) curr._errors.push(mapper(issue));\n"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":218,"symbol":"mapper","kind":"constant","lang":"typescript","code":"const mapper: (issue: ZodIssue) => any =\n _mapper ||\n function (issue: ZodIssue) {\n return issue.message;\n };"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":223,"symbol":"fieldErrors","kind":"constant","lang":"typescript","code":"const fieldErrors: ZodFormattedError<T> = { _errors: [] } as any;"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":224,"symbol":"processError","kind":"constant","lang":"typescript","code":"const processError = (error: ZodError) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\") {\n issue.unionErrors.map(processError);\n } else if (issue.code === \"invalid_return_type\") {\n processError(issue.returnTypeError);\n } else if (issue.code === \"invalid_arguments\") {\n processError(issue.argumentsError);\n } else if (issue.path.length === 0) {\n (fieldErrors as any)._errors.push(mapper(issue));\n } else {\n let curr: any = fieldErrors;\n let i = 0;\n while (i < issue.path.length) {\n const el = issue.path[i]!;\n const terminal = i === issue.path.length - 1;\n\n // `_errors` is reserved by this legacy format, so merge a matching path segment into the current node instead of treating its array as a child.\n if (el === \"_errors\") {\n if (terminal) curr._errors.push(mapper(issue));\n i++;\n continue;\n }\n\n // Create `el` as an own data property. A segment naming an inherited member (\"toString\", \"constructor\") would otherwise read through to the prototype, and assignin"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":238,"symbol":"el","kind":"constant","lang":"typescript","code":"const el = issue.path[i]!;"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":239,"symbol":"terminal","kind":"constant","lang":"typescript","code":"const terminal = i === issue.path.length - 1;"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":277,"symbol":"error","kind":"constant","lang":"typescript","code":"const error = new ZodError(issues);"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":281,"symbol":"assert","kind":"method","lang":"typescript","code":"static assert(value: unknown): asserts value is ZodError {\n if (!(value instanceof ZodError)) {\n throw new Error(`Not a ZodError: ${value}`);\n }\n }"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":287,"symbol":"toString","kind":"method","lang":"typescript","code":"override toString() {\n return this.message;\n }"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":290,"symbol":"message","kind":"method","lang":"typescript","code":"override get message() {\n return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);\n }"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":294,"symbol":"isEmpty","kind":"method","lang":"typescript","code":"get isEmpty(): boolean {\n return this.issues.length === 0;\n }"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":308,"symbol":"flatten","kind":"method","lang":"typescript","code":"flatten<U = string>(mapper: (issue: ZodIssue) => U = (issue: ZodIssue) => issue.message as any): any {\n const fieldErrors: any = Object.create(null);\n const formErrors: U[] = [];\n for (const sub of this.issues) {\n if (sub.path.length > 0) {\n const firstEl = sub.path[0]!;\n fieldErrors[firstEl] = fieldErrors[firstEl] || [];\n fieldErrors[firstEl].push(mapper(sub));\n } else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n }"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":309,"symbol":"fieldErrors","kind":"constant","lang":"typescript","code":"const fieldErrors: any = Object.create(null);"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":310,"symbol":"formErrors","kind":"constant","lang":"typescript","code":"const formErrors: U[] = [];"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":313,"symbol":"firstEl","kind":"constant","lang":"typescript","code":"const firstEl = sub.path[0]!;"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":323,"symbol":"formErrors","kind":"method","lang":"typescript","code":"get formErrors() {\n return this.flatten();\n }"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":328,"symbol":"stripPath","kind":"type","lang":"typescript","code":"type stripPath<T extends object> = T extends any ? util.OmitKeys<T, \"path\"> : never;"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":330,"symbol":"IssueData","kind":"type","lang":"typescript","code":"type IssueData = stripPath<ZodIssueOptionalMessage> & {\n path?: (string | number)[];\n fatal?: boolean | undefined;\n};"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":335,"symbol":"ErrorMapCtx","kind":"type","lang":"typescript","code":"type ErrorMapCtx = {\n defaultError: string;\n data: any;\n};"} {"repo":"zod","file":"packages/zod/src/v3/ZodError.ts","line":340,"symbol":"ZodErrorMap","kind":"type","lang":"typescript","code":"type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => { message: string };"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/datetime.ts","line":3,"symbol":"datetimeValidationSuite","kind":"constant","lang":"typescript","code":"const datetimeValidationSuite = new Benchmark.Suite(\"datetime\");"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/datetime.ts","line":5,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = \"2021-01-01\";"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/datetime.ts","line":6,"symbol":"MONTHS_31","kind":"constant","lang":"typescript","code":"const MONTHS_31 = new Set([1, 3, 5, 7, 8, 10, 12]);"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/datetime.ts","line":7,"symbol":"MONTHS_30","kind":"constant","lang":"typescript","code":"const MONTHS_30 = new Set([4, 6, 9, 11]);"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/datetime.ts","line":9,"symbol":"simpleDatetimeRegex","kind":"constant","lang":"typescript","code":"const simpleDatetimeRegex = /^(\\d{4})-(\\d{2})-(\\d{2})$/;"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/datetime.ts","line":10,"symbol":"datetimeRegexNoLeapYearValidation","kind":"constant","lang":"typescript","code":"const datetimeRegexNoLeapYearValidation =\n /^\\d{4}-((0[13578]|10|12)-31|(0[13-9]|1[0-2])-30|(0[1-9]|1[0-2])-(0[1-9]|1\\d|2\\d))$/;"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/datetime.ts","line":12,"symbol":"datetimeRegexWithLeapYearValidation","kind":"constant","lang":"typescript","code":"const datetimeRegexWithLeapYearValidation =\n /^((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))$/;"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/datetime.ts","line":29,"symbol":"match","kind":"constant","lang":"typescript","code":"const match = DATA.match(simpleDatetimeRegex);"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/datetime.ts","line":33,"symbol":"year","kind":"constant","lang":"typescript","doc":"Extract year, month, and day from the capture groups","code":"const year = Number.parseInt(match[1], 10);"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/datetime.ts","line":34,"symbol":"month","kind":"constant","lang":"typescript","code":"const month = Number.parseInt(match[2], 10);"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/datetime.ts","line":35,"symbol":"day","kind":"constant","lang":"typescript","code":"const day = Number.parseInt(match[3], 10);"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/discriminatedUnion.ts","line":5,"symbol":"doubleSuite","kind":"constant","lang":"typescript","code":"const doubleSuite = new Benchmark.Suite(\"z.discriminatedUnion: double\");"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/discriminatedUnion.ts","line":6,"symbol":"manySuite","kind":"constant","lang":"typescript","code":"const manySuite = new Benchmark.Suite(\"z.discriminatedUnion: many\");"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/discriminatedUnion.ts","line":8,"symbol":"aSchema","kind":"constant","lang":"typescript","code":"const aSchema = z.object({\n type: z.literal(\"a\"),\n});"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/discriminatedUnion.ts","line":11,"symbol":"objA","kind":"constant","lang":"typescript","code":"const objA = {\n type: \"a\",\n};"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/discriminatedUnion.ts","line":15,"symbol":"bSchema","kind":"constant","lang":"typescript","code":"const bSchema = z.object({\n type: z.literal(\"b\"),\n});"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/discriminatedUnion.ts","line":18,"symbol":"objB","kind":"constant","lang":"typescript","code":"const objB = {\n type: \"b\",\n};"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/discriminatedUnion.ts","line":22,"symbol":"cSchema","kind":"constant","lang":"typescript","code":"const cSchema = z.object({\n type: z.literal(\"c\"),\n});"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/discriminatedUnion.ts","line":25,"symbol":"objC","kind":"constant","lang":"typescript","code":"const objC = {\n type: \"c\",\n};"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/discriminatedUnion.ts","line":29,"symbol":"dSchema","kind":"constant","lang":"typescript","code":"const dSchema = z.object({\n type: z.literal(\"d\"),\n});"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/discriminatedUnion.ts","line":33,"symbol":"double","kind":"constant","lang":"typescript","code":"const double = z.discriminatedUnion(\"type\", [aSchema, bSchema]);"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/discriminatedUnion.ts","line":34,"symbol":"many","kind":"constant","lang":"typescript","code":"const many = z.discriminatedUnion(\"type\", [aSchema, bSchema, cSchema, dSchema]);"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/index.ts","line":12,"symbol":"argv","kind":"constant","lang":"typescript","code":"const argv = process.argv.slice(2);"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/ipv4.ts","line":3,"symbol":"suite","kind":"constant","lang":"typescript","code":"const suite = new Benchmark.Suite(\"ipv4\");"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/ipv4.ts","line":5,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = \"127.0.0.1\";"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/ipv4.ts","line":6,"symbol":"ipv4RegexA","kind":"constant","lang":"typescript","code":"const ipv4RegexA =\n /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/ipv4.ts","line":8,"symbol":"ipv4RegexB","kind":"constant","lang":"typescript","code":"const ipv4RegexB =\n /^(?:(?:(?=(25[0-5]))\\1|(?=(2[0-4][0-9]))\\2|(?=(1[0-9]{2}))\\3|(?=([0-9]{1,2}))\\4)\\.){3}(?:(?=(25[0-5]))\\5|(?=(2[0-4][0-9]))\\6|(?=(1[0-9]{2}))\\7|(?=([0-9]{1,2}))\\8)$/;"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/ipv4.ts","line":10,"symbol":"ipv4RegexC","kind":"constant","lang":"typescript","code":"const ipv4RegexC = /^(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)$/;"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/ipv4.ts","line":11,"symbol":"ipv4RegexD","kind":"constant","lang":"typescript","code":"const ipv4RegexD = /^(\\b25[0-5]|\\b2[0-4][0-9]|\\b[01]?[0-9][0-9]?)(\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/;"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/ipv4.ts","line":12,"symbol":"ipv4RegexE","kind":"constant","lang":"typescript","code":"const ipv4RegexE = /^((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.){3}(25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)$/;"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/ipv4.ts","line":13,"symbol":"ipv4RegexF","kind":"constant","lang":"typescript","code":"const ipv4RegexF = /^((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}$/;"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/ipv4.ts","line":14,"symbol":"ipv4RegexG","kind":"constant","lang":"typescript","code":"const ipv4RegexG = /^((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)(\\.(?!$)|$)){4}$/;"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/ipv4.ts","line":15,"symbol":"ipv4RegexH","kind":"constant","lang":"typescript","code":"const ipv4RegexH = /^((25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])(\\.(?!$)|$)){4}$/;"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/ipv4.ts","line":16,"symbol":"ipv4RegexI","kind":"constant","lang":"typescript","code":"const ipv4RegexI =\n /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/object.ts","line":5,"symbol":"emptySuite","kind":"constant","lang":"typescript","code":"const emptySuite = new Benchmark.Suite(\"z.object: empty\");"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/object.ts","line":6,"symbol":"shortSuite","kind":"constant","lang":"typescript","code":"const shortSuite = new Benchmark.Suite(\"z.object: short\");"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/object.ts","line":7,"symbol":"longSuite","kind":"constant","lang":"typescript","code":"const longSuite = new Benchmark.Suite(\"z.object: long\");"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/object.ts","line":9,"symbol":"empty","kind":"constant","lang":"typescript","code":"const empty = z.object({});"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/object.ts","line":10,"symbol":"short","kind":"constant","lang":"typescript","code":"const short = z.object({\n string: z.string(),\n});"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/object.ts","line":13,"symbol":"long","kind":"constant","lang":"typescript","code":"const long = z.object({\n string: z.string(),\n number: z.number(),\n boolean: z.boolean(),\n});"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/primitives.ts","line":6,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = new Mocker();"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/primitives.ts","line":8,"symbol":"enumSuite","kind":"constant","lang":"typescript","code":"const enumSuite = new Benchmark.Suite(\"z.enum\");"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/primitives.ts","line":9,"symbol":"enumSchema","kind":"constant","lang":"typescript","code":"const enumSchema = z.enum([\"a\", \"b\", \"c\"]);"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/primitives.ts","line":24,"symbol":"longEnumSuite","kind":"constant","lang":"typescript","code":"const longEnumSuite = new Benchmark.Suite(\"long z.enum\");"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/primitives.ts","line":25,"symbol":"longEnumSchema","kind":"constant","lang":"typescript","code":"const longEnumSchema = z.enum([\n \"one\",\n \"two\",\n \"three\",\n \"four\",\n \"five\",\n \"six\",\n \"seven\",\n \"eight\",\n \"nine\",\n \"ten\",\n \"eleven\",\n \"twelve\",\n \"thirteen\",\n \"fourteen\",\n \"fifteen\",\n \"sixteen\",\n \"seventeen\",\n]);"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/primitives.ts","line":58,"symbol":"undefinedSuite","kind":"constant","lang":"typescript","code":"const undefinedSuite = new Benchmark.Suite(\"z.undefined\");"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/primitives.ts","line":59,"symbol":"undefinedSchema","kind":"constant","lang":"typescript","code":"const undefinedSchema = z.undefined();"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/primitives.ts","line":74,"symbol":"literalSuite","kind":"constant","lang":"typescript","code":"const literalSuite = new Benchmark.Suite(\"z.literal\");"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/primitives.ts","line":75,"symbol":"short","kind":"constant","lang":"typescript","code":"const short = \"short\";"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/primitives.ts","line":76,"symbol":"bad","kind":"constant","lang":"typescript","code":"const bad = \"bad\";"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/primitives.ts","line":77,"symbol":"literalSchema","kind":"constant","lang":"typescript","code":"const literalSchema = z.literal(\"short\");"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/primitives.ts","line":92,"symbol":"numberSuite","kind":"constant","lang":"typescript","code":"const numberSuite = new Benchmark.Suite(\"z.number\");"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/primitives.ts","line":93,"symbol":"numberSchema","kind":"constant","lang":"typescript","code":"const numberSchema = z.number().int();"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/primitives.ts","line":113,"symbol":"dateSuite","kind":"constant","lang":"typescript","code":"const dateSuite = new Benchmark.Suite(\"z.date\");"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/primitives.ts","line":115,"symbol":"plainDate","kind":"constant","lang":"typescript","code":"const plainDate = z.date();"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/primitives.ts","line":116,"symbol":"minMaxDate","kind":"constant","lang":"typescript","code":"const minMaxDate = z.date().min(new Date(\"2021-01-01\")).max(new Date(\"2030-01-01\"));"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/primitives.ts","line":144,"symbol":"symbolSuite","kind":"constant","lang":"typescript","code":"const symbolSuite = new Benchmark.Suite(\"z.symbol\");"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/primitives.ts","line":145,"symbol":"symbolSchema","kind":"constant","lang":"typescript","code":"const symbolSchema = z.symbol();"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/realworld.ts","line":5,"symbol":"shortSuite","kind":"constant","lang":"typescript","code":"const shortSuite = new Benchmark.Suite(\"realworld\");"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/realworld.ts","line":7,"symbol":"People","kind":"constant","lang":"typescript","code":"const People = z.array(\n z.object({\n type: z.literal(\"person\"),\n hair: z.enum([\"blue\", \"brown\"]),\n active: z.boolean(),\n name: z.string(),\n age: z.number().int(),\n hobbies: z.array(z.string()),\n address: z.object({\n street: z.string(),\n zip: z.string(),\n country: z.string(),\n }),\n })\n);"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/realworld.ts","line":25,"symbol":"num","kind":"function","lang":"typescript","code":"function num() {\n return ++i;\n}"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/realworld.ts","line":29,"symbol":"str","kind":"function","lang":"typescript","code":"function str() {\n return (++i % 100).toString(16);\n}"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/realworld.ts","line":33,"symbol":"array","kind":"function","lang":"typescript","code":"function array<T>(fn: () => T): T[] {\n return Array.from({ length: ++i % 10 }, () => fn());\n}"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/realworld.ts","line":37,"symbol":"people","kind":"constant","lang":"typescript","code":"const people = Array.from({ length: 100 }, () => {\n return {\n type: \"person\",\n hair: i % 2 ? \"blue\" : \"brown\",\n active: !!(i % 2),\n name: str(),\n age: num(),\n hobbies: array(str),\n address: {\n street: str(),\n zip: str(),\n country: str(),\n },\n };\n});"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/string.ts","line":5,"symbol":"SUITE_NAME","kind":"constant","lang":"typescript","code":"const SUITE_NAME = \"z.string\";"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/string.ts","line":6,"symbol":"suite","kind":"constant","lang":"typescript","code":"const suite = new Benchmark.Suite(SUITE_NAME);"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/string.ts","line":8,"symbol":"empty","kind":"constant","lang":"typescript","code":"const empty = \"\";"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/string.ts","line":9,"symbol":"short","kind":"constant","lang":"typescript","code":"const short = \"short\";"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/string.ts","line":10,"symbol":"long","kind":"constant","lang":"typescript","code":"const long = \"long\".repeat(256);"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/string.ts","line":11,"symbol":"manual","kind":"constant","lang":"typescript","code":"const manual = (str: unknown) => {\n if (typeof str !== \"string\") {\n throw new Error(\"Not a string\");\n }\n\n return str;\n};"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/string.ts","line":18,"symbol":"stringSchema","kind":"constant","lang":"typescript","code":"const stringSchema = z.string();"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/string.ts","line":19,"symbol":"optionalStringSchema","kind":"constant","lang":"typescript","code":"const optionalStringSchema = z.string().optional();"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/string.ts","line":20,"symbol":"optionalNullableStringSchema","kind":"constant","lang":"typescript","code":"const optionalNullableStringSchema = z.string().optional().nullable();"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/union.ts","line":5,"symbol":"doubleSuite","kind":"constant","lang":"typescript","code":"const doubleSuite = new Benchmark.Suite(\"z.union: double\");"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/union.ts","line":6,"symbol":"manySuite","kind":"constant","lang":"typescript","code":"const manySuite = new Benchmark.Suite(\"z.union: many\");"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/union.ts","line":8,"symbol":"aSchema","kind":"constant","lang":"typescript","code":"const aSchema = z.object({\n type: z.literal(\"a\"),\n});"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/union.ts","line":11,"symbol":"objA","kind":"constant","lang":"typescript","code":"const objA = {\n type: \"a\",\n};"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/union.ts","line":15,"symbol":"bSchema","kind":"constant","lang":"typescript","code":"const bSchema = z.object({\n type: z.literal(\"b\"),\n});"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/union.ts","line":18,"symbol":"objB","kind":"constant","lang":"typescript","code":"const objB = {\n type: \"b\",\n};"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/union.ts","line":22,"symbol":"cSchema","kind":"constant","lang":"typescript","code":"const cSchema = z.object({\n type: z.literal(\"c\"),\n});"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/union.ts","line":25,"symbol":"objC","kind":"constant","lang":"typescript","code":"const objC = {\n type: \"c\",\n};"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/union.ts","line":29,"symbol":"dSchema","kind":"constant","lang":"typescript","code":"const dSchema = z.object({\n type: z.literal(\"d\"),\n});"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/union.ts","line":33,"symbol":"double","kind":"constant","lang":"typescript","code":"const double = z.union([aSchema, bSchema]);"} {"repo":"zod","file":"packages/zod/src/v3/benchmarks/union.ts","line":34,"symbol":"many","kind":"constant","lang":"typescript","code":"const many = z.union([aSchema, bSchema, cSchema, dSchema]);"} {"repo":"zod","file":"packages/zod/src/v3/errors.ts","line":7,"symbol":"setErrorMap","kind":"function","lang":"typescript","code":"function setErrorMap(map: ZodErrorMap) {\n overrideErrorMap = map;\n}"} {"repo":"zod","file":"packages/zod/src/v3/errors.ts","line":11,"symbol":"getErrorMap","kind":"function","lang":"typescript","code":"function getErrorMap() {\n return overrideErrorMap;\n}"} {"repo":"zod","file":"packages/zod/src/v3/helpers/enumUtil.ts","line":2,"symbol":"UnionToIntersectionFn","kind":"type","lang":"typescript","code":"type UnionToIntersectionFn<T> = (T extends unknown ? (k: () => T) => void : never) extends (\n k: infer Intersection\n ) => void\n ? Intersection\n : never;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/enumUtil.ts","line":8,"symbol":"GetUnionLast","kind":"type","lang":"typescript","code":"type GetUnionLast<T> = UnionToIntersectionFn<T> extends () => infer Last ? Last : never;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/enumUtil.ts","line":10,"symbol":"UnionToTuple","kind":"type","lang":"typescript","code":"type UnionToTuple<T, Tuple extends unknown[] = []> = [T] extends [never]\n ? Tuple\n : UnionToTuple<Exclude<T, GetUnionLast<T>>, [GetUnionLast<T>, ...Tuple]>;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/enumUtil.ts","line":14,"symbol":"CastToStringTuple","kind":"type","lang":"typescript","code":"type CastToStringTuple<T> = T extends [string, ...string[]] ? T : never;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/enumUtil.ts","line":16,"symbol":"UnionToTupleString","kind":"type","lang":"typescript","code":"type UnionToTupleString<T> = CastToStringTuple<UnionToTuple<T>>;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/errorUtil.ts","line":2,"symbol":"ErrMessage","kind":"type","lang":"typescript","code":"type ErrMessage = string | { message?: string | undefined };"} {"repo":"zod","file":"packages/zod/src/v3/helpers/errorUtil.ts","line":3,"symbol":"errToObj","kind":"constant","lang":"typescript","code":"const errToObj = (message?: ErrMessage): { message?: string | undefined } =>\n typeof message === \"string\" ? { message } : message || {};"} {"repo":"zod","file":"packages/zod/src/v3/helpers/errorUtil.ts","line":6,"symbol":"toString","kind":"constant","lang":"typescript","doc":"biome-ignore lint/suspicious/noShadowRestrictedNames: renaming churns 31 v3 call sites","code":"const toString = (message?: ErrMessage): string | undefined =>\n typeof message === \"string\" ? message : message?.message;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":6,"symbol":"makeIssue","kind":"constant","lang":"typescript","code":"const makeIssue = (params: {\n data: any;\n path: (string | number)[];\n errorMaps: ZodErrorMap[];\n issueData: IssueData;\n}): ZodIssue => {\n const { data, path, errorMaps, issueData } = params;\n const fullPath = [...path, ...(issueData.path || [])];\n const fullIssue = {\n ...issueData,\n path: fullPath,\n };\n\n if (issueData.message !== undefined) {\n return {\n ...issueData,\n path: fullPath,\n message: issueData.message,\n };\n }\n\n let errorMessage = \"\";\n const maps = errorMaps\n .filter((m) => !!m)\n .slice()\n .reverse();\n for (const map of maps) {\n errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;\n }\n\n return {\n ...issueData,\n path: fullPath,\n message: errorMessage,\n };\n};"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":13,"symbol":"fullPath","kind":"constant","lang":"typescript","code":"const fullPath = [...path, ...(issueData.path || [])];"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":14,"symbol":"fullIssue","kind":"constant","lang":"typescript","code":"const fullIssue = {\n ...issueData,\n path: fullPath,\n };"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":28,"symbol":"maps","kind":"constant","lang":"typescript","code":"const maps = errorMaps\n .filter((m) => !!m)\n .slice()\n .reverse();"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":43,"symbol":"ParseParams","kind":"type","lang":"typescript","code":"type ParseParams = {\n path: (string | number)[];\n errorMap: ZodErrorMap;\n async: boolean;\n};"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":49,"symbol":"ParsePathComponent","kind":"type","lang":"typescript","code":"type ParsePathComponent = string | number;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":50,"symbol":"ParsePath","kind":"type","lang":"typescript","code":"type ParsePath = ParsePathComponent[];"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":51,"symbol":"EMPTY_PATH","kind":"constant","lang":"typescript","code":"const EMPTY_PATH: ParsePath = [];"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":53,"symbol":"ParseContext","kind":"interface","lang":"typescript","code":"interface ParseContext {\n readonly common: {\n readonly issues: ZodIssue[];\n readonly contextualErrorMap?: ZodErrorMap | undefined;\n readonly async: boolean;\n };\n readonly path: ParsePath;\n readonly schemaErrorMap?: ZodErrorMap | undefined;\n readonly parent: ParseContext | null;\n readonly data: any;\n readonly parsedType: ZodParsedType;\n}"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":66,"symbol":"ParseInput","kind":"type","lang":"typescript","code":"type ParseInput = {\n data: any;\n path: (string | number)[];\n parent: ParseContext;\n};"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":72,"symbol":"addIssueToContext","kind":"function","lang":"typescript","code":"function addIssueToContext(ctx: ParseContext, issueData: IssueData): void {\n const overrideMap = getErrorMap();\n const issue = makeIssue({\n issueData: issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap, // contextual error map is first priority\n ctx.schemaErrorMap, // then schema-bound map if available\n overrideMap, // then global override map\n overrideMap === defaultErrorMap ? undefined : defaultErrorMap, // then global default map\n ].filter((x) => !!x),\n });\n ctx.common.issues.push(issue);\n}"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":73,"symbol":"overrideMap","kind":"constant","lang":"typescript","code":"const overrideMap = getErrorMap();"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":74,"symbol":"issue","kind":"constant","lang":"typescript","code":"const issue = makeIssue({\n issueData: issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap, // contextual error map is first priority\n ctx.schemaErrorMap, // then schema-bound map if available\n overrideMap, // then global override map\n overrideMap === defaultErrorMap ? undefined : defaultErrorMap, // then global default map\n ].filter((x) => !!x),\n });"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":88,"symbol":"ObjectPair","kind":"type","lang":"typescript","code":"type ObjectPair = {\n key: SyncParseReturnType<any>;\n value: SyncParseReturnType<any>;\n};"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":92,"symbol":"ParseStatus","kind":"class","lang":"typescript","code":"class ParseStatus {\n value: \"aborted\" | \"dirty\" | \"valid\" = \"valid\";\n dirty(): void {\n if (this.value === \"valid\") this.value = \"dirty\";\n }\n abort(): void {\n if (this.value !== \"aborted\") this.value = \"aborted\";\n }\n\n static mergeArray(status: ParseStatus, results: SyncParseReturnType<any>[]): SyncParseReturnType {\n const arrayValue: any[] = [];\n for (const s of results) {\n if (s.status === \"aborted\") return INVALID;\n if (s.status === \"dirty\") status.dirty();\n arrayValue.push(s.value);\n }\n\n return { status: status.value, value: arrayValue };\n }\n\n static async mergeObjectAsync(\n status: ParseStatus,\n pairs: { key: ParseReturnType<any>; value: ParseReturnType<any> }[]\n ): Promise<SyncParseReturnType<any>> {\n const syncPairs: ObjectPair[] = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n });\n }\n return ParseStatus.mergeObjectSync(status, syncPairs);\n }\n\n static mergeObjectSync(\n status: ParseStatus,\n pairs: {\n key: SyncParseReturnType<any>;\n value: SyncParseReturnType<any>;\n alwaysSet?: boole"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":94,"symbol":"dirty","kind":"method","lang":"typescript","code":"dirty(): void {\n if (this.value === \"valid\") this.value = \"dirty\";\n }"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":97,"symbol":"abort","kind":"method","lang":"typescript","code":"abort(): void {\n if (this.value !== \"aborted\") this.value = \"aborted\";\n }"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":101,"symbol":"mergeArray","kind":"method","lang":"typescript","code":"static mergeArray(status: ParseStatus, results: SyncParseReturnType<any>[]): SyncParseReturnType {\n const arrayValue: any[] = [];\n for (const s of results) {\n if (s.status === \"aborted\") return INVALID;\n if (s.status === \"dirty\") status.dirty();\n arrayValue.push(s.value);\n }\n\n return { status: status.value, value: arrayValue };\n }"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":102,"symbol":"arrayValue","kind":"constant","lang":"typescript","code":"const arrayValue: any[] = [];"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":112,"symbol":"mergeObjectAsync","kind":"method","lang":"typescript","code":"static async mergeObjectAsync(\n status: ParseStatus,\n pairs: { key: ParseReturnType<any>; value: ParseReturnType<any> }[]\n ): Promise<SyncParseReturnType<any>> {\n const syncPairs: ObjectPair[] = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n });\n }\n return ParseStatus.mergeObjectSync(status, syncPairs);\n }"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":116,"symbol":"syncPairs","kind":"constant","lang":"typescript","code":"const syncPairs: ObjectPair[] = [];"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":118,"symbol":"key","kind":"constant","lang":"typescript","code":"const key = await pair.key;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":119,"symbol":"value","kind":"constant","lang":"typescript","code":"const value = await pair.value;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":128,"symbol":"mergeObjectSync","kind":"method","lang":"typescript","code":"static mergeObjectSync(\n status: ParseStatus,\n pairs: {\n key: SyncParseReturnType<any>;\n value: SyncParseReturnType<any>;\n alwaysSet?: boolean;\n }[]\n ): SyncParseReturnType {\n const finalObject: any = {};\n for (const pair of pairs) {\n const { key, value } = pair;\n if (key.status === \"aborted\") return INVALID;\n if (value.status === \"aborted\") return INVALID;\n if (key.status === \"dirty\") status.dirty();\n if (value.status === \"dirty\") status.dirty();\n\n if (key.value !== \"__proto__\" && (typeof value.value !== \"undefined\" || pair.alwaysSet)) {\n finalObject[key.value] = value.value;\n }\n }\n\n return { status: status.value, value: finalObject };\n }"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":136,"symbol":"finalObject","kind":"constant","lang":"typescript","code":"const finalObject: any = {};"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":152,"symbol":"ParseResult","kind":"interface","lang":"typescript","code":"interface ParseResult {\n status: \"aborted\" | \"dirty\" | \"valid\";\n data: any;\n}"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":157,"symbol":"INVALID","kind":"type","lang":"typescript","code":"type INVALID = { status: \"aborted\" };"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":158,"symbol":"INVALID","kind":"constant","lang":"typescript","code":"const INVALID: INVALID = Object.freeze({\n status: \"aborted\",\n});"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":162,"symbol":"DIRTY","kind":"type","lang":"typescript","code":"type DIRTY<T> = { status: \"dirty\"; value: T };"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":163,"symbol":"DIRTY","kind":"constant","lang":"typescript","code":"const DIRTY = <T>(value: T): DIRTY<T> => ({ status: \"dirty\", value });"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":165,"symbol":"OK","kind":"type","lang":"typescript","code":"type OK<T> = { status: \"valid\"; value: T };"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":166,"symbol":"OK","kind":"constant","lang":"typescript","code":"const OK = <T>(value: T): OK<T> => ({ status: \"valid\", value });"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":168,"symbol":"SyncParseReturnType","kind":"type","lang":"typescript","code":"type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":169,"symbol":"AsyncParseReturnType","kind":"type","lang":"typescript","code":"type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":170,"symbol":"ParseReturnType","kind":"type","lang":"typescript","code":"type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":172,"symbol":"isAborted","kind":"constant","lang":"typescript","code":"const isAborted = (x: ParseReturnType<any>): x is INVALID => (x as any).status === \"aborted\";"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":173,"symbol":"isDirty","kind":"constant","lang":"typescript","code":"const isDirty = <T>(x: ParseReturnType<T>): x is OK<T> | DIRTY<T> => (x as any).status === \"dirty\";"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":174,"symbol":"isValid","kind":"constant","lang":"typescript","code":"const isValid = <T>(x: ParseReturnType<T>): x is OK<T> => (x as any).status === \"valid\";"} {"repo":"zod","file":"packages/zod/src/v3/helpers/parseUtil.ts","line":175,"symbol":"isAsync","kind":"constant","lang":"typescript","code":"const isAsync = <T>(x: ParseReturnType<T>): x is AsyncParseReturnType<T> =>\n typeof Promise !== \"undefined\" && x instanceof Promise;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/partialUtil.ts","line":13,"symbol":"DeepPartial","kind":"type","lang":"typescript","code":"type DeepPartial<T extends ZodTypeAny> = T extends ZodObject<ZodRawShape>\n ? ZodObject<\n { [k in keyof T[\"shape\"]]: ZodOptional<DeepPartial<T[\"shape\"][k]>> },\n T[\"_def\"][\"unknownKeys\"],\n T[\"_def\"][\"catchall\"]\n >\n : T extends ZodArray<infer Type, infer Card>\n ? ZodArray<DeepPartial<Type>, Card>\n : T extends ZodOptional<infer Type>\n ? ZodOptional<DeepPartial<Type>>\n : T extends ZodNullable<infer Type>\n ? ZodNullable<DeepPartial<Type>>\n : T extends ZodTuple<infer Items>\n ? {\n [k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial<Items[k]> : never;\n } extends infer PI\n ? PI extends ZodTupleItems\n ? ZodTuple<PI>\n : never\n : never\n : T;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/typeAliases.ts","line":1,"symbol":"Primitive","kind":"type","lang":"typescript","code":"type Primitive = string | number | symbol | bigint | boolean | null | undefined;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/typeAliases.ts","line":2,"symbol":"Scalars","kind":"type","lang":"typescript","code":"type Scalars = Primitive | Primitive[];"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":2,"symbol":"AssertEqual","kind":"type","lang":"typescript","code":"type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? true : false;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":4,"symbol":"isAny","kind":"type","lang":"typescript","code":"type isAny<T> = 0 extends 1 & T ? true : false;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":5,"symbol":"assertEqual","kind":"constant","lang":"typescript","code":"const assertEqual = <A, B>(_: AssertEqual<A, B>): void => {};"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":6,"symbol":"assertIs","kind":"function","lang":"typescript","code":"function assertIs<T>(_arg: T): void {}"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":7,"symbol":"assertNever","kind":"function","lang":"typescript","code":"function assertNever(_x: never): never {\n throw new Error();\n }"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":11,"symbol":"Omit","kind":"type","lang":"typescript","code":"type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":12,"symbol":"OmitKeys","kind":"type","lang":"typescript","code":"type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":13,"symbol":"MakePartial","kind":"type","lang":"typescript","code":"type MakePartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":14,"symbol":"Exactly","kind":"type","lang":"typescript","code":"type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":15,"symbol":"InexactPartial","kind":"type","lang":"typescript","code":"type InexactPartial<T> = { [k in keyof T]?: T[k] | undefined };"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":16,"symbol":"arrayToEnum","kind":"constant","lang":"typescript","code":"const arrayToEnum = <T extends string, U extends [T, ...T[]]>(items: U): { [k in U[number]]: k } => {\n const obj: any = {};\n for (const item of items) {\n obj[item] = item;\n }\n return obj;\n };"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":17,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj: any = {};"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":24,"symbol":"getValidEnumValues","kind":"constant","lang":"typescript","code":"const getValidEnumValues = (obj: any): any[] => {\n const validKeys = objectKeys(obj).filter((k: any) => typeof obj[obj[k]] !== \"number\");\n const filtered: any = {};\n for (const k of validKeys) {\n filtered[k] = obj[k];\n }\n return objectValues(filtered);\n };"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":25,"symbol":"validKeys","kind":"constant","lang":"typescript","code":"const validKeys = objectKeys(obj).filter((k: any) => typeof obj[obj[k]] !== \"number\");"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":26,"symbol":"filtered","kind":"constant","lang":"typescript","code":"const filtered: any = {};"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":33,"symbol":"objectValues","kind":"constant","lang":"typescript","code":"const objectValues = (obj: any): any[] => {\n return objectKeys(obj).map(function (e) {\n return obj[e];\n });\n };"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":39,"symbol":"objectKeys","kind":"constant","lang":"typescript","code":"const objectKeys: ObjectConstructor[\"keys\"] =\n typeof Object.keys === \"function\" // eslint-disable-line ban/ban\n ? (obj: any) => Object.keys(obj) // eslint-disable-line ban/ban\n : (object: any) => {\n const keys = [];\n for (const key in object) {\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n keys.push(key);\n }\n }\n return keys;\n };"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":43,"symbol":"keys","kind":"constant","lang":"typescript","code":"const keys = [];"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":52,"symbol":"find","kind":"constant","lang":"typescript","code":"const find = <T>(arr: T[], checker: (arg: T) => any): T | undefined => {\n for (const item of arr) {\n if (checker(item)) return item;\n }\n return undefined;\n };"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":59,"symbol":"identity","kind":"type","lang":"typescript","code":"type identity<T> = objectUtil.identity<T>;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":60,"symbol":"flatten","kind":"type","lang":"typescript","code":"type flatten<T> = objectUtil.flatten<T>;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":62,"symbol":"noUndefined","kind":"type","lang":"typescript","code":"type noUndefined<T> = T extends undefined ? never : T;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":64,"symbol":"isInteger","kind":"constant","lang":"typescript","code":"const isInteger: NumberConstructor[\"isInteger\"] =\n typeof Number.isInteger === \"function\"\n ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban\n : (val) => typeof val === \"number\" && Number.isFinite(val) && Math.floor(val) === val;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":69,"symbol":"joinValues","kind":"function","lang":"typescript","code":"function joinValues<T extends any[]>(array: T, separator = \" | \"): string {\n return array.map((val) => (typeof val === \"string\" ? `'${val}'` : val)).join(separator);\n }"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":73,"symbol":"jsonStringifyReplacer","kind":"constant","lang":"typescript","code":"const jsonStringifyReplacer = (_: string, value: any): any => {\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n return value;\n };"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":82,"symbol":"MergeShapes","kind":"type","lang":"typescript","code":"type MergeShapes<U, V> =\n // fast path when there is no keys overlap\n keyof U & keyof V extends never\n ? U & V\n : {\n [k in Exclude<keyof U, keyof V>]: U[k];\n } & V;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":90,"symbol":"optionalKeys","kind":"type","lang":"typescript","code":"type optionalKeys<T extends object> = {\n [k in keyof T]: undefined extends T[k] ? k : never;\n }[keyof T];"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":93,"symbol":"requiredKeys","kind":"type","lang":"typescript","code":"type requiredKeys<T extends object> = {\n [k in keyof T]: undefined extends T[k] ? never : k;\n }[keyof T];"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":96,"symbol":"addQuestionMarks","kind":"type","lang":"typescript","code":"type addQuestionMarks<T extends object, _O = any> = {\n [K in requiredKeys<T>]: T[K];\n } & {\n [K in optionalKeys<T>]?: T[K];\n } & { [k in keyof T]?: unknown };"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":102,"symbol":"identity","kind":"type","lang":"typescript","code":"type identity<T> = T;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":103,"symbol":"flatten","kind":"type","lang":"typescript","code":"type flatten<T> = identity<{ [k in keyof T]: T[k] }>;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":105,"symbol":"noNeverKeys","kind":"type","lang":"typescript","code":"type noNeverKeys<T> = {\n [k in keyof T]: [T[k]] extends [never] ? never : k;\n }[keyof T];"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":109,"symbol":"noNever","kind":"type","lang":"typescript","code":"type noNever<T> = identity<{\n [k in noNeverKeys<T>]: k extends keyof T ? T[k] : never;\n }>;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":113,"symbol":"mergeShapes","kind":"constant","lang":"typescript","code":"const mergeShapes = <U, T>(first: U, second: T): T & U => {\n return {\n ...first,\n ...second, // second overwrites first\n };\n };"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":120,"symbol":"extendShape","kind":"type","lang":"typescript","code":"type extendShape<A extends object, B extends object> = keyof A & keyof B extends never // fast path when there is no keys overlap\n ? A & B\n : {\n [K in keyof A as K extends keyof B ? never : K]: A[K];\n } & {\n [K in keyof B]: B[K];\n };"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":129,"symbol":"ZodParsedType","kind":"constant","lang":"typescript","code":"const ZodParsedType: {\n string: \"string\";\n nan: \"nan\";\n number: \"number\";\n integer: \"integer\";\n float: \"float\";\n boolean: \"boolean\";\n date: \"date\";\n bigint: \"bigint\";\n symbol: \"symbol\";\n function: \"function\";\n undefined: \"undefined\";\n null: \"null\";\n array: \"array\";\n object: \"object\";\n unknown: \"unknown\";\n promise: \"promise\";\n void: \"void\";\n never: \"never\";\n map: \"map\";\n set: \"set\";\n} = util.arrayToEnum([\n \"string\",\n \"nan\",\n \"number\",\n \"integer\",\n \"float\",\n \"boolean\",\n \"date\",\n \"bigint\",\n \"symbol\",\n \"function\",\n \"undefined\",\n \"null\",\n \"array\",\n \"object\",\n \"unknown\",\n \"promise\",\n \"void\",\n \"never\",\n \"map\",\n \"set\",\n]);"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":173,"symbol":"ZodParsedType","kind":"type","lang":"typescript","code":"type ZodParsedType = keyof typeof ZodParsedType;"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":175,"symbol":"getParsedType","kind":"constant","lang":"typescript","code":"const getParsedType = (data: any): ZodParsedType => {\n const t = typeof data;\n\n switch (t) {\n case \"undefined\":\n return ZodParsedType.undefined;\n\n case \"string\":\n return ZodParsedType.string;\n\n case \"number\":\n return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;\n\n case \"boolean\":\n return ZodParsedType.boolean;\n\n case \"function\":\n return ZodParsedType.function;\n\n case \"bigint\":\n return ZodParsedType.bigint;\n\n case \"symbol\":\n return ZodParsedType.symbol;\n\n case \"object\":\n if (Array.isArray(data)) {\n return ZodParsedType.array;\n }\n if (data === null) {\n return ZodParsedType.null;\n }\n if (data.then && typeof data.then === \"function\" && data.catch && typeof data.catch === \"function\") {\n return ZodParsedType.promise;\n }\n if (typeof Map !== \"undefined\" && data instanceof Map) {\n return ZodParsedType.map;\n }\n if (typeof Set !== \"undefined\" && data instanceof Set) {\n return ZodParsedType.set;\n }\n if (typeof Date !== \"undefined\" && data instanceof Date) {\n return ZodParsedType.date;\n }\n return ZodParsedType.ob"} {"repo":"zod","file":"packages/zod/src/v3/helpers/util.ts","line":176,"symbol":"t","kind":"constant","lang":"typescript","code":"const t = typeof data;"} {"repo":"zod","file":"packages/zod/src/v3/locales/en.ts","line":4,"symbol":"errorMap","kind":"constant","lang":"typescript","code":"const errorMap: ZodErrorMap = (issue, _ctx) => {\n let message: string;\n switch (issue.code) {\n case ZodIssueCode.invalid_type:\n if (issue.received === ZodParsedType.undefined) {\n message = \"Required\";\n } else {\n message = `Expected ${issue.expected}, received ${issue.received}`;\n }\n break;\n case ZodIssueCode.invalid_literal:\n message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;\n break;\n case ZodIssueCode.unrecognized_keys:\n message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, \", \")}`;\n break;\n case ZodIssueCode.invalid_union:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_union_discriminator:\n message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;\n break;\n case ZodIssueCode.invalid_enum_value:\n message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;\n break;\n case ZodIssueCode.invalid_arguments:\n message = `Invalid function arguments`;\n break;\n case ZodIssueCode.invalid_return_type:\n message = "} {"repo":"zod","file":"packages/zod/src/v3/standard-schema.ts","line":4,"symbol":"StandardSchemaV1","kind":"type","lang":"typescript","doc":"The Standard Schema interface.","code":"type StandardSchemaV1<Input = unknown, Output = Input> = {\n /**\n * The Standard Schema properties.\n */\n readonly \"~standard\": StandardSchemaV1.Props<Input, Output>;\n};"} {"repo":"zod","file":"packages/zod/src/v3/standard-schema.ts","line":15,"symbol":"Props","kind":"interface","lang":"typescript","doc":"The Standard Schema properties interface.","code":"interface Props<Input = unknown, Output = Input> {\n /**\n * The version number of the standard.\n */\n readonly version: 1;\n /**\n * The vendor name of the schema library.\n */\n readonly vendor: string;\n /**\n * Validates unknown input values.\n */\n readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;\n /**\n * Inferred types associated with the schema.\n */\n readonly types?: Types<Input, Output> | undefined;\n }"} {"repo":"zod","file":"packages/zod/src/v3/standard-schema.ts","line":37,"symbol":"Result","kind":"type","lang":"typescript","doc":"The result interface of the validate function.","code":"type Result<Output> = SuccessResult<Output> | FailureResult;"} {"repo":"zod","file":"packages/zod/src/v3/standard-schema.ts","line":42,"symbol":"SuccessResult","kind":"interface","lang":"typescript","doc":"The result interface if validation succeeds.","code":"interface SuccessResult<Output> {\n /**\n * The typed output value.\n */\n readonly value: Output;\n /**\n * The non-existent issues.\n */\n readonly issues?: undefined;\n }"} {"repo":"zod","file":"packages/zod/src/v3/standard-schema.ts","line":56,"symbol":"FailureResult","kind":"interface","lang":"typescript","doc":"The result interface if validation fails.","code":"interface FailureResult {\n /**\n * The issues of failed validation.\n */\n readonly issues: ReadonlyArray<Issue>;\n }"} {"repo":"zod","file":"packages/zod/src/v3/standard-schema.ts","line":66,"symbol":"Issue","kind":"interface","lang":"typescript","doc":"The issue interface of the failure output.","code":"interface Issue {\n /**\n * The error message of the issue.\n */\n readonly message: string;\n /**\n * The path of the issue, if any.\n */\n readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;\n }"} {"repo":"zod","file":"packages/zod/src/v3/standard-schema.ts","line":80,"symbol":"PathSegment","kind":"interface","lang":"typescript","doc":"The path segment interface of the issue.","code":"interface PathSegment {\n /**\n * The key representing a path segment.\n */\n readonly key: PropertyKey;\n }"} {"repo":"zod","file":"packages/zod/src/v3/standard-schema.ts","line":90,"symbol":"Types","kind":"interface","lang":"typescript","doc":"The Standard Schema types interface.","code":"interface Types<Input = unknown, Output = Input> {\n /**\n * The input type of the schema.\n */\n readonly input: Input;\n /**\n * The output type of the schema.\n */\n readonly output: Output;\n }"} {"repo":"zod","file":"packages/zod/src/v3/standard-schema.ts","line":104,"symbol":"InferInput","kind":"type","lang":"typescript","doc":"Infers the input type of a Standard Schema.","code":"type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema[\"~standard\"][\"types\"]>[\"input\"];"} {"repo":"zod","file":"packages/zod/src/v3/standard-schema.ts","line":109,"symbol":"InferOutput","kind":"type","lang":"typescript","doc":"Infers the output type of a Standard Schema.","code":"type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema[\"~standard\"][\"types\"]>[\"output\"];"} {"repo":"zod","file":"packages/zod/src/v3/tests/Mocker.ts","line":1,"symbol":"getRandomInt","kind":"function","lang":"typescript","code":"function getRandomInt(max: number) {\n return Math.floor(Math.random() * Math.floor(max));\n}"} {"repo":"zod","file":"packages/zod/src/v3/tests/Mocker.ts","line":5,"symbol":"testSymbol","kind":"constant","lang":"typescript","code":"const testSymbol = Symbol(\"test\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/Mocker.ts","line":7,"symbol":"Mocker","kind":"class","lang":"typescript","code":"class Mocker {\n pick = (...args: any[]): any => {\n return args[getRandomInt(args.length)];\n };\n\n get string(): string {\n return Math.random().toString(36).substring(7);\n }\n get number(): number {\n return Math.random() * 100;\n }\n get bigint(): bigint {\n return BigInt(Math.floor(Math.random() * 10000));\n }\n get boolean(): boolean {\n return Math.random() < 0.5;\n }\n get date(): Date {\n return new Date(Math.floor(Date.now() * Math.random()));\n }\n get symbol(): symbol {\n return testSymbol;\n }\n get null(): null {\n return null;\n }\n get undefined(): undefined {\n return undefined;\n }\n get stringOptional(): string | undefined {\n return this.pick(this.string, this.undefined);\n }\n get stringNullable(): string | null {\n return this.pick(this.string, this.null);\n }\n get numberOptional(): number | undefined {\n return this.pick(this.number, this.undefined);\n }\n get numberNullable(): number | null {\n return this.pick(this.number, this.null);\n }\n get booleanOptional(): boolean | undefined {\n return this.pick(this.boolean, this.undefined);\n }\n get booleanNullable(): boolean | null {\n return this.pick(this.boolean, this.null);\n "} {"repo":"zod","file":"packages/zod/src/v3/tests/Mocker.ts","line":12,"symbol":"string","kind":"method","lang":"typescript","code":"get string(): string {\n return Math.random().toString(36).substring(7);\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/Mocker.ts","line":15,"symbol":"number","kind":"method","lang":"typescript","code":"get number(): number {\n return Math.random() * 100;\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/Mocker.ts","line":18,"symbol":"bigint","kind":"method","lang":"typescript","code":"get bigint(): bigint {\n return BigInt(Math.floor(Math.random() * 10000));\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/Mocker.ts","line":21,"symbol":"boolean","kind":"method","lang":"typescript","code":"get boolean(): boolean {\n return Math.random() < 0.5;\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/Mocker.ts","line":24,"symbol":"date","kind":"method","lang":"typescript","code":"get date(): Date {\n return new Date(Math.floor(Date.now() * Math.random()));\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/Mocker.ts","line":27,"symbol":"symbol","kind":"method","lang":"typescript","code":"get symbol(): symbol {\n return testSymbol;\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/Mocker.ts","line":30,"symbol":"null","kind":"method","lang":"typescript","code":"get null(): null {\n return null;\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/Mocker.ts","line":33,"symbol":"undefined","kind":"method","lang":"typescript","code":"get undefined(): undefined {\n return undefined;\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/Mocker.ts","line":36,"symbol":"stringOptional","kind":"method","lang":"typescript","code":"get stringOptional(): string | undefined {\n return this.pick(this.string, this.undefined);\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/Mocker.ts","line":39,"symbol":"stringNullable","kind":"method","lang":"typescript","code":"get stringNullable(): string | null {\n return this.pick(this.string, this.null);\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/Mocker.ts","line":42,"symbol":"numberOptional","kind":"method","lang":"typescript","code":"get numberOptional(): number | undefined {\n return this.pick(this.number, this.undefined);\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/Mocker.ts","line":45,"symbol":"numberNullable","kind":"method","lang":"typescript","code":"get numberNullable(): number | null {\n return this.pick(this.number, this.null);\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/Mocker.ts","line":48,"symbol":"booleanOptional","kind":"method","lang":"typescript","code":"get booleanOptional(): boolean | undefined {\n return this.pick(this.boolean, this.undefined);\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/Mocker.ts","line":51,"symbol":"booleanNullable","kind":"method","lang":"typescript","code":"get booleanNullable(): boolean | null {\n return this.pick(this.boolean, this.null);\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/all-errors.test.ts","line":7,"symbol":"Test","kind":"constant","lang":"typescript","code":"const Test = z.object({\n f1: z.number(),\n f2: z.string().optional(),\n f3: z.string().nullable(),\n f4: z.array(z.object({ t: z.union([z.string(), z.boolean()]) })),\n});"} {"repo":"zod","file":"packages/zod/src/v3/tests/all-errors.test.ts","line":13,"symbol":"TestFlattenedErrors","kind":"type","lang":"typescript","code":"type TestFlattenedErrors = z.inferFlattenedErrors<typeof Test, { message: string; code: number }>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/all-errors.test.ts","line":14,"symbol":"TestFormErrors","kind":"type","lang":"typescript","code":"type TestFormErrors = z.inferFlattenedErrors<typeof Test>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/all-errors.test.ts","line":17,"symbol":"TestTypeErrors","kind":"type","lang":"typescript","code":"type TestTypeErrors = {\n formErrors: string[];\n fieldErrors: { [P in keyof z.TypeOf<typeof Test>]?: string[] };\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/all-errors.test.ts","line":27,"symbol":"ErrorType","kind":"type","lang":"typescript","code":"type ErrorType = { message: string; code: number };"} {"repo":"zod","file":"packages/zod/src/v3/tests/all-errors.test.ts","line":28,"symbol":"TestTypeErrors","kind":"type","lang":"typescript","code":"type TestTypeErrors = {\n formErrors: ErrorType[];\n fieldErrors: {\n [P in keyof z.TypeOf<typeof Test>]?: ErrorType[];\n };\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/all-errors.test.ts","line":41,"symbol":"TestTypeErrors","kind":"type","lang":"typescript","code":"type TestTypeErrors = {\n formErrors: string[];\n fieldErrors: { [P in keyof z.TypeOf<typeof Test>]?: string[] };\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/all-errors.test.ts","line":50,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = Test.safeParse({}) as z.SafeParseError<void>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/all-errors.test.ts","line":51,"symbol":"validFlattenedErrors","kind":"constant","lang":"typescript","code":"const validFlattenedErrors: TestFlattenedErrors = parsed.error.flatten(() => ({ message: \"\", code: 0 }));"} {"repo":"zod","file":"packages/zod/src/v3/tests/all-errors.test.ts","line":53,"symbol":"invalidFlattenedErrors","kind":"constant","lang":"typescript","doc":"@ts-expect-error should fail assertion between `TestFlattenedErrors` and unmapped `flatten()`.","code":"const invalidFlattenedErrors: TestFlattenedErrors = parsed.error.flatten();"} {"repo":"zod","file":"packages/zod/src/v3/tests/all-errors.test.ts","line":54,"symbol":"validFormErrors","kind":"constant","lang":"typescript","code":"const validFormErrors: TestFormErrors = parsed.error.flatten();"} {"repo":"zod","file":"packages/zod/src/v3/tests/all-errors.test.ts","line":56,"symbol":"invalidFormErrors","kind":"constant","lang":"typescript","doc":"@ts-expect-error should fail assertion between `TestFormErrors` and mapped `flatten()`.","code":"const invalidFormErrors: TestFormErrors = parsed.error.flatten(() => ({\n message: \"string\",\n code: 0,\n }));"} {"repo":"zod","file":"packages/zod/src/v3/tests/all-errors.test.ts","line":65,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = Test.safeParse({}) as z.SafeParseError<void>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/all-errors.test.ts","line":66,"symbol":"validFormErrors","kind":"constant","lang":"typescript","code":"const validFormErrors: TestFormErrors = parsed.error.formErrors;"} {"repo":"zod","file":"packages/zod/src/v3/tests/all-errors.test.ts","line":68,"symbol":"invalidFlattenedErrors","kind":"constant","lang":"typescript","doc":"@ts-expect-error should fail assertion between `TestFlattenedErrors` and `.formErrors`.","code":"const invalidFlattenedErrors: TestFlattenedErrors = parsed.error.formErrors;"} {"repo":"zod","file":"packages/zod/src/v3/tests/all-errors.test.ts","line":74,"symbol":"propertySchema","kind":"constant","lang":"typescript","code":"const propertySchema = z.string();"} {"repo":"zod","file":"packages/zod/src/v3/tests/all-errors.test.ts","line":75,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n a: propertySchema,\n b: propertySchema,\n })\n .refine(\n (val) => {\n return val.a === val.b;\n },\n { message: \"Must be equal\" }\n );"} {"repo":"zod","file":"packages/zod/src/v3/tests/all-errors.test.ts","line":107,"symbol":"error","kind":"constant","lang":"typescript","code":"const error = _error as z.ZodError;"} {"repo":"zod","file":"packages/zod/src/v3/tests/anyunknown.test.ts","line":8,"symbol":"t1","kind":"constant","lang":"typescript","code":"const t1 = z.any();"} {"repo":"zod","file":"packages/zod/src/v3/tests/anyunknown.test.ts","line":11,"symbol":"t1","kind":"type","lang":"typescript","code":"type t1 = z.infer<typeof t1>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/anyunknown.test.ts","line":16,"symbol":"t1","kind":"constant","lang":"typescript","code":"const t1 = z.unknown();"} {"repo":"zod","file":"packages/zod/src/v3/tests/anyunknown.test.ts","line":19,"symbol":"t1","kind":"type","lang":"typescript","code":"type t1 = z.infer<typeof t1>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/anyunknown.test.ts","line":24,"symbol":"t1","kind":"constant","lang":"typescript","code":"const t1 = z.never();"} {"repo":"zod","file":"packages/zod/src/v3/tests/array.test.ts","line":7,"symbol":"minTwo","kind":"constant","lang":"typescript","code":"const minTwo = z.string().array().min(2);"} {"repo":"zod","file":"packages/zod/src/v3/tests/array.test.ts","line":8,"symbol":"maxTwo","kind":"constant","lang":"typescript","code":"const maxTwo = z.string().array().max(2);"} {"repo":"zod","file":"packages/zod/src/v3/tests/array.test.ts","line":9,"symbol":"justTwo","kind":"constant","lang":"typescript","code":"const justTwo = z.string().array().length(2);"} {"repo":"zod","file":"packages/zod/src/v3/tests/array.test.ts","line":10,"symbol":"intNum","kind":"constant","lang":"typescript","code":"const intNum = z.string().array().nonempty();"} {"repo":"zod","file":"packages/zod/src/v3/tests/array.test.ts","line":11,"symbol":"nonEmptyMax","kind":"constant","lang":"typescript","code":"const nonEmptyMax = z.string().array().nonempty().max(2);"} {"repo":"zod","file":"packages/zod/src/v3/tests/array.test.ts","line":13,"symbol":"t1","kind":"type","lang":"typescript","code":"type t1 = z.infer<typeof nonEmptyMax>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/array.test.ts","line":16,"symbol":"t2","kind":"type","lang":"typescript","code":"type t2 = z.infer<typeof minTwo>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/array.test.ts","line":54,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n people: z.string().array().min(2),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/array.test.ts","line":58,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({\n people: [123],\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/array.test.ts","line":68,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.array(z.string()).nonempty().min(1).max(3);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":7,"symbol":"stringSchema","kind":"constant","lang":"typescript","doc":"string","code":"const stringSchema = z.string();"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":10,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = \"XXX\";"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":11,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = 12;"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":13,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await stringSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":17,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await stringSchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":23,"symbol":"numberSchema","kind":"constant","lang":"typescript","doc":"number","code":"const numberSchema = z.number();"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":25,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = 1234.2353;"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":26,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = \"1234\";"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":28,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await numberSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":32,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await numberSchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":38,"symbol":"bigIntSchema","kind":"constant","lang":"typescript","doc":"bigInt","code":"const bigIntSchema = z.bigint();"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":40,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = BigInt(145);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":41,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = 134;"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":43,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await bigIntSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":47,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await bigIntSchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":53,"symbol":"booleanSchema","kind":"constant","lang":"typescript","doc":"boolean","code":"const booleanSchema = z.boolean();"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":55,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = true;"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":56,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = 1;"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":58,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await booleanSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":62,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await booleanSchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":68,"symbol":"dateSchema","kind":"constant","lang":"typescript","doc":"date","code":"const dateSchema = z.date();"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":70,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = new Date();"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":71,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = new Date().toISOString();"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":73,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await dateSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":77,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await dateSchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":83,"symbol":"undefinedSchema","kind":"constant","lang":"typescript","doc":"undefined","code":"const undefinedSchema = z.undefined();"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":85,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = undefined;"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":86,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = \"XXX\";"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":88,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await undefinedSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":92,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await undefinedSchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":98,"symbol":"nullSchema","kind":"constant","lang":"typescript","doc":"null","code":"const nullSchema = z.null();"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":100,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = null;"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":101,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = undefined;"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":103,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await nullSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":107,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await nullSchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":113,"symbol":"anySchema","kind":"constant","lang":"typescript","doc":"any","code":"const anySchema = z.any();"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":115,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = [{}];"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":118,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await anySchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":128,"symbol":"unknownSchema","kind":"constant","lang":"typescript","doc":"unknown","code":"const unknownSchema = z.unknown();"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":130,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = [\"asdf\", 124, () => {}];"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":133,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await unknownSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":143,"symbol":"voidSchema","kind":"constant","lang":"typescript","doc":"void","code":"const voidSchema = z.void();"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":145,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = undefined;"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":146,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = 0;"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":148,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await voidSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":152,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await voidSchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":158,"symbol":"arraySchema","kind":"constant","lang":"typescript","doc":"array","code":"const arraySchema = z.array(z.string());"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":160,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = [\"XXX\"];"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":161,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = \"XXX\";"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":163,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await arraySchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":167,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await arraySchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":173,"symbol":"objectSchema","kind":"constant","lang":"typescript","doc":"object","code":"const objectSchema = z.object({ string: z.string() });"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":175,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = { string: \"XXX\" };"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":176,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = { string: 12 };"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":178,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await objectSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":182,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await objectSchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":188,"symbol":"unionSchema","kind":"constant","lang":"typescript","doc":"union","code":"const unionSchema = z.union([z.string(), z.undefined()]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":190,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = undefined;"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":191,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = null;"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-parsing.test.ts","line":193,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await unionSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-refinements.test.ts","line":7,"symbol":"schema1","kind":"constant","lang":"typescript","code":"const schema1 = z.string().refine(async (_val) => false);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-refinements.test.ts","line":10,"symbol":"schema2","kind":"constant","lang":"typescript","code":"const schema2 = z.string().refine((_val) => Promise.resolve(true));"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-refinements.test.ts","line":15,"symbol":"schema1","kind":"constant","lang":"typescript","code":"const schema1 = z.string().refine(async (_val) => true);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-refinements.test.ts","line":18,"symbol":"schema2","kind":"constant","lang":"typescript","code":"const schema2 = z.string().refine(async (_val) => false);"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-refinements.test.ts","line":26,"symbol":"schema1","kind":"constant","lang":"typescript","code":"const schema1 = z.string().refine((_val) => Promise.resolve(true));"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-refinements.test.ts","line":27,"symbol":"v1","kind":"constant","lang":"typescript","code":"const v1 = await schema1.parseAsync(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-refinements.test.ts","line":30,"symbol":"schema2","kind":"constant","lang":"typescript","code":"const schema2 = z.string().refine((_val) => Promise.resolve(false));"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-refinements.test.ts","line":33,"symbol":"schema3","kind":"constant","lang":"typescript","code":"const schema3 = z.string().refine((_val) => Promise.resolve(true));"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-refinements.test.ts","line":39,"symbol":"schema1","kind":"constant","lang":"typescript","code":"const schema1 = z.string().refine(async (val) => {\n return val.length > 5;\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/async-refinements.test.ts","line":44,"symbol":"v","kind":"constant","lang":"typescript","code":"const v = await schema1.parseAsync(\"asdf123\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/base.test.ts","line":8,"symbol":"stringToNumber","kind":"constant","lang":"typescript","code":"const stringToNumber = z.string().transform((arg) => arg.length);"} {"repo":"zod","file":"packages/zod/src/v3/tests/base.test.ts","line":10,"symbol":"s1","kind":"constant","lang":"typescript","code":"const s1 = z.object({\n stringToNumber,\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/base.test.ts","line":13,"symbol":"t1","kind":"type","lang":"typescript","code":"type t1 = z.input<typeof s1>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/base.test.ts","line":15,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = { stringToNumber: \"asdf\" };"} {"repo":"zod","file":"packages/zod/src/v3/tests/base.test.ts","line":16,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = s1.safeParse(data);"} {"repo":"zod","file":"packages/zod/src/v3/tests/base.test.ts","line":23,"symbol":"callback","kind":"constant","lang":"typescript","code":"const callback = (predicate: (val: string) => boolean) => {\n return predicate(\"hello\");\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/bigint.test.ts","line":6,"symbol":"gtFive","kind":"constant","lang":"typescript","code":"const gtFive = z.bigint().gt(BigInt(5));"} {"repo":"zod","file":"packages/zod/src/v3/tests/bigint.test.ts","line":7,"symbol":"gteFive","kind":"constant","lang":"typescript","code":"const gteFive = z.bigint().gte(BigInt(5));"} {"repo":"zod","file":"packages/zod/src/v3/tests/bigint.test.ts","line":8,"symbol":"ltFive","kind":"constant","lang":"typescript","code":"const ltFive = z.bigint().lt(BigInt(5));"} {"repo":"zod","file":"packages/zod/src/v3/tests/bigint.test.ts","line":9,"symbol":"lteFive","kind":"constant","lang":"typescript","code":"const lteFive = z.bigint().lte(BigInt(5));"} {"repo":"zod","file":"packages/zod/src/v3/tests/bigint.test.ts","line":10,"symbol":"positive","kind":"constant","lang":"typescript","code":"const positive = z.bigint().positive();"} {"repo":"zod","file":"packages/zod/src/v3/tests/bigint.test.ts","line":11,"symbol":"negative","kind":"constant","lang":"typescript","code":"const negative = z.bigint().negative();"} {"repo":"zod","file":"packages/zod/src/v3/tests/bigint.test.ts","line":12,"symbol":"nonnegative","kind":"constant","lang":"typescript","code":"const nonnegative = z.bigint().nonnegative();"} {"repo":"zod","file":"packages/zod/src/v3/tests/bigint.test.ts","line":13,"symbol":"nonpositive","kind":"constant","lang":"typescript","code":"const nonpositive = z.bigint().nonpositive();"} {"repo":"zod","file":"packages/zod/src/v3/tests/bigint.test.ts","line":14,"symbol":"multipleOfFive","kind":"constant","lang":"typescript","code":"const multipleOfFive = z.bigint().multipleOf(BigInt(5));"} {"repo":"zod","file":"packages/zod/src/v3/tests/branded.test.ts","line":8,"symbol":"mySchema","kind":"constant","lang":"typescript","code":"const mySchema = z\n .object({\n name: z.string(),\n })\n .brand<\"superschema\">();"} {"repo":"zod","file":"packages/zod/src/v3/tests/branded.test.ts","line":15,"symbol":"MySchema","kind":"type","lang":"typescript","doc":"simple branding","code":"type MySchema = z.infer<typeof mySchema>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/branded.test.ts","line":18,"symbol":"doStuff","kind":"constant","lang":"typescript","code":"const doStuff = (arg: MySchema) => arg;"} {"repo":"zod","file":"packages/zod/src/v3/tests/branded.test.ts","line":22,"symbol":"extendedSchema","kind":"constant","lang":"typescript","doc":"inheritance","code":"const extendedSchema = mySchema.brand<\"subschema\">();"} {"repo":"zod","file":"packages/zod/src/v3/tests/branded.test.ts","line":23,"symbol":"ExtendedSchema","kind":"type","lang":"typescript","code":"type ExtendedSchema = z.infer<typeof extendedSchema>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/branded.test.ts","line":29,"symbol":"numberSchema","kind":"constant","lang":"typescript","doc":"number branding","code":"const numberSchema = z.number().brand<42>();"} {"repo":"zod","file":"packages/zod/src/v3/tests/branded.test.ts","line":30,"symbol":"NumberSchema","kind":"type","lang":"typescript","code":"type NumberSchema = z.infer<typeof numberSchema>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/branded.test.ts","line":34,"symbol":"MyBrand","kind":"constant","lang":"typescript","doc":"symbol branding","code":"const MyBrand: unique symbol = Symbol(\"hello\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/branded.test.ts","line":35,"symbol":"MyBrand","kind":"type","lang":"typescript","code":"type MyBrand = typeof MyBrand;"} {"repo":"zod","file":"packages/zod/src/v3/tests/branded.test.ts","line":36,"symbol":"symbolBrand","kind":"constant","lang":"typescript","code":"const symbolBrand = z.number().brand<\"sup\">().brand<typeof MyBrand>();"} {"repo":"zod","file":"packages/zod/src/v3/tests/branded.test.ts","line":37,"symbol":"SymbolBrand","kind":"type","lang":"typescript","code":"type SymbolBrand = z.infer<typeof symbolBrand>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/branded.test.ts","line":42,"symbol":"age","kind":"constant","lang":"typescript","doc":"keeping brands out of input types","code":"const age = z.number().brand<\"age\">();"} {"repo":"zod","file":"packages/zod/src/v3/tests/branded.test.ts","line":44,"symbol":"Age","kind":"type","lang":"typescript","code":"type Age = z.infer<typeof age>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/branded.test.ts","line":45,"symbol":"AgeInput","kind":"type","lang":"typescript","code":"type AgeInput = z.input<typeof age>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":13,"symbol":"cb","kind":"constant","lang":"typescript","code":"const cb = () => {\n isCalled = true;\n return \"asdf\";\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":22,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await z.string().catch(\"default\").parseAsync(1243);"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":37,"symbol":"stringWithDefault","kind":"constant","lang":"typescript","code":"const stringWithDefault = z\n .string()\n .transform((val) => val.toUpperCase())\n .catch(\"default\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":47,"symbol":"inp","kind":"type","lang":"typescript","code":"type inp = z.input<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":49,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":54,"symbol":"stringWithDefault","kind":"constant","lang":"typescript","code":"const stringWithDefault = z.string().optional().catch(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":61,"symbol":"inp","kind":"type","lang":"typescript","code":"type inp = z.input<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":63,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":68,"symbol":"stringWithDefault","kind":"constant","lang":"typescript","code":"const stringWithDefault = z.string().catch(\"asdf\").optional();"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":70,"symbol":"inp","kind":"type","lang":"typescript","code":"type inp = z.input<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":72,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":77,"symbol":"complex","kind":"constant","lang":"typescript","code":"const complex = z\n .string()\n .catch(\"asdf\")\n .transform((val) => val + \"!\")\n .transform((val) => val.toUpperCase())\n .catch(\"qwer\")\n .removeCatch()\n .optional()\n .catch(\"asdfasdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":93,"symbol":"stringWithRemovedDefault","kind":"constant","lang":"typescript","code":"const stringWithRemovedDefault = z.string().catch(\"asdf\").removeCatch();"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":95,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof stringWithRemovedDefault>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":100,"symbol":"inner","kind":"constant","lang":"typescript","code":"const inner = z.string().catch(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":101,"symbol":"outer","kind":"constant","lang":"typescript","code":"const outer = z.object({ inner }).catch({\n inner: \"asdf\",\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":104,"symbol":"input","kind":"type","lang":"typescript","code":"type input = z.input<typeof outer>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":106,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof outer>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":114,"symbol":"stringWithDefault","kind":"constant","lang":"typescript","code":"const stringWithDefault = z.string().catch(\"inner\").catch(\"outer\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":115,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringWithDefault.parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":117,"symbol":"resultDiff","kind":"constant","lang":"typescript","code":"const resultDiff = stringWithDefault.parse(5);"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":128,"symbol":"Fruits","kind":"type","lang":"typescript","code":"enum Fruits {\n apple = \"apple\",\n orange = \"orange\",\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":133,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n fruit: z.nativeEnum(Fruits).catch(Fruits.apple),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":142,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n fruit: z.enum([\"apple\", \"orange\"]).catch(\"apple\"),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":152,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n string: z.string(),\n obj: z.object({\n sub: z.object({\n lit: z.literal(\"a\"),\n subCatch: z.number().catch(23),\n }),\n midCatch: z.number().catch(42),\n }),\n number: z.number().catch(0),\n bool: z.boolean(),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":179,"symbol":"issues","kind":"constant","lang":"typescript","code":"const issues = (error as z.ZodError).issues;"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":191,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n age: z.number(),\n name: z.string().catch((ctx) => {\n catchError = ctx.error;\n\n return \"John Doe\";\n }),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":200,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({\n age: null,\n name: null,\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/catch.test.ts","line":215,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().catch((ctx) => {\n return String(ctx.input);\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/coerce.test.ts","line":7,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.coerce.string();"} {"repo":"zod","file":"packages/zod/src/v3/tests/coerce.test.ts","line":29,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.coerce.number();"} {"repo":"zod","file":"packages/zod/src/v3/tests/coerce.test.ts","line":55,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.coerce.boolean();"} {"repo":"zod","file":"packages/zod/src/v3/tests/coerce.test.ts","line":80,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.coerce.bigint();"} {"repo":"zod","file":"packages/zod/src/v3/tests/coerce.test.ts","line":106,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.coerce.date();"} {"repo":"zod","file":"packages/zod/src/v3/tests/complex.test.ts","line":4,"symbol":"crazySchema","kind":"constant","lang":"typescript","code":"const crazySchema = z.object({\n tuple: z.tuple([\n z.string().nullable().optional(),\n z.number().nullable().optional(),\n z.boolean().nullable().optional(),\n z.null().nullable().optional(),\n z.undefined().nullable().optional(),\n z.literal(\"1234\").nullable().optional(),\n ]),\n merged: z\n .object({\n k1: z.string().optional(),\n })\n .merge(z.object({ k1: z.string().nullable(), k2: z.number() })),\n union: z.array(z.union([z.literal(\"asdf\"), z.literal(12)])).nonempty(),\n array: z.array(z.number()),\n // sumTransformer: z.transformer(z.array(z.number()), z.number(), (arg) => {\n // return arg.reduce((a, b) => a + b, 0);\n // }),\n sumMinLength: z.array(z.number()).refine((arg) => arg.length > 5),\n intersection: z.intersection(z.object({ p1: z.string().optional() }), z.object({ p1: z.number().optional() })),\n enum: z.intersection(z.enum([\"zero\", \"one\"]), z.enum([\"one\", \"two\"])),\n nonstrict: z.object({ points: z.number() }).nonstrict(),\n numProm: z.promise(z.number()),\n lenfun: z.function(z.tuple([z.string()]), z.boolean()),\n});"} {"repo":"zod","file":"packages/zod/src/v3/tests/complex.test.ts","line":43,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = {\n tuple: [\"asdf\", 1234, true, null, undefined, \"1234\"],\n merged: { k1: \"asdf\", k2: 12 },\n union: [\"asdf\", 12, \"asdf\", 12, \"asdf\", 12],\n array: [12, 15, 16],\n // sumTransformer: [12, 15, 16],\n sumMinLength: [12, 15, 16, 98, 24, 63],\n intersection: {},\n enum: \"one\",\n nonstrict: { points: 1234 },\n numProm: Promise.resolve(12),\n lenfun: (x: string) => x.length,\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/complex.test.ts","line":57,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = crazySchema.parse(input);"} {"repo":"zod","file":"packages/zod/src/v3/tests/custom.test.ts","line":7,"symbol":"example1","kind":"constant","lang":"typescript","code":"const example1 = z.custom<number>((x) => typeof x === \"number\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/custom.test.ts","line":13,"symbol":"example1","kind":"constant","lang":"typescript","code":"const example1 = z.custom<number>((x) => typeof x !== \"number\", \"customerr\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/custom.test.ts","line":14,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = example1.safeParse(1234);"} {"repo":"zod","file":"packages/zod/src/v3/tests/custom.test.ts","line":21,"symbol":"example1","kind":"constant","lang":"typescript","code":"const example1 = z.custom<number>(async (x) => {\n return typeof x === \"number\";\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/custom.test.ts","line":24,"symbol":"r1","kind":"constant","lang":"typescript","code":"const r1 = await example1.safeParseAsync(1234);"} {"repo":"zod","file":"packages/zod/src/v3/tests/custom.test.ts","line":28,"symbol":"r2","kind":"constant","lang":"typescript","code":"const r2 = await example1.safeParseAsync(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/date.test.ts","line":6,"symbol":"beforeBenchmarkDate","kind":"constant","lang":"typescript","code":"const beforeBenchmarkDate = new Date(2022, 10, 4);"} {"repo":"zod","file":"packages/zod/src/v3/tests/date.test.ts","line":7,"symbol":"benchmarkDate","kind":"constant","lang":"typescript","code":"const benchmarkDate = new Date(2022, 10, 5);"} {"repo":"zod","file":"packages/zod/src/v3/tests/date.test.ts","line":8,"symbol":"afterBenchmarkDate","kind":"constant","lang":"typescript","code":"const afterBenchmarkDate = new Date(2022, 10, 6);"} {"repo":"zod","file":"packages/zod/src/v3/tests/date.test.ts","line":10,"symbol":"minCheck","kind":"constant","lang":"typescript","code":"const minCheck = z.date().min(benchmarkDate);"} {"repo":"zod","file":"packages/zod/src/v3/tests/date.test.ts","line":11,"symbol":"maxCheck","kind":"constant","lang":"typescript","code":"const maxCheck = z.date().max(benchmarkDate);"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":12,"symbol":"stringWithDefault","kind":"constant","lang":"typescript","code":"const stringWithDefault = z\n .string()\n .transform((val) => val.toUpperCase())\n .default(\"default\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":21,"symbol":"inp","kind":"type","lang":"typescript","code":"type inp = z.input<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":23,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":28,"symbol":"stringWithDefault","kind":"constant","lang":"typescript","code":"const stringWithDefault = z.string().optional().default(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":34,"symbol":"inp","kind":"type","lang":"typescript","code":"type inp = z.input<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":36,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":41,"symbol":"stringWithDefault","kind":"constant","lang":"typescript","code":"const stringWithDefault = z.string().default(\"asdf\").optional();"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":43,"symbol":"inp","kind":"type","lang":"typescript","code":"type inp = z.input<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":45,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":50,"symbol":"complex","kind":"constant","lang":"typescript","code":"const complex = z\n .string()\n .default(\"asdf\")\n .transform((val) => val.toUpperCase())\n .default(\"qwer\")\n .removeDefault()\n .optional()\n .default(\"asdfasdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":63,"symbol":"stringWithRemovedDefault","kind":"constant","lang":"typescript","code":"const stringWithRemovedDefault = z.string().default(\"asdf\").removeDefault();"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":65,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof stringWithRemovedDefault>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":70,"symbol":"inner","kind":"constant","lang":"typescript","code":"const inner = z.string().default(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":71,"symbol":"outer","kind":"constant","lang":"typescript","code":"const outer = z.object({ inner }).default({\n inner: undefined,\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":74,"symbol":"input","kind":"type","lang":"typescript","code":"type input = z.input<typeof outer>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":76,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof outer>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":84,"symbol":"stringWithDefault","kind":"constant","lang":"typescript","code":"const stringWithDefault = z.string().default(\"inner\").default(\"outer\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":85,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringWithDefault.parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":94,"symbol":"Fruits","kind":"type","lang":"typescript","code":"enum Fruits {\n apple = \"apple\",\n orange = \"orange\",\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":99,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n fruit: z.nativeEnum(Fruits).default(Fruits.apple),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/default.test.ts","line":107,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n fruit: z.enum([\"apple\", \"orange\"]).default(\"apple\"),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/description.test.ts","line":6,"symbol":"description","kind":"constant","lang":"typescript","code":"const description = \"a description\";"} {"repo":"zod","file":"packages/zod/src/v3/tests/description.test.ts","line":21,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string({ description });"} {"repo":"zod","file":"packages/zod/src/v3/tests/description.test.ts","line":28,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().describe(description);"} {"repo":"zod","file":"packages/zod/src/v3/tests/discriminated-unions.test.ts","line":18,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"1\"), val: z.literal(1) }),\n z.object({ type: z.literal(1), val: z.literal(2) }),\n z.object({ type: z.literal(BigInt(1)), val: z.literal(3) }),\n z.object({ type: z.literal(\"true\"), val: z.literal(4) }),\n z.object({ type: z.literal(true), val: z.literal(5) }),\n z.object({ type: z.literal(\"null\"), val: z.literal(6) }),\n z.object({ type: z.literal(null), val: z.literal(7) }),\n z.object({ type: z.literal(\"undefined\"), val: z.literal(8) }),\n z.object({ type: z.literal(undefined), val: z.literal(9) }),\n z.object({ type: z.literal(\"transform\"), val: z.literal(10) }),\n z.object({ type: z.literal(\"refine\"), val: z.literal(11) }),\n z.object({ type: z.literal(\"superRefine\"), val: z.literal(12) }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/discriminated-unions.test.ts","line":200,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"foo\").default(\"foo\"),\n a: z.string(),\n }),\n z.object({\n type: z.literal(\"custom\"),\n method: z.string(),\n }),\n z.object({\n type: z.preprocess((val) => String(val), z.literal(\"bar\")),\n c: z.string(),\n }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/discriminated-unions.test.ts","line":221,"symbol":"MyEnum","kind":"type","lang":"typescript","code":"enum MyEnum {\n d = 0,\n e = \"e\",\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/discriminated-unions.test.ts","line":226,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\"key\", [\n z.object({\n key: z.literal(\"a\"),\n // Add other properties specific to this option\n }),\n z.object({\n key: z.enum([\"b\", \"c\"]),\n // Add other properties specific to this option\n }),\n z.object({\n key: z.nativeEnum(MyEnum),\n // Add other properties specific to this option\n }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/discriminated-unions.test.ts","line":252,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\"key\", [\n z.object({\n key: z.literal(\"a\"),\n // Add other properties specific to this option\n }),\n z.object({\n key: z.literal(\"b\").brand(\"asdfaf\"),\n // Add other properties specific to this option\n }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/discriminated-unions.test.ts","line":273,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\"key\", [\n z.object({\n key: z.literal(\"a\").optional(),\n a: z.literal(true),\n }),\n z.object({\n key: z.literal(\"b\").nullable(),\n b: z.literal(true),\n // Add other properties specific to this option\n }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/discriminated-unions.test.ts","line":285,"symbol":"schema","kind":"type","lang":"typescript","code":"type schema = z.infer<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/discriminated-unions.test.ts","line":299,"symbol":"value","kind":"constant","lang":"typescript","code":"const value = schema.parse({ key: null, b: true });"} {"repo":"zod","file":"packages/zod/src/v3/tests/discriminated-unions.test.ts","line":309,"symbol":"options","kind":"constant","lang":"typescript","code":"const options = [\n z.object({ type: z.literal(\"x\"), val: z.literal(1) }),\n z.object({ type: z.literal(\"y\"), val: z.literal(2) }),\n ] as const;"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":8,"symbol":"MyEnum","kind":"constant","lang":"typescript","code":"const MyEnum = z.enum([\"Red\", \"Green\", \"Blue\"]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":15,"symbol":"MyEnum","kind":"constant","lang":"typescript","code":"const MyEnum = z.enum([\"Red\", \"Green\", \"Blue\"]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":16,"symbol":"MyEnum","kind":"type","lang":"typescript","code":"type MyEnum = z.infer<typeof MyEnum>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":25,"symbol":"HTTP_SUCCESS","kind":"constant","lang":"typescript","code":"const HTTP_SUCCESS = [\"200\", \"201\"] as const;"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":26,"symbol":"arg","kind":"constant","lang":"typescript","code":"const arg = z.enum(HTTP_SUCCESS);"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":27,"symbol":"arg","kind":"type","lang":"typescript","code":"type arg = z.infer<typeof arg>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":35,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.enum([\"test\"], { required_error: \"REQUIRED\" }).safeParse(undefined);"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":43,"symbol":"foods","kind":"constant","lang":"typescript","code":"const foods = [\"Pasta\", \"Pizza\", \"Tacos\", \"Burgers\", \"Salad\"] as const;"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":44,"symbol":"FoodEnum","kind":"constant","lang":"typescript","code":"const FoodEnum = z.enum(foods);"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":45,"symbol":"ItalianEnum","kind":"constant","lang":"typescript","code":"const ItalianEnum = FoodEnum.extract([\"Pasta\", \"Pizza\"]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":46,"symbol":"UnhealthyEnum","kind":"constant","lang":"typescript","code":"const UnhealthyEnum = FoodEnum.exclude([\"Salad\"]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":47,"symbol":"EmptyFoodEnum","kind":"constant","lang":"typescript","code":"const EmptyFoodEnum = FoodEnum.exclude(foods);"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":57,"symbol":"foods","kind":"constant","lang":"typescript","code":"const foods = [\"Pasta\", \"Pizza\", \"Tacos\", \"Burgers\", \"Salad\"] as const;"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":58,"symbol":"FoodEnum","kind":"constant","lang":"typescript","code":"const FoodEnum = z.enum(foods, {\n errorMap: () => ({ message: \"This is not food!\" }),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":61,"symbol":"ItalianEnum","kind":"constant","lang":"typescript","code":"const ItalianEnum = FoodEnum.extract([\"Pasta\", \"Pizza\"]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":62,"symbol":"foodsError","kind":"constant","lang":"typescript","code":"const foodsError = FoodEnum.safeParse(\"Cucumbers\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":63,"symbol":"italianError","kind":"constant","lang":"typescript","code":"const italianError = ItalianEnum.safeParse(\"Tacos\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":68,"symbol":"UnhealthyEnum","kind":"constant","lang":"typescript","code":"const UnhealthyEnum = FoodEnum.exclude([\"Salad\"], {\n errorMap: () => ({ message: \"This is not healthy food!\" }),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/enum.test.ts","line":71,"symbol":"unhealthyError","kind":"constant","lang":"typescript","code":"const unhealthyError = UnhealthyEnum.safeParse(\"Salad\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":9,"symbol":"err1","kind":"constant","lang":"typescript","code":"const err1 = ZodError.create([]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":20,"symbol":"err2","kind":"constant","lang":"typescript","code":"const err2 = ZodError.create(err1.issues);"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":21,"symbol":"err3","kind":"constant","lang":"typescript","code":"const err3 = new ZodError([]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":29,"symbol":"errorMap","kind":"constant","lang":"typescript","code":"const errorMap: z.ZodErrorMap = (error, ctx) => {\n if (error.code === ZodIssueCode.invalid_type) {\n if (error.expected === \"string\") {\n return { message: \"bad type!\" };\n }\n }\n if (error.code === ZodIssueCode.custom) {\n return { message: `less-than-${error.params?.minimum}` };\n }\n return { message: ctx.defaultError };\n};"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":45,"symbol":"zerr","kind":"constant","lang":"typescript","code":"const zerr: z.ZodError = err as any;"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":60,"symbol":"zerr","kind":"constant","lang":"typescript","code":"const zerr: z.ZodError = err as any;"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":75,"symbol":"zerr","kind":"constant","lang":"typescript","code":"const zerr: z.ZodError = err as any;"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":86,"symbol":"zerr","kind":"constant","lang":"typescript","code":"const zerr: z.ZodError = err as any;"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":98,"symbol":"zerr","kind":"constant","lang":"typescript","code":"const zerr: z.ZodError = err as any;"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":112,"symbol":"zerr","kind":"constant","lang":"typescript","code":"const zerr: z.ZodError = err as any;"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":122,"symbol":"zerr","kind":"constant","lang":"typescript","code":"const zerr: ZodError = err as any;"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":129,"symbol":"zerr","kind":"constant","lang":"typescript","code":"const zerr: ZodError = err as any;"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":155,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n items: z.array(z.string()).refine((data) => data.length > 3, {\n path: [\"items-too-few\"],\n }),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":161,"symbol":"errorMap","kind":"constant","lang":"typescript","code":"const errorMap: z.ZodErrorMap = (error) => {\n expect(error.path.length).toBe(2);\n return { message: \"doesnt matter\" };\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":165,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({ items: [\"first\"] }, { errorMap });"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":173,"symbol":"dynamicRefine","kind":"constant","lang":"typescript","code":"const dynamicRefine = z.string().refine(\n (val) => val === val.toUpperCase(),\n (val) => ({ params: { val } })\n );"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":178,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = dynamicRefine.safeParse(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":181,"symbol":"sub","kind":"constant","lang":"typescript","code":"const sub = result.error.issues[0];"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":203,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().email();"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":204,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"asdfsdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":212,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n password: z.string(),\n confirm: z.string(),\n })\n .refine((val) => val.confirm === val.password, { path: [\"confirm\"] });"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":219,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({\n password: \"peanuts\",\n confirm: \"qeanuts\",\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":227,"symbol":"error","kind":"constant","lang":"typescript","doc":"nested errors","code":"const error = result.error.format();"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":235,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n password: z.string().min(6),\n confirm: z.string().min(6),\n })\n .refine((val) => val.confirm === val.password);"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":242,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({\n password: \"qwer\",\n confirm: \"asdf\",\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":253,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n inner: z.object({\n name: z\n .string()\n .refine((val) => val.length > 5)\n .array()\n .refine((val) => val.length <= 1),\n }),\n});"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":264,"symbol":"invalidItem","kind":"constant","lang":"typescript","code":"const invalidItem = {\n inner: { name: [\"aasd\", \"asdfasdfasfd\"] },\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":268,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = schema.safeParse(invalidItem);"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":275,"symbol":"invalidItem","kind":"constant","lang":"typescript","code":"const invalidItem = {\n inner: { name: [\"aasd\", \"asdfasdfasfd\"] },\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":278,"symbol":"invalidArray","kind":"constant","lang":"typescript","code":"const invalidArray = {\n inner: { name: [\"asdfasdf\", \"asdfasdfasfd\"] },\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":281,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = schema.safeParse(invalidItem);"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":282,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = schema.safeParse(invalidArray);"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":287,"symbol":"error","kind":"constant","lang":"typescript","code":"const error = result1.error.format();"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":296,"symbol":"FormattedError","kind":"type","lang":"typescript","code":"type FormattedError = z.inferFormattedError<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":297,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: FormattedError = result2.error.format();"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":308,"symbol":"FormattedError","kind":"type","lang":"typescript","code":"type FormattedError = z.inferFormattedError<typeof schema, number>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":309,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: FormattedError = result2.error.format(() => 5);"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":317,"symbol":"nameSchema","kind":"constant","lang":"typescript","code":"const nameSchema = z.string().refine((val) => val.length > 5);"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":318,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n nullableObject: z.object({ name: nameSchema }).nullable(),\n nullableArray: z.array(nameSchema).nullable(),\n nullableTuple: z.tuple([nameSchema, nameSchema, z.number()]).nullable(),\n optionalObject: z.object({ name: nameSchema }).optional(),\n optionalArray: z.array(nameSchema).optional(),\n optionalTuple: z.tuple([nameSchema, nameSchema, z.number()]).optional(),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":326,"symbol":"invalidItem","kind":"constant","lang":"typescript","code":"const invalidItem = {\n nullableObject: { name: \"abcd\" },\n nullableArray: [\"abcd\"],\n nullableTuple: [\"abcd\", \"abcd\", 1],\n optionalObject: { name: \"abcd\" },\n optionalArray: [\"abcd\"],\n optionalTuple: [\"abcd\", \"abcd\", 1],\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":334,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(invalidItem);"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":337,"symbol":"FormattedError","kind":"type","lang":"typescript","code":"type FormattedError = z.inferFormattedError<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":338,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: FormattedError = result.error.format();"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":357,"symbol":"stringWithCustomError","kind":"constant","lang":"typescript","code":"const stringWithCustomError = z.string({\n errorMap: (issue, ctx) => ({\n message: issue.code === \"invalid_type\" ? (ctx.data ? \"Invalid name\" : \"Name is required\") : ctx.defaultError,\n }),\n});"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":364,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringWithCustomError.safeParse(1234);"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":370,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = stringWithCustomError.safeParse(undefined);"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":377,"symbol":"result3","kind":"constant","lang":"typescript","doc":"support contextual override","code":"const result3 = stringWithCustomError.safeParse(undefined, {\n errorMap: () => ({ message: \"OVERRIDE\" }),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":389,"symbol":"result4","kind":"constant","lang":"typescript","code":"const result4 = stringWithCustomError.min(10).safeParse(\"tooshort\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":398,"symbol":"str","kind":"constant","lang":"typescript","code":"const str = z.string({\n invalid_type_error: \"Invalid name\",\n required_error: \"Name is required\",\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":402,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = str.safeParse(1234);"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":407,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = str.safeParse(undefined);"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":415,"symbol":"str","kind":"constant","lang":"typescript","code":"const str = z.string({\n invalid_type_error: \"Invalid name\",\n // required_error: \"Name is required\",\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":420,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = str.safeParse(undefined);"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":438,"symbol":"errorMsg","kind":"constant","lang":"typescript","code":"const errorMsg = \"Invalid object\";"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":439,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = z.object({ x: z.string() }).strict(errorMsg);"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":440,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = obj.safeParse({ x: \"a\", y: \"b\" });"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":451,"symbol":"zerr","kind":"constant","lang":"typescript","code":"const zerr: z.ZodError = err as any;"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":461,"symbol":"zerr","kind":"constant","lang":"typescript","code":"const zerr: z.ZodError = err as any;"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":468,"symbol":"Fish","kind":"type","lang":"typescript","code":"enum Fish {\n Tuna = \"Tuna\",\n Trout = \"Trout\",\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/error.test.ts","line":475,"symbol":"zerr","kind":"constant","lang":"typescript","code":"const zerr: z.ZodError = err as any;"} {"repo":"zod","file":"packages/zod/src/v3/tests/firstparty.test.ts","line":8,"symbol":"myType","kind":"constant","lang":"typescript","code":"const myType = z.string() as z.ZodFirstPartySchemaTypes;"} {"repo":"zod","file":"packages/zod/src/v3/tests/firstparty.test.ts","line":9,"symbol":"def","kind":"constant","lang":"typescript","code":"const def = myType._def;"} {"repo":"zod","file":"packages/zod/src/v3/tests/firstpartyschematypes.test.ts","line":8,"symbol":"ZodFirstPartySchemaForType","kind":"type","lang":"typescript","code":"type ZodFirstPartySchemaForType<T extends ZodFirstPartyTypeKind> = ZodFirstPartySchemaTypes extends infer Schema\n ? Schema extends { _def: { typeName: T } }\n ? Schema\n : never\n : never;"} {"repo":"zod","file":"packages/zod/src/v3/tests/firstpartyschematypes.test.ts","line":13,"symbol":"ZodMappedTypes","kind":"type","lang":"typescript","code":"type ZodMappedTypes = {\n [key in ZodFirstPartyTypeKind]: ZodFirstPartySchemaForType<key>;\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/firstpartyschematypes.test.ts","line":16,"symbol":"ZodFirstPartySchemaTypesMissingFromUnion","kind":"type","lang":"typescript","code":"type ZodFirstPartySchemaTypesMissingFromUnion = keyof {\n [key in keyof ZodMappedTypes as ZodMappedTypes[key] extends { _def: never } ? key : never]: unknown;\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":7,"symbol":"args1","kind":"constant","lang":"typescript","code":"const args1 = z.tuple([z.string()]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":8,"symbol":"returns1","kind":"constant","lang":"typescript","code":"const returns1 = z.number();"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":9,"symbol":"func1","kind":"constant","lang":"typescript","code":"const func1 = z.function(args1, returns1);"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":12,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = func1.parse((arg: any) => arg.length);"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":13,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = parsed(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":18,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = func1.parse((x: string) => x);"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":23,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = func1.parse((x: string) => x);"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":28,"symbol":"func1","kind":"type","lang":"typescript","code":"type func1 = z.TypeOf<typeof func1>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":33,"symbol":"methodObject","kind":"constant","lang":"typescript","code":"const methodObject = z.object({\n property: z.number(),\n method: z.function().args(z.string()).returns(z.number()),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":37,"symbol":"methodInstance","kind":"constant","lang":"typescript","code":"const methodInstance = {\n property: 3,\n method: function (s: string) {\n return s.length + this.property;\n },\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":43,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = methodObject.parse(methodInstance);"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":48,"symbol":"methodObject","kind":"constant","lang":"typescript","code":"const methodObject = z.object({\n property: z.number(),\n method: z.function().args(z.string()).returns(z.promise(z.number())),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":52,"symbol":"methodInstance","kind":"constant","lang":"typescript","code":"const methodInstance = {\n property: 3,\n method: async function (s: string) {\n return s.length + this.property;\n },\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":58,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = methodObject.parse(methodInstance);"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":63,"symbol":"t1","kind":"constant","lang":"typescript","code":"const t1 = z.function();"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":64,"symbol":"t1","kind":"type","lang":"typescript","code":"type t1 = z.infer<typeof t1>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":67,"symbol":"t2","kind":"constant","lang":"typescript","code":"const t2 = t1.args(z.string());"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":68,"symbol":"t2","kind":"type","lang":"typescript","code":"type t2 = z.infer<typeof t2>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":71,"symbol":"t3","kind":"constant","lang":"typescript","code":"const t3 = t2.returns(z.boolean());"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":72,"symbol":"t3","kind":"type","lang":"typescript","code":"type t3 = z.infer<typeof t3>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":76,"symbol":"args2","kind":"constant","lang":"typescript","code":"const args2 = z.tuple([\n z.object({\n f1: z.number(),\n f2: z.string().nullable(),\n f3: z.array(z.boolean().optional()).optional(),\n }),\n]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":83,"symbol":"returns2","kind":"constant","lang":"typescript","code":"const returns2 = z.union([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":85,"symbol":"func2","kind":"constant","lang":"typescript","code":"const func2 = z.function(args2, returns2);"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":88,"symbol":"func2","kind":"type","lang":"typescript","code":"type func2 = z.TypeOf<typeof func2>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":100,"symbol":"validFunc2Instance","kind":"constant","lang":"typescript","code":"const validFunc2Instance = func2.validate((_x) => {\n return \"adf\" as any;\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":104,"symbol":"checker","kind":"constant","lang":"typescript","code":"const checker = () => {\n validFunc2Instance({\n f1: 21,\n f2: \"asdf\",\n f3: [true, false],\n });\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":116,"symbol":"invalidFuncInstance","kind":"constant","lang":"typescript","code":"const invalidFuncInstance = func2.validate((_x) => {\n return \"adf\" as any;\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":120,"symbol":"checker","kind":"constant","lang":"typescript","code":"const checker = () => {\n invalidFuncInstance(\"Invalid_input\" as any);\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":128,"symbol":"invalidFuncInstance","kind":"constant","lang":"typescript","code":"const invalidFuncInstance = func2.validate((_x) => {\n return [\"this\", \"is\", \"not\", \"valid\", \"output\"] as any;\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":132,"symbol":"checker","kind":"constant","lang":"typescript","code":"const checker = () => {\n invalidFuncInstance({\n f1: 21,\n f2: \"asdf\",\n f3: [true, false],\n });\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":146,"symbol":"checker","kind":"constant","lang":"typescript","code":"const checker = z.function(z.tuple([z.string()]), z.boolean()).implement((arg) => {\n return arg.length as any;\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":152,"symbol":"zerr","kind":"constant","lang":"typescript","code":"const zerr = err as z.ZodError;"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":153,"symbol":"first","kind":"constant","lang":"typescript","code":"const first = zerr.issues[0];"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":162,"symbol":"zerr","kind":"constant","lang":"typescript","code":"const zerr = err as z.ZodError;"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":163,"symbol":"first","kind":"constant","lang":"typescript","code":"const first = zerr.issues[0];"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":170,"symbol":"func","kind":"constant","lang":"typescript","code":"const func = z\n .function()\n .args(z.string().refine(async (val) => val.length > 10))\n .returns(z.promise(z.number().refine(async (val) => val > 10)))\n .implement(async (val) => {\n return val.length;\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":177,"symbol":"results","kind":"constant","lang":"typescript","code":"const results = [];"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":195,"symbol":"func","kind":"constant","lang":"typescript","code":"const func = z\n .function()\n .args(z.string().refine(async (val) => val.length > 10))\n .returns(z.number().refine(async (val) => val > 10))\n .implement((val) => {\n return val.length;\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":203,"symbol":"results","kind":"constant","lang":"typescript","code":"const results = [];"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":215,"symbol":"maxLength5","kind":"constant","lang":"typescript","code":"const maxLength5 = z\n .function()\n .args(z.string())\n .returns(z.boolean())\n .implement((str, _arg, _qewr) => {\n return str.length <= 5;\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":223,"symbol":"filteredList","kind":"constant","lang":"typescript","code":"const filteredList = [\"apple\", \"orange\", \"pear\", \"banana\", \"strawberry\"].filter(maxLength5);"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":228,"symbol":"func","kind":"constant","lang":"typescript","code":"const func = z.function().args(z.string()).returns(z.string());"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":230,"symbol":"paramResult","kind":"constant","lang":"typescript","code":"const paramResult = func.parameters().items[0].parse(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":233,"symbol":"returnResult","kind":"constant","lang":"typescript","code":"const returnResult = func.returnType().parse(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":238,"symbol":"funcSchema","kind":"constant","lang":"typescript","code":"const funcSchema = z\n .function()\n .args(z.string().transform((val) => val.length))\n .returns(z.object({ val: z.number() }));"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":242,"symbol":"myFunc","kind":"constant","lang":"typescript","code":"const myFunc = funcSchema.implement((val) => {\n return { val, extra: \"stuff\" };\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":251,"symbol":"funcSchema","kind":"constant","lang":"typescript","code":"const funcSchema = z\n .function()\n .args(z.string().transform((val) => val.length))\n .returns(z.object({ arg: z.number() }).transform((val) => val.arg));"} {"repo":"zod","file":"packages/zod/src/v3/tests/function.test.ts","line":256,"symbol":"myFunc","kind":"constant","lang":"typescript","code":"const myFunc = funcSchema.implement((val) => {\n return { arg: val, arg2: false };\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/generics.test.ts","line":8,"symbol":"stripOuter","kind":"function","lang":"typescript","code":"async function stripOuter<TData extends z.ZodTypeAny>(schema: TData, data: unknown) {\n return z\n .object({\n nested: schema, // as z.ZodTypeAny,\n })\n .transform((data) => {\n return data.nested!;\n })\n .parse({ nested: data });\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/generics.test.ts","line":19,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stripOuter(z.object({ a: z.string() }), { a: \"asdf\" });"} {"repo":"zod","file":"packages/zod/src/v3/tests/generics.test.ts","line":43,"symbol":"inner","kind":"constant","lang":"typescript","code":"const inner = z.string().or(z.array(z.string()));"} {"repo":"zod","file":"packages/zod/src/v3/tests/generics.test.ts","line":44,"symbol":"outer","kind":"constant","lang":"typescript","code":"const outer = z.object({ inner });"} {"repo":"zod","file":"packages/zod/src/v3/tests/generics.test.ts","line":45,"symbol":"outerSchema","kind":"type","lang":"typescript","code":"type outerSchema = z.infer<typeof outer>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/instanceof.test.ts","line":8,"symbol":"Test","kind":"class","lang":"typescript","code":"class Test {}"} {"repo":"zod","file":"packages/zod/src/v3/tests/instanceof.test.ts","line":9,"symbol":"Subtest","kind":"class","lang":"typescript","code":"class Subtest extends Test {}"} {"repo":"zod","file":"packages/zod/src/v3/tests/instanceof.test.ts","line":11,"symbol":"constructor","kind":"method","lang":"typescript","code":"constructor(public val: string) {}"} {"repo":"zod","file":"packages/zod/src/v3/tests/instanceof.test.ts","line":13,"symbol":"Bar","kind":"class","lang":"typescript","code":"class Bar extends AbstractBar {}"} {"repo":"zod","file":"packages/zod/src/v3/tests/instanceof.test.ts","line":15,"symbol":"TestSchema","kind":"constant","lang":"typescript","code":"const TestSchema = z.instanceof(Test);"} {"repo":"zod","file":"packages/zod/src/v3/tests/instanceof.test.ts","line":16,"symbol":"SubtestSchema","kind":"constant","lang":"typescript","code":"const SubtestSchema = z.instanceof(Subtest);"} {"repo":"zod","file":"packages/zod/src/v3/tests/instanceof.test.ts","line":17,"symbol":"AbstractSchema","kind":"constant","lang":"typescript","code":"const AbstractSchema = z.instanceof(AbstractBar);"} {"repo":"zod","file":"packages/zod/src/v3/tests/instanceof.test.ts","line":18,"symbol":"BarSchema","kind":"constant","lang":"typescript","code":"const BarSchema = z.instanceof(Bar);"} {"repo":"zod","file":"packages/zod/src/v3/tests/instanceof.test.ts","line":24,"symbol":"bar","kind":"constant","lang":"typescript","code":"const bar = BarSchema.parse(new Bar(\"asdf\"));"} {"repo":"zod","file":"packages/zod/src/v3/tests/instanceof.test.ts","line":34,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.instanceof(Date).refine((d) => d.toString());"} {"repo":"zod","file":"packages/zod/src/v3/tests/instanceof.test.ts","line":35,"symbol":"res","kind":"constant","lang":"typescript","code":"const res = schema.safeParse(null);"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":7,"symbol":"BaseTeacher","kind":"constant","lang":"typescript","code":"const BaseTeacher = z.object({\n subjects: z.array(z.string()),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":10,"symbol":"HasID","kind":"constant","lang":"typescript","code":"const HasID = z.object({ id: z.string() });"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":12,"symbol":"Teacher","kind":"constant","lang":"typescript","code":"const Teacher = z.intersection(BaseTeacher.passthrough(), HasID);"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":13,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = {\n subjects: [\"math\"],\n id: \"asdfasdf\",\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":25,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases = [\n [\n z.intersection(z.object({ name: z.string() }), z.unknown()),\n JSON.parse('{\"__proto__\":{\"isAdmin\":true},\"name\":\"alice\"}'),\n { name: \"alice\" },\n ],\n [z.intersection(z.record(z.string(), z.unknown()), z.any()), JSON.parse('{\"__proto__\":{},\"a\":1}'), { a: 1 }],\n ] as const;"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":35,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = schema.parse(input);"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":43,"symbol":"Animal","kind":"constant","lang":"typescript","code":"const Animal = z.object({\n properties: z.object({\n is_animal: z.boolean(),\n }),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":48,"symbol":"Cat","kind":"constant","lang":"typescript","code":"const Cat = z\n .object({\n properties: z.object({\n jumped: z.boolean(),\n }),\n })\n .and(Animal);"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":56,"symbol":"_Cat","kind":"type","lang":"typescript","code":"type _Cat = z.infer<typeof Cat>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":58,"symbol":"cat","kind":"constant","lang":"typescript","doc":"const cat:Cat = 'asdf' as any;","code":"const cat = Cat.parse({ properties: { is_animal: true, jumped: true } });"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":63,"symbol":"Author","kind":"constant","lang":"typescript","code":"const Author = z.object({\n posts: z.array(\n z.object({\n post_id: z.number(),\n })\n ),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":70,"symbol":"Registry","kind":"constant","lang":"typescript","code":"const Registry = z\n .object({\n posts: z.array(\n z.object({\n title: z.string(),\n })\n ),\n })\n .and(Author);"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":80,"symbol":"posts","kind":"constant","lang":"typescript","code":"const posts = [\n { post_id: 1, title: \"Novels\" },\n { post_id: 2, title: \"Fairy tales\" },\n ];"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":84,"symbol":"cat","kind":"constant","lang":"typescript","code":"const cat = Registry.parse({ posts });"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":86,"symbol":"asyncCat","kind":"constant","lang":"typescript","code":"const asyncCat = await Registry.parseAsync({ posts });"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":91,"symbol":"numberIntersection","kind":"constant","lang":"typescript","code":"const numberIntersection = z.intersection(\n z.number(),\n z.number().transform((x) => x + 1)\n );"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":96,"symbol":"syncResult","kind":"constant","lang":"typescript","code":"const syncResult = numberIntersection.safeParse(1234);"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":102,"symbol":"asyncResult","kind":"constant","lang":"typescript","code":"const asyncResult = await numberIntersection.spa(1234);"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":110,"symbol":"stringArrInt","kind":"constant","lang":"typescript","code":"const stringArrInt = z.intersection(\n z.string().array(),\n z\n .string()\n .array()\n .transform((val) => [...val, \"asdf\"])\n );"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":117,"symbol":"syncResult","kind":"constant","lang":"typescript","code":"const syncResult = stringArrInt.safeParse([\"asdf\", \"qwer\"]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/intersection.test.ts","line":123,"symbol":"asyncResult","kind":"constant","lang":"typescript","code":"const asyncResult = await stringArrInt.spa([\"asdf\", \"qwer\"]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":3,"symbol":"filePath","kind":"constant","lang":"typescript","code":"const filePath = __filename;"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":7,"symbol":"Test","kind":"constant","lang":"typescript","code":"const Test = z.object({\n f1: z.number(),\n});"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":11,"symbol":"Test","kind":"type","lang":"typescript","code":"type Test = z.infer<typeof Test>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":13,"symbol":"instanceOfTest","kind":"constant","lang":"typescript","code":"const instanceOfTest: Test = {\n f1: 1,\n};"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":19,"symbol":"TestMerge","kind":"constant","lang":"typescript","code":"const TestMerge = z\n .object({\n f2: z.string().optional(),\n })\n .merge(Test);"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":25,"symbol":"TestMerge","kind":"type","lang":"typescript","code":"type TestMerge = z.infer<typeof TestMerge>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":27,"symbol":"instanceOfTestMerge","kind":"constant","lang":"typescript","code":"const instanceOfTestMerge: TestMerge = {\n f1: 1,\n f2: \"string\",\n};"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":34,"symbol":"TestUnion","kind":"constant","lang":"typescript","code":"const TestUnion = z.union([\n z.object({\n f2: z.string().optional(),\n }),\n Test,\n]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":41,"symbol":"TestUnion","kind":"type","lang":"typescript","code":"type TestUnion = z.infer<typeof TestUnion>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":43,"symbol":"instanceOfTestUnion","kind":"constant","lang":"typescript","code":"const instanceOfTestUnion: TestUnion = {\n f1: 1,\n f2: \"string\",\n};"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":50,"symbol":"TestPartial","kind":"constant","lang":"typescript","code":"const TestPartial = Test.partial();"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":52,"symbol":"TestPartial","kind":"type","lang":"typescript","code":"type TestPartial = z.infer<typeof TestPartial>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":54,"symbol":"instanceOfTestPartial","kind":"constant","lang":"typescript","code":"const instanceOfTestPartial: TestPartial = {\n f1: 1,\n};"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":60,"symbol":"TestPick","kind":"constant","lang":"typescript","code":"const TestPick = TestMerge.pick({ f1: true });"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":62,"symbol":"TestPick","kind":"type","lang":"typescript","code":"type TestPick = z.infer<typeof TestPick>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":64,"symbol":"instanceOfTestPick","kind":"constant","lang":"typescript","code":"const instanceOfTestPick: TestPick = {\n f1: 1,\n};"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":70,"symbol":"TestOmit","kind":"constant","lang":"typescript","code":"const TestOmit = TestMerge.omit({ f2: true });"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":72,"symbol":"TestOmit","kind":"type","lang":"typescript","code":"type TestOmit = z.infer<typeof TestOmit>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/language-server.source.ts","line":74,"symbol":"instanceOfTestOmit","kind":"constant","lang":"typescript","code":"const instanceOfTestOmit: TestOmit = {\n f1: 1,\n};"} {"repo":"zod","file":"packages/zod/src/v3/tests/literal.test.ts","line":6,"symbol":"literalTuna","kind":"constant","lang":"typescript","code":"const literalTuna = z.literal(\"tuna\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/literal.test.ts","line":7,"symbol":"literalFortyTwo","kind":"constant","lang":"typescript","code":"const literalFortyTwo = z.literal(42);"} {"repo":"zod","file":"packages/zod/src/v3/tests/literal.test.ts","line":8,"symbol":"literalTrue","kind":"constant","lang":"typescript","code":"const literalTrue = z.literal(true);"} {"repo":"zod","file":"packages/zod/src/v3/tests/literal.test.ts","line":10,"symbol":"terrificSymbol","kind":"constant","lang":"typescript","code":"const terrificSymbol = Symbol(\"terrific\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/literal.test.ts","line":11,"symbol":"literalTerrificSymbol","kind":"constant","lang":"typescript","code":"const literalTerrificSymbol = z.literal(terrificSymbol);"} {"repo":"zod","file":"packages/zod/src/v3/tests/literal.test.ts","line":28,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = \"shark\";"} {"repo":"zod","file":"packages/zod/src/v3/tests/literal.test.ts","line":29,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = literalTuna.safeParse(data);"} {"repo":"zod","file":"packages/zod/src/v3/tests/literal.test.ts","line":31,"symbol":"issue","kind":"constant","lang":"typescript","code":"const issue = result.error.issues[0];"} {"repo":"zod","file":"packages/zod/src/v3/tests/map.test.ts","line":8,"symbol":"stringMap","kind":"constant","lang":"typescript","code":"const stringMap = z.map(z.string(), z.string());"} {"repo":"zod","file":"packages/zod/src/v3/tests/map.test.ts","line":9,"symbol":"stringMap","kind":"type","lang":"typescript","code":"type stringMap = z.infer<typeof stringMap>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/map.test.ts","line":16,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringMap.safeParse(\n new Map([\n [\"first\", \"foo\"],\n [\"second\", \"bar\"],\n ])\n );"} {"repo":"zod","file":"packages/zod/src/v3/tests/map.test.ts","line":32,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await stringMap.spa(\n new Map([\n [\"first\", \"foo\"],\n [\"second\", \"bar\"],\n ])\n );"} {"repo":"zod","file":"packages/zod/src/v3/tests/map.test.ts","line":48,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringMap.safeParse(new Set([]));"} {"repo":"zod","file":"packages/zod/src/v3/tests/map.test.ts","line":57,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringMap.safeParse(new Map([[42, Symbol()]]));"} {"repo":"zod","file":"packages/zod/src/v3/tests/map.test.ts","line":71,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringMap.safeParse(\n new Map([\n [1, \"foo\"],\n [\"bar\", 2],\n ] as [any, any][]) as Map<any, any>\n );"} {"repo":"zod","file":"packages/zod/src/v3/tests/map.test.ts","line":90,"symbol":"map","kind":"constant","lang":"typescript","code":"const map = z.map(\n z.string().refine((val) => val === val.toUpperCase(), {\n message: \"Keys must be uppercase\",\n }),\n z.string()\n );"} {"repo":"zod","file":"packages/zod/src/v3/tests/map.test.ts","line":96,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await map.spa(\n new Map([\n [\"first\", \"foo\"],\n [\"second\", \"bar\"],\n ])\n );"} {"repo":"zod","file":"packages/zod/src/v3/tests/mocker.test.ts","line":7,"symbol":"mocker","kind":"constant","lang":"typescript","code":"const mocker = new Mocker();"} {"repo":"zod","file":"packages/zod/src/v3/tests/nan.test.ts","line":6,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.nan();"} {"repo":"zod","file":"packages/zod/src/v3/tests/nan.test.ts","line":9,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = schema.parse(Number.NaN);"} {"repo":"zod","file":"packages/zod/src/v3/tests/nan.test.ts","line":12,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = schema.parse(Number(\"Not a number\"));"} {"repo":"zod","file":"packages/zod/src/v3/tests/nativeEnum.test.ts","line":8,"symbol":"Fruits","kind":"constant","lang":"typescript","code":"const Fruits: { Apple: \"apple\"; Banana: \"banana\" } = {\n Apple: \"apple\",\n Banana: \"banana\",\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/nativeEnum.test.ts","line":12,"symbol":"fruitEnum","kind":"constant","lang":"typescript","code":"const fruitEnum = z.nativeEnum(Fruits);"} {"repo":"zod","file":"packages/zod/src/v3/tests/nativeEnum.test.ts","line":13,"symbol":"fruitEnum","kind":"type","lang":"typescript","code":"type fruitEnum = z.infer<typeof fruitEnum>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/nativeEnum.test.ts","line":22,"symbol":"Fruits","kind":"type","lang":"typescript","code":"enum Fruits {\n Apple = \"apple\",\n Banana = \"banana\",\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/nativeEnum.test.ts","line":27,"symbol":"fruitEnum","kind":"constant","lang":"typescript","doc":"@ts-ignore","code":"const fruitEnum = z.nativeEnum(Fruits);"} {"repo":"zod","file":"packages/zod/src/v3/tests/nativeEnum.test.ts","line":28,"symbol":"fruitEnum","kind":"type","lang":"typescript","code":"type fruitEnum = z.infer<typeof fruitEnum>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/nativeEnum.test.ts","line":37,"symbol":"FruitValues","kind":"constant","lang":"typescript","code":"const FruitValues = {\n Apple: 10,\n Banana: 20,\n // @ts-ignore\n } as const;"} {"repo":"zod","file":"packages/zod/src/v3/tests/nativeEnum.test.ts","line":42,"symbol":"fruitEnum","kind":"constant","lang":"typescript","code":"const fruitEnum = z.nativeEnum(FruitValues);"} {"repo":"zod","file":"packages/zod/src/v3/tests/nativeEnum.test.ts","line":43,"symbol":"fruitEnum","kind":"type","lang":"typescript","code":"type fruitEnum = z.infer<typeof fruitEnum>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/nativeEnum.test.ts","line":52,"symbol":"Fruits","kind":"type","lang":"typescript","code":"enum Fruits {\n Cantaloupe = 0,\n Apple = \"apple\",\n Banana = \"banana\",\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/nativeEnum.test.ts","line":58,"symbol":"FruitEnum","kind":"constant","lang":"typescript","code":"const FruitEnum = z.nativeEnum(Fruits as any);"} {"repo":"zod","file":"packages/zod/src/v3/tests/nativeEnum.test.ts","line":59,"symbol":"_FruitEnum","kind":"type","lang":"typescript","code":"type _FruitEnum = z.infer<typeof FruitEnum>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/nativeEnum.test.ts","line":70,"symbol":"Greek","kind":"constant","lang":"typescript","code":"const Greek = {\n Alpha: \"a\",\n Beta: \"b\",\n Gamma: 3,\n // @ts-ignore\n } as const;"} {"repo":"zod","file":"packages/zod/src/v3/tests/nativeEnum.test.ts","line":77,"symbol":"GreekEnum","kind":"constant","lang":"typescript","code":"const GreekEnum = z.nativeEnum(Greek);"} {"repo":"zod","file":"packages/zod/src/v3/tests/nativeEnum.test.ts","line":78,"symbol":"_GreekEnum","kind":"type","lang":"typescript","code":"type _GreekEnum = z.infer<typeof GreekEnum>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/nullable.test.ts","line":6,"symbol":"checkErrors","kind":"function","lang":"typescript","code":"function checkErrors(a: z.ZodTypeAny, bad: any) {\n let expected: any;\n try {\n a.parse(bad);\n } catch (error) {\n expected = (error as z.ZodError).formErrors;\n }\n try {\n a.nullable().parse(bad);\n } catch (error) {\n expect((error as z.ZodError).formErrors).toEqual(expected);\n }\n}"} {"repo":"zod","file":"packages/zod/src/v3/tests/nullable.test.ts","line":40,"symbol":"unwrapped","kind":"constant","lang":"typescript","code":"const unwrapped = z.string().nullable().unwrap();"} {"repo":"zod","file":"packages/zod/src/v3/tests/number.test.ts","line":6,"symbol":"gtFive","kind":"constant","lang":"typescript","code":"const gtFive = z.number().gt(5);"} {"repo":"zod","file":"packages/zod/src/v3/tests/number.test.ts","line":7,"symbol":"gteFive","kind":"constant","lang":"typescript","code":"const gteFive = z.number().gte(-5).gte(5);"} {"repo":"zod","file":"packages/zod/src/v3/tests/number.test.ts","line":8,"symbol":"minFive","kind":"constant","lang":"typescript","code":"const minFive = z.number().min(0).min(5);"} {"repo":"zod","file":"packages/zod/src/v3/tests/number.test.ts","line":9,"symbol":"ltFive","kind":"constant","lang":"typescript","code":"const ltFive = z.number().lte(10).lt(5);"} {"repo":"zod","file":"packages/zod/src/v3/tests/number.test.ts","line":10,"symbol":"lteFive","kind":"constant","lang":"typescript","code":"const lteFive = z.number().lte(5);"} {"repo":"zod","file":"packages/zod/src/v3/tests/number.test.ts","line":11,"symbol":"maxFive","kind":"constant","lang":"typescript","code":"const maxFive = z.number().max(10).max(5);"} {"repo":"zod","file":"packages/zod/src/v3/tests/number.test.ts","line":12,"symbol":"intNum","kind":"constant","lang":"typescript","code":"const intNum = z.number().int();"} {"repo":"zod","file":"packages/zod/src/v3/tests/number.test.ts","line":13,"symbol":"positive","kind":"constant","lang":"typescript","code":"const positive = z.number().positive();"} {"repo":"zod","file":"packages/zod/src/v3/tests/number.test.ts","line":14,"symbol":"negative","kind":"constant","lang":"typescript","code":"const negative = z.number().negative();"} {"repo":"zod","file":"packages/zod/src/v3/tests/number.test.ts","line":15,"symbol":"nonpositive","kind":"constant","lang":"typescript","code":"const nonpositive = z.number().nonpositive();"} {"repo":"zod","file":"packages/zod/src/v3/tests/number.test.ts","line":16,"symbol":"nonnegative","kind":"constant","lang":"typescript","code":"const nonnegative = z.number().nonnegative();"} {"repo":"zod","file":"packages/zod/src/v3/tests/number.test.ts","line":17,"symbol":"multipleOfFive","kind":"constant","lang":"typescript","code":"const multipleOfFive = z.number().multipleOf(5);"} {"repo":"zod","file":"packages/zod/src/v3/tests/number.test.ts","line":18,"symbol":"multipleOfNegativeFive","kind":"constant","lang":"typescript","code":"const multipleOfNegativeFive = z.number().multipleOf(-5);"} {"repo":"zod","file":"packages/zod/src/v3/tests/number.test.ts","line":19,"symbol":"finite","kind":"constant","lang":"typescript","code":"const finite = z.number().finite();"} {"repo":"zod","file":"packages/zod/src/v3/tests/number.test.ts","line":20,"symbol":"safe","kind":"constant","lang":"typescript","code":"const safe = z.number().safe();"} {"repo":"zod","file":"packages/zod/src/v3/tests/number.test.ts","line":21,"symbol":"stepPointOne","kind":"constant","lang":"typescript","code":"const stepPointOne = z.number().step(0.1);"} {"repo":"zod","file":"packages/zod/src/v3/tests/number.test.ts","line":22,"symbol":"stepPointZeroZeroZeroOne","kind":"constant","lang":"typescript","code":"const stepPointZeroZeroZeroOne = z.number().step(0.0001);"} {"repo":"zod","file":"packages/zod/src/v3/tests/number.test.ts","line":23,"symbol":"stepSixPointFour","kind":"constant","lang":"typescript","code":"const stepSixPointFour = z.number().step(6.4);"} {"repo":"zod","file":"packages/zod/src/v3/tests/object-augmentation.test.ts","line":7,"symbol":"Animal","kind":"constant","lang":"typescript","code":"const Animal = z\n .object({\n species: z.string(),\n })\n .augment({\n population: z.number(),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/object-augmentation.test.ts","line":15,"symbol":"ModifiedAnimal","kind":"constant","lang":"typescript","doc":"overwrites `species`","code":"const ModifiedAnimal = Animal.augment({\n species: z.array(z.string()),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/object-augmentation.test.ts","line":23,"symbol":"bad","kind":"constant","lang":"typescript","code":"const bad = () =>\n ModifiedAnimal.parse({\n species: \"asdf\",\n population: 1324,\n } as any);"} {"repo":"zod","file":"packages/zod/src/v3/tests/object-in-es5-env.test.ts","line":6,"symbol":"RealSet","kind":"constant","lang":"typescript","code":"const RealSet = Set;"} {"repo":"zod","file":"packages/zod/src/v3/tests/object-in-es5-env.test.ts","line":7,"symbol":"RealMap","kind":"constant","lang":"typescript","code":"const RealMap = Map;"} {"repo":"zod","file":"packages/zod/src/v3/tests/object-in-es5-env.test.ts","line":8,"symbol":"RealDate","kind":"constant","lang":"typescript","code":"const RealDate = Date;"} {"repo":"zod","file":"packages/zod/src/v3/tests/object-in-es5-env.test.ts","line":12,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.object({}).safeParse({});"} {"repo":"zod","file":"packages/zod/src/v3/tests/object-in-es5-env.test.ts","line":19,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.object({}).safeParse({});"} {"repo":"zod","file":"packages/zod/src/v3/tests/object-in-es5-env.test.ts","line":26,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.object({}).safeParse({});"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":7,"symbol":"Test","kind":"constant","lang":"typescript","code":"const Test = z.object({\n f1: z.number(),\n f2: z.string().optional(),\n f3: z.string().nullable(),\n f4: z.array(z.object({ t: z.union([z.string(), z.boolean()]) })),\n});"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":15,"symbol":"TestType","kind":"type","lang":"typescript","code":"type TestType = {\n f1: number;\n f2?: string | undefined;\n f3: string | null;\n f4: { t: string | boolean }[];\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":26,"symbol":"asdf","kind":"constant","lang":"typescript","code":"const asdf: unknown = 35;"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":31,"symbol":"f1Schema","kind":"constant","lang":"typescript","code":"const f1Schema = Test.shape.f1;"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":32,"symbol":"f2Schema","kind":"constant","lang":"typescript","code":"const f2Schema = Test.shape.f2;"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":33,"symbol":"f3Schema","kind":"constant","lang":"typescript","code":"const f3Schema = Test.shape.f3;"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":34,"symbol":"f4Schema","kind":"constant","lang":"typescript","code":"const f4Schema = Test.shape.f4;"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":76,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = {\n points: 2314,\n unknown: \"asdf\",\n};"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":82,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = z.object({ points: z.number() }).parse(data);"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":87,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = z.object({ points: z.number() }).strict().passthrough().strip().nonstrict().parse(data);"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":93,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = z.object({ points: z.number() }).passthrough().parse(data);"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":99,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = z.object({ points: z.number() }).strip().parse(data);"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":105,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = z.object({ points: z.number() }).strict().safeParse(data);"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":111,"symbol":"o1","kind":"constant","lang":"typescript","code":"const o1 = z\n .object({\n first: z.string(),\n })\n .catchall(z.number());"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":117,"symbol":"d1","kind":"constant","lang":"typescript","code":"const d1 = o1.parse({ first: \"asdf\", num: 1243 });"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":123,"symbol":"o1","kind":"constant","lang":"typescript","code":"const o1 = z.object({ first: z.string().optional() }).strict().catchall(z.number());"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":138,"symbol":"o1","kind":"constant","lang":"typescript","code":"const o1 = z\n .object({\n first: z.string(),\n })\n .strict()\n .catchall(z.number());"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":153,"symbol":"SNamedEntity","kind":"constant","lang":"typescript","code":"const SNamedEntity = z.object({\n id: z.string(),\n set: z.string().optional(),\n unset: z.string().optional(),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":158,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = SNamedEntity.parse({\n id: \"asdf\",\n set: undefined,\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":167,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.object({ name: z.string() }).catchall(z.number()).parse({ name: \"Foo\", validExtraKey: 61 });"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":171,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = z\n .object({ name: z.string() })\n .catchall(z.number())\n .safeParse({ name: \"Foo\", validExtraKey: 61, invalid: \"asdf\" });"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":180,"symbol":"Schema","kind":"constant","lang":"typescript","code":"const Schema = z.union([z.object({ a: z.string() }), z.object({ b: z.number() })]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":181,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = { a: \"A\" };"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":182,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await Schema.spa(obj);"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":187,"symbol":"Schema2","kind":"constant","lang":"typescript","code":"const Schema2 = z.union([\n z.object({\n ty: z.string(),\n }),\n z.object({\n ty: z.number(),\n }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":196,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = { ty: \"A\" };"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":197,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await Schema2.spa(obj);"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":202,"symbol":"asdf","kind":"constant","lang":"typescript","code":"const asdf = z.object({ a: z.string() }).merge(z.object({ a: z.number() }));"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":203,"symbol":"asdf","kind":"type","lang":"typescript","code":"type asdf = z.infer<typeof asdf>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":208,"symbol":"Merged","kind":"constant","lang":"typescript","code":"const Merged = z\n .object({ a: z.string(), b: z.string().optional() })\n .merge(z.object({ a: z.string().optional(), b: z.string() }));"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":211,"symbol":"Merged","kind":"type","lang":"typescript","code":"type Merged = z.infer<typeof Merged>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":218,"symbol":"Unioned","kind":"constant","lang":"typescript","code":"const Unioned = z.union([\n z.object({ a: z.string(), b: z.string().optional() }),\n z.object({ a: z.string().optional(), b: z.string() }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":222,"symbol":"Unioned","kind":"type","lang":"typescript","code":"type Unioned = z.infer<typeof Unioned>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":227,"symbol":"Enum","kind":"constant","lang":"typescript","code":"const Enum = z.object({ a: z.string(), b: z.string().optional() }).keyof();"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":238,"symbol":"Enum","kind":"type","lang":"typescript","code":"type Enum = z.infer<typeof Enum>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":243,"symbol":"Partial","kind":"constant","lang":"typescript","code":"const Partial = z.object({ a: z.string(), b: z.string().optional() }).partial();"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":244,"symbol":"Partial","kind":"type","lang":"typescript","code":"type Partial = z.infer<typeof Partial>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":249,"symbol":"Picked","kind":"constant","lang":"typescript","code":"const Picked = z.object({ a: z.string(), b: z.string().optional() }).pick({ b: true });"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":250,"symbol":"Picked","kind":"type","lang":"typescript","code":"type Picked = z.infer<typeof Picked>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":255,"symbol":"myType","kind":"constant","lang":"typescript","code":"const myType = z.object({\n anyOptional: z.any().optional(),\n anyRequired: z.any(),\n unknownOptional: z.unknown().optional(),\n unknownRequired: z.unknown(),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":261,"symbol":"myType","kind":"type","lang":"typescript","code":"type myType = z.infer<typeof myType>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":274,"symbol":"base","kind":"constant","lang":"typescript","code":"const base = z.object({ name: z.string() });"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":275,"symbol":"withNewKey","kind":"constant","lang":"typescript","code":"const withNewKey = base.setKey(\"age\", z.number());"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":277,"symbol":"withNewKey","kind":"type","lang":"typescript","code":"type withNewKey = z.infer<typeof withNewKey>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":283,"symbol":"strictObj","kind":"constant","lang":"typescript","code":"const strictObj = z.strictObject({\n name: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":287,"symbol":"syncResult","kind":"constant","lang":"typescript","code":"const syncResult = strictObj.safeParse({ name: \"asdf\", unexpected: 13 });"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":290,"symbol":"asyncResult","kind":"constant","lang":"typescript","code":"const asyncResult = await strictObj.spa({ name: \"asdf\", unexpected: 13 });"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":295,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n a: z.string().default(\"foo\"),\n b: z.number(),\n })\n .refine(() => true);"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":302,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await schema.parseAsync({ b: 5 });"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":307,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n a: z.date(),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":313,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await schema.parseAsync({ a: new Date(1637353595983) });"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":318,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n a: z.date(),\n })\n .refine(() => true);"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":326,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await schema.parseAsync({ a: new Date(1637353595983) });"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":331,"symbol":"person","kind":"constant","lang":"typescript","code":"const person = z\n .object({\n name: z.string(),\n })\n .strict();"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":346,"symbol":"Example","kind":"constant","lang":"typescript","code":"const Example = z.object({\n prop: z.string(),\n opt: z.number().optional(),\n arr: z.string().array(),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":352,"symbol":"Example","kind":"type","lang":"typescript","code":"type Example = z.infer<typeof Example>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":358,"symbol":"schemaA","kind":"constant","lang":"typescript","doc":"This one is \"strict\"","code":"const schemaA = z\n .object({\n a: z.string(),\n })\n .strict();"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":365,"symbol":"schemaB","kind":"constant","lang":"typescript","doc":"This one is \"strip\"","code":"const schemaB = z\n .object({\n b: z.string(),\n })\n .catchall(z.string());"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":371,"symbol":"mergedSchema","kind":"constant","lang":"typescript","code":"const mergedSchema = schemaA.merge(schemaB);"} {"repo":"zod","file":"packages/zod/src/v3/tests/object.test.ts","line":372,"symbol":"mergedSchema","kind":"type","lang":"typescript","code":"type mergedSchema = typeof mergedSchema;"} {"repo":"zod","file":"packages/zod/src/v3/tests/optional.test.ts","line":6,"symbol":"checkErrors","kind":"function","lang":"typescript","code":"function checkErrors(a: z.ZodTypeAny, bad: any) {\n let expected: any;\n try {\n a.parse(bad);\n } catch (error) {\n expected = (error as z.ZodError).formErrors;\n }\n try {\n a.optional().parse(bad);\n } catch (error) {\n expect((error as z.ZodError).formErrors).toEqual(expected);\n }\n}"} {"repo":"zod","file":"packages/zod/src/v3/tests/optional.test.ts","line":40,"symbol":"unwrapped","kind":"constant","lang":"typescript","code":"const unwrapped = z.string().optional().unwrap();"} {"repo":"zod","file":"packages/zod/src/v3/tests/parseUtil.test.ts","line":8,"symbol":"aborted","kind":"constant","lang":"typescript","doc":"Test for issue #556: https://github.com/colinhacks/zod/issues/556","code":"const aborted: SyncParseReturnType = { status: \"aborted\" };"} {"repo":"zod","file":"packages/zod/src/v3/tests/parseUtil.test.ts","line":9,"symbol":"dirty","kind":"constant","lang":"typescript","code":"const dirty: SyncParseReturnType = { status: \"dirty\", value: \"whatever\" };"} {"repo":"zod","file":"packages/zod/src/v3/tests/parseUtil.test.ts","line":10,"symbol":"valid","kind":"constant","lang":"typescript","code":"const valid: SyncParseReturnType = { status: \"valid\", value: \"whatever\" };"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":8,"symbol":"nested","kind":"constant","lang":"typescript","code":"const nested = z.object({\n name: z.string(),\n age: z.number(),\n outer: z.object({\n inner: z.string(),\n }),\n array: z.array(z.object({ asdf: z.string() })),\n});"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":18,"symbol":"shallow","kind":"constant","lang":"typescript","code":"const shallow = nested.partial();"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":19,"symbol":"shallow","kind":"type","lang":"typescript","code":"type shallow = z.infer<typeof shallow>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":20,"symbol":"correct","kind":"type","lang":"typescript","code":"type correct = {\n name?: string | undefined;\n age?: number | undefined;\n outer?: { inner: string } | undefined;\n array?: { asdf: string }[] | undefined;\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":30,"symbol":"shallow","kind":"constant","lang":"typescript","code":"const shallow = nested.partial();"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":39,"symbol":"deep","kind":"constant","lang":"typescript","code":"const deep = nested.deepPartial();"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":40,"symbol":"asdf","kind":"constant","lang":"typescript","code":"const asdf = deep.shape.array.unwrap().element.shape.asdf.unwrap();"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":42,"symbol":"deep","kind":"type","lang":"typescript","code":"type deep = z.infer<typeof deep>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":43,"symbol":"correct","kind":"type","lang":"typescript","code":"type correct = {\n array?: { asdf?: string | undefined }[] | undefined;\n name?: string | undefined;\n age?: number | undefined;\n outer?: { inner?: string | undefined } | undefined;\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":54,"symbol":"deep","kind":"constant","lang":"typescript","code":"const deep = nested.deepPartial();"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":64,"symbol":"deep","kind":"constant","lang":"typescript","code":"const deep = nested.deepPartial();"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":79,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n name: z.string().optional(),\n age: z.number().nullable(),\n })\n .deepPartial();"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":91,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n tuple: z.tuple([\n z.object({\n name: z.string().optional(),\n age: z.number().nullable(),\n }),\n ]),\n })\n .deepPartial();"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":106,"symbol":"mySchema","kind":"constant","lang":"typescript","code":"const mySchema = z.object({\n name: z.string(),\n array: z.array(z.object({ asdf: z.string() })),\n tuple: z.tuple([z.object({ value: z.string() })]),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":112,"symbol":"partialed","kind":"constant","lang":"typescript","code":"const partialed = mySchema.deepPartial();"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":113,"symbol":"partialed","kind":"type","lang":"typescript","code":"type partialed = z.infer<typeof partialed>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":114,"symbol":"expected","kind":"type","lang":"typescript","code":"type expected = {\n name?: string | undefined;\n array?:\n | {\n asdf?: string | undefined;\n }[]\n | undefined;\n tuple?: [{ value?: string | undefined }] | undefined;\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":127,"symbol":"object","kind":"constant","lang":"typescript","code":"const object = z.object({\n name: z.string(),\n age: z.number().optional(),\n field: z.string().optional().default(\"asdf\"),\n nullableField: z.number().nullable(),\n nullishField: z.string().nullish(),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":135,"symbol":"requiredObject","kind":"constant","lang":"typescript","code":"const requiredObject = object.required();"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":144,"symbol":"object","kind":"constant","lang":"typescript","code":"const object = z.object({\n name: z.string(),\n age: z.number().optional(),\n field: z.string().optional().default(\"asdf\"),\n nullableField: z.number().nullable(),\n nullishField: z.string().nullish(),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":152,"symbol":"requiredObject","kind":"constant","lang":"typescript","code":"const requiredObject = object.required();"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":154,"symbol":"required","kind":"type","lang":"typescript","code":"type required = z.infer<typeof requiredObject>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":155,"symbol":"expected","kind":"type","lang":"typescript","code":"type expected = {\n name: string;\n age: number;\n field: string;\n nullableField: number | null;\n nullishField: string | null;\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":166,"symbol":"object","kind":"constant","lang":"typescript","code":"const object = z.object({\n name: z.string(),\n age: z.number().optional(),\n field: z.string().optional().default(\"asdf\"),\n country: z.string().optional(),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":173,"symbol":"requiredObject","kind":"constant","lang":"typescript","code":"const requiredObject = object.required({ age: true });"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":181,"symbol":"object","kind":"constant","lang":"typescript","code":"const object = z.object({\n name: z.string(),\n age: z.number().optional(),\n field: z.string().optional().default(\"asdf\"),\n country: z.string().optional(),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":189,"symbol":"requiredObject","kind":"constant","lang":"typescript","doc":"@ts-expect-error","code":"const requiredObject = object.required({ age: true, country: false });"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":197,"symbol":"object","kind":"constant","lang":"typescript","code":"const object = z.object({\n name: z.string(),\n age: z.number().optional(),\n field: z.string().optional().default(\"asdf\"),\n country: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":204,"symbol":"masked","kind":"constant","lang":"typescript","code":"const masked = object.partial({ age: true, field: true, name: true }).strict();"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":216,"symbol":"object","kind":"constant","lang":"typescript","code":"const object = z.object({\n name: z.string(),\n age: z.number().optional(),\n field: z.string().optional().default(\"asdf\"),\n country: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":224,"symbol":"masked","kind":"constant","lang":"typescript","doc":"@ts-expect-error","code":"const masked = object.partial({ name: true, country: false }).strict();"} {"repo":"zod","file":"packages/zod/src/v3/tests/partials.test.ts","line":236,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ array: z.string().array().min(42) }).deepPartial();"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":7,"symbol":"fish","kind":"constant","lang":"typescript","code":"const fish = z.object({\n name: z.string(),\n age: z.number(),\n nested: z.object({}),\n});"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":14,"symbol":"nameonlyFish","kind":"constant","lang":"typescript","code":"const nameonlyFish = fish.pick({ name: true });"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":15,"symbol":"nameonlyFish","kind":"type","lang":"typescript","code":"type nameonlyFish = z.infer<typeof nameonlyFish>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":20,"symbol":"nameonlyFish","kind":"constant","lang":"typescript","code":"const nameonlyFish = fish.pick({ name: true });"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":24,"symbol":"anotherNameonlyFish","kind":"constant","lang":"typescript","doc":"@ts-expect-error checking runtime picks `name` only.","code":"const anotherNameonlyFish = fish.pick({ name: true, age: false });"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":33,"symbol":"nameonlyFish","kind":"constant","lang":"typescript","code":"const nameonlyFish = fish.pick({ name: true }).strict();"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":34,"symbol":"bad1","kind":"constant","lang":"typescript","code":"const bad1 = () => nameonlyFish.parse({ name: 12 } as any);"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":35,"symbol":"bad2","kind":"constant","lang":"typescript","code":"const bad2 = () => nameonlyFish.parse({ name: \"bob\", age: 12 } as any);"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":36,"symbol":"bad3","kind":"constant","lang":"typescript","code":"const bad3 = () => nameonlyFish.parse({ age: 12 } as any);"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":39,"symbol":"anotherNameonlyFish","kind":"constant","lang":"typescript","doc":"@ts-expect-error checking runtime picks `name` only.","code":"const anotherNameonlyFish = fish.pick({ name: true, age: false }).strict();"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":40,"symbol":"bad4","kind":"constant","lang":"typescript","code":"const bad4 = () => anotherNameonlyFish.parse({ name: \"bob\", age: 12 } as any);"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":49,"symbol":"nonameFish","kind":"constant","lang":"typescript","code":"const nonameFish = fish.omit({ name: true });"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":50,"symbol":"nonameFish","kind":"type","lang":"typescript","code":"type nonameFish = z.infer<typeof nonameFish>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":55,"symbol":"nonameFish","kind":"constant","lang":"typescript","code":"const nonameFish = fish.omit({ name: true });"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":59,"symbol":"anotherNonameFish","kind":"constant","lang":"typescript","doc":"@ts-expect-error checking runtime omits `name` only.","code":"const anotherNonameFish = fish.omit({ name: true, age: false });"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":64,"symbol":"nonameFish","kind":"constant","lang":"typescript","code":"const nonameFish = fish.omit({ name: true });"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":65,"symbol":"bad1","kind":"constant","lang":"typescript","code":"const bad1 = () => nonameFish.parse({ name: 12 } as any);"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":66,"symbol":"bad2","kind":"constant","lang":"typescript","code":"const bad2 = () => nonameFish.parse({ age: 12 } as any);"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":67,"symbol":"bad3","kind":"constant","lang":"typescript","code":"const bad3 = () => nonameFish.parse({} as any);"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":70,"symbol":"anotherNonameFish","kind":"constant","lang":"typescript","doc":"@ts-expect-error checking runtime omits `name` only.","code":"const anotherNonameFish = fish.omit({ name: true, age: false });"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":71,"symbol":"bad4","kind":"constant","lang":"typescript","code":"const bad4 = () => anotherNonameFish.parse({ nested: {} } as any);"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":80,"symbol":"laxfish","kind":"constant","lang":"typescript","code":"const laxfish = fish.pick({ name: true }).catchall(z.any());"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":81,"symbol":"laxfish","kind":"type","lang":"typescript","code":"type laxfish = z.infer<typeof laxfish>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":86,"symbol":"laxfish","kind":"constant","lang":"typescript","code":"const laxfish = fish.passthrough().pick({ name: true });"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":92,"symbol":"laxfish","kind":"constant","lang":"typescript","code":"const laxfish = fish.passthrough().pick({ name: true });"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":93,"symbol":"bad","kind":"constant","lang":"typescript","code":"const bad = () => laxfish.parse({ whatever: \"asdf\" } as any);"} {"repo":"zod","file":"packages/zod/src/v3/tests/pickomit.test.ts","line":98,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n name: z.string(),\n age: z.number(),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/pipeline.test.ts","line":7,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().transform(Number).pipe(z.number());"} {"repo":"zod","file":"packages/zod/src/v3/tests/pipeline.test.ts","line":12,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .string()\n .transform(async (val) => Number(val))\n .pipe(z.number());"} {"repo":"zod","file":"packages/zod/src/v3/tests/pipeline.test.ts","line":20,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .string()\n .refine((c) => c === \"1234\")\n .transform(async (val) => Number(val))\n .pipe(z.number().refine((v) => v < 100));"} {"repo":"zod","file":"packages/zod/src/v3/tests/pipeline.test.ts","line":25,"symbol":"r1","kind":"constant","lang":"typescript","code":"const r1: any = schema.safeParse(\"12345\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/pipeline.test.ts","line":27,"symbol":"r2","kind":"constant","lang":"typescript","code":"const r2: any = schema.safeParse(\"3\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/preprocess.test.ts","line":8,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.preprocess((data) => [data], z.string().array());"} {"repo":"zod","file":"packages/zod/src/v3/tests/preprocess.test.ts","line":10,"symbol":"value","kind":"constant","lang":"typescript","code":"const value = schema.parse(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/preprocess.test.ts","line":16,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.preprocess(async (data) => [data], z.string().array());"} {"repo":"zod","file":"packages/zod/src/v3/tests/preprocess.test.ts","line":18,"symbol":"value","kind":"constant","lang":"typescript","code":"const value = await schema.parseAsync(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/preprocess.test.ts","line":78,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.preprocess(async (data, ctx) => {\n ctx.addIssue({\n code: \"custom\",\n message: `custom error`,\n });\n return data;\n }, z.string());"} {"repo":"zod","file":"packages/zod/src/v3/tests/preprocess.test.ts","line":101,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await z\n .preprocess(async (data, ctx) => {\n ctx.addIssue({\n code: \"custom\",\n message: `${data} is not one of our allowed strings`,\n });\n return data;\n }, z.string())\n .safeParseAsync(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/preprocess.test.ts","line":127,"symbol":"foo","kind":"constant","lang":"typescript","code":"const foo = z.preprocess((val, ctx) => {\n if (!val) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, message: \"bad\" });\n return z.NEVER;\n }\n return val;\n }, z.number());"} {"repo":"zod","file":"packages/zod/src/v3/tests/preprocess.test.ts","line":135,"symbol":"foo","kind":"type","lang":"typescript","code":"type foo = z.infer<typeof foo>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/preprocess.test.ts","line":137,"symbol":"arg","kind":"constant","lang":"typescript","code":"const arg = foo.safeParse(undefined);"} {"repo":"zod","file":"packages/zod/src/v3/tests/preprocess.test.ts","line":142,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n nonEmptyStr: z.string().min(1),\n positiveNum: z.preprocess((v) => Number(v), z.number().positive()),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/preprocess.test.ts","line":146,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({\n nonEmptyStr: \"\",\n positiveNum: \"\",\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":8,"symbol":"literalStringSchema","kind":"constant","lang":"typescript","code":"const literalStringSchema = z.literal(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":9,"symbol":"literalNumberSchema","kind":"constant","lang":"typescript","code":"const literalNumberSchema = z.literal(12);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":10,"symbol":"literalBooleanSchema","kind":"constant","lang":"typescript","code":"const literalBooleanSchema = z.literal(true);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":11,"symbol":"literalBigIntSchema","kind":"constant","lang":"typescript","code":"const literalBigIntSchema = z.literal(BigInt(42));"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":12,"symbol":"MySymbol","kind":"constant","lang":"typescript","code":"const MySymbol = Symbol(\"stuff\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":13,"symbol":"literalSymbolSchema","kind":"constant","lang":"typescript","code":"const literalSymbolSchema = z.literal(MySymbol);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":14,"symbol":"stringSchema","kind":"constant","lang":"typescript","code":"const stringSchema = z.string();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":15,"symbol":"numberSchema","kind":"constant","lang":"typescript","code":"const numberSchema = z.number();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":16,"symbol":"bigintSchema","kind":"constant","lang":"typescript","code":"const bigintSchema = z.bigint();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":17,"symbol":"booleanSchema","kind":"constant","lang":"typescript","code":"const booleanSchema = z.boolean();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":18,"symbol":"dateSchema","kind":"constant","lang":"typescript","code":"const dateSchema = z.date();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":19,"symbol":"symbolSchema","kind":"constant","lang":"typescript","code":"const symbolSchema = z.symbol();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":21,"symbol":"nullSchema","kind":"constant","lang":"typescript","code":"const nullSchema = z.null();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":22,"symbol":"undefinedSchema","kind":"constant","lang":"typescript","code":"const undefinedSchema = z.undefined();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":23,"symbol":"stringSchemaOptional","kind":"constant","lang":"typescript","code":"const stringSchemaOptional = z.string().optional();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":24,"symbol":"stringSchemaNullable","kind":"constant","lang":"typescript","code":"const stringSchemaNullable = z.string().nullable();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":25,"symbol":"numberSchemaOptional","kind":"constant","lang":"typescript","code":"const numberSchemaOptional = z.number().optional();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":26,"symbol":"numberSchemaNullable","kind":"constant","lang":"typescript","code":"const numberSchemaNullable = z.number().nullable();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":27,"symbol":"bigintSchemaOptional","kind":"constant","lang":"typescript","code":"const bigintSchemaOptional = z.bigint().optional();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":28,"symbol":"bigintSchemaNullable","kind":"constant","lang":"typescript","code":"const bigintSchemaNullable = z.bigint().nullable();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":29,"symbol":"booleanSchemaOptional","kind":"constant","lang":"typescript","code":"const booleanSchemaOptional = z.boolean().optional();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":30,"symbol":"booleanSchemaNullable","kind":"constant","lang":"typescript","code":"const booleanSchemaNullable = z.boolean().nullable();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":31,"symbol":"dateSchemaOptional","kind":"constant","lang":"typescript","code":"const dateSchemaOptional = z.date().optional();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":32,"symbol":"dateSchemaNullable","kind":"constant","lang":"typescript","code":"const dateSchemaNullable = z.date().nullable();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":33,"symbol":"symbolSchemaOptional","kind":"constant","lang":"typescript","code":"const symbolSchemaOptional = z.symbol().optional();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":34,"symbol":"symbolSchemaNullable","kind":"constant","lang":"typescript","code":"const symbolSchemaNullable = z.symbol().nullable();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":36,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = new Mocker();"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":43,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => literalStringSchema.parse(\"not_asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":48,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => literalStringSchema.parse(123);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":53,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => literalStringSchema.parse(true);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":58,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => literalStringSchema.parse(true);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":63,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => literalStringSchema.parse({});"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":72,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => literalNumberSchema.parse(13);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":77,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => literalNumberSchema.parse(val.string);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":82,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => literalNumberSchema.parse(val.boolean);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":87,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => literalStringSchema.parse({});"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":96,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => literalBooleanSchema.parse(false);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":101,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => literalBooleanSchema.parse(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":106,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => literalBooleanSchema.parse(123);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":111,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => literalBooleanSchema.parse({});"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":120,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => literalBigIntSchema.parse(BigInt(43));"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":125,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => literalBigIntSchema.parse(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":130,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => literalBigIntSchema.parse(123);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":135,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => literalBigIntSchema.parse({});"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":150,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => stringSchema.parse(val.number);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":155,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => stringSchema.parse(val.boolean);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":160,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => stringSchema.parse(val.undefined);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":165,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => stringSchema.parse(val.null);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":170,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => numberSchema.parse(val.string);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":179,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => numberSchema.parse(val.bigint);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":184,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => numberSchema.parse(val.boolean);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":189,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => numberSchema.parse(val.undefined);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":194,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => numberSchema.parse(val.null);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":199,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => bigintSchema.parse(val.string);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":204,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => bigintSchema.parse(val.number);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":213,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => bigintSchema.parse(val.boolean);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":218,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => bigintSchema.parse(val.undefined);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":223,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => bigintSchema.parse(val.null);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":228,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => booleanSchema.parse(val.string);"} {"repo":"zod","file":"packages/zod/src/v3/tests/primitive.test.ts","line":233,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = () => booleanSchema.parse(val.number);"} {"repo":"zod","file":"packages/zod/src/v3/tests/promise.test.ts","line":7,"symbol":"promSchema","kind":"constant","lang":"typescript","code":"const promSchema = z.promise(\n z.object({\n name: z.string(),\n age: z.number(),\n })\n);"} {"repo":"zod","file":"packages/zod/src/v3/tests/promise.test.ts","line":15,"symbol":"promSchemaType","kind":"type","lang":"typescript","code":"type promSchemaType = z.infer<typeof promSchema>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/promise.test.ts","line":20,"symbol":"pr","kind":"constant","lang":"typescript","code":"const pr = promSchema.parse(Promise.resolve({ name: \"Bobby\", age: 10 }));"} {"repo":"zod","file":"packages/zod/src/v3/tests/promise.test.ts","line":22,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await pr;"} {"repo":"zod","file":"packages/zod/src/v3/tests/promise.test.ts","line":29,"symbol":"fakePromise","kind":"constant","lang":"typescript","code":"const fakePromise = {\n then() {\n return this;\n },\n catch() {\n return this;\n },\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/promise.test.ts","line":30,"symbol":"then","kind":"method","lang":"typescript","code":"then() {\n return this;\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/promise.test.ts","line":33,"symbol":"catch","kind":"method","lang":"typescript","code":"catch() {\n return this;\n }"} {"repo":"zod","file":"packages/zod/src/v3/tests/promise.test.ts","line":41,"symbol":"bad","kind":"constant","lang":"typescript","code":"const bad = promSchema.parse(Promise.resolve({ name: \"Bobby\", age: \"10\" }));"} {"repo":"zod","file":"packages/zod/src/v3/tests/promise.test.ts","line":48,"symbol":"failPromise","kind":"constant","lang":"typescript","code":"const failPromise = promSchema.parse(Promise.resolve({ name: \"Bobby\", age: \"10\" }));"} {"repo":"zod","file":"packages/zod/src/v3/tests/promise.test.ts","line":54,"symbol":"bad","kind":"constant","lang":"typescript","code":"const bad = () => promSchema.parse({ then: () => {}, catch: {} });"} {"repo":"zod","file":"packages/zod/src/v3/tests/promise.test.ts","line":62,"symbol":"asyncFunction","kind":"constant","lang":"typescript","code":"const asyncFunction = z.function(z.tuple([]), promSchema);"} {"repo":"zod","file":"packages/zod/src/v3/tests/promise.test.ts","line":65,"symbol":"validatedFunction","kind":"constant","lang":"typescript","code":"const validatedFunction = asyncFunction.implement(async () => {\n return { name: \"jimmy\", age: 14 };\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/promise.test.ts","line":75,"symbol":"validatedFunction","kind":"constant","lang":"typescript","code":"const validatedFunction = asyncFunction.implement(() => {\n return Promise.resolve(\"asdf\" as any);\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/promise.test.ts","line":82,"symbol":"res","kind":"constant","lang":"typescript","code":"const res = z.promise(z.number()).parseAsync(Promise.resolve(12));"} {"repo":"zod","file":"packages/zod/src/v3/tests/promise.test.ts","line":87,"symbol":"foo","kind":"constant","lang":"typescript","code":"const foo = z.literal(\"foo\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/promise.test.ts","line":88,"symbol":"res","kind":"constant","lang":"typescript","code":"const res = z.promise(foo);"} {"repo":"zod","file":"packages/zod/src/v3/tests/readonly.test.ts","line":7,"symbol":"testEnum","kind":"type","lang":"typescript","code":"enum testEnum {\n A = 0,\n B = 1,\n}"} {"repo":"zod","file":"packages/zod/src/v3/tests/readonly.test.ts","line":12,"symbol":"schemas","kind":"constant","lang":"typescript","code":"const schemas = [\n z.string().readonly(),\n z.number().readonly(),\n z.nan().readonly(),\n z.bigint().readonly(),\n z.boolean().readonly(),\n z.date().readonly(),\n z.undefined().readonly(),\n z.null().readonly(),\n z.any().readonly(),\n z.unknown().readonly(),\n z.void().readonly(),\n z.function().args(z.string(), z.number()).readonly(),\n\n z.array(z.string()).readonly(),\n z.tuple([z.string(), z.number()]).readonly(),\n z.map(z.string(), z.date()).readonly(),\n z.set(z.promise(z.string())).readonly(),\n z.record(z.string()).readonly(),\n z.record(z.string(), z.number()).readonly(),\n z.object({ a: z.string(), 1: z.number() }).readonly(),\n z.nativeEnum(testEnum).readonly(),\n z.promise(z.string()).readonly(),\n] as const;"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":7,"symbol":"booleanRecord","kind":"constant","lang":"typescript","code":"const booleanRecord = z.record(z.boolean());"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":8,"symbol":"booleanRecord","kind":"type","lang":"typescript","code":"type booleanRecord = z.infer<typeof booleanRecord>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":10,"symbol":"recordWithEnumKeys","kind":"constant","lang":"typescript","code":"const recordWithEnumKeys = z.record(z.enum([\"Tuna\", \"Salmon\"]), z.string());"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":11,"symbol":"recordWithEnumKeys","kind":"type","lang":"typescript","code":"type recordWithEnumKeys = z.infer<typeof recordWithEnumKeys>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":13,"symbol":"recordWithLiteralKeys","kind":"constant","lang":"typescript","code":"const recordWithLiteralKeys = z.record(z.union([z.literal(\"Tuna\"), z.literal(\"Salmon\")]), z.string());"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":14,"symbol":"recordWithLiteralKeys","kind":"type","lang":"typescript","code":"type recordWithLiteralKeys = z.infer<typeof recordWithLiteralKeys>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":38,"symbol":"badCheck","kind":"constant","lang":"typescript","code":"const badCheck = () =>\n booleanRecord.parse({\n asdf: 1234,\n } as any);"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":48,"symbol":"badCheck","kind":"constant","lang":"typescript","code":"const badCheck = () =>\n booleanRecord.parse({\n asdf: {},\n } as any);"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":56,"symbol":"badCheck","kind":"constant","lang":"typescript","code":"const badCheck = () =>\n booleanRecord.parse({\n asdf: [],\n } as any);"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":64,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = recordWithEnumKeys.parse({\n Tuna: \"asdf\",\n Salmon: \"asdf\",\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":73,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = recordWithLiteralKeys.parse({\n Tuna: \"asdf\",\n Salmon: \"asdf\",\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":83,"symbol":"result3","kind":"constant","lang":"typescript","doc":"shouldn't require us to specify all props in record","code":"const result3 = recordWithEnumKeys.parse({\n Tuna: \"abcd\",\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":91,"symbol":"result4","kind":"constant","lang":"typescript","doc":"shouldn't require us to specify all props in record","code":"const result4 = recordWithLiteralKeys.parse({\n Salmon: \"abcd\",\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":121,"symbol":"rec","kind":"constant","lang":"typescript","code":"const rec = z.record(z.string(), z.number());"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":129,"symbol":"rec","kind":"constant","lang":"typescript","code":"const rec = z.record(\n z.object({\n a: z.string(),\n })\n );"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":135,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = JSON.parse(`\n {\n \"__proto__\": {\n \"a\": \"evil\"\n },\n \"b\": {\n \"a\": \"good\"\n }\n }\n `);"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":146,"symbol":"obj1","kind":"constant","lang":"typescript","code":"const obj1 = rec.parse(data);"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":149,"symbol":"obj2","kind":"constant","lang":"typescript","code":"const obj2 = rec.safeParse(data);"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":155,"symbol":"obj3","kind":"constant","lang":"typescript","code":"const obj3 = await rec.parseAsync(data);"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":158,"symbol":"obj4","kind":"constant","lang":"typescript","code":"const obj4 = await rec.safeParseAsync(data);"} {"repo":"zod","file":"packages/zod/src/v3/tests/record.test.ts","line":166,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = z.record(z.any()).parse({ foo: undefined });"} {"repo":"zod","file":"packages/zod/src/v3/tests/recursive.test.ts","line":6,"symbol":"Category","kind":"interface","lang":"typescript","code":"interface Category {\n name: string;\n subcategories: Category[];\n}"} {"repo":"zod","file":"packages/zod/src/v3/tests/recursive.test.ts","line":11,"symbol":"testCategory","kind":"constant","lang":"typescript","code":"const testCategory: Category = {\n name: \"I\",\n subcategories: [\n {\n name: \"A\",\n subcategories: [\n {\n name: \"1\",\n subcategories: [\n {\n name: \"a\",\n subcategories: [],\n },\n ],\n },\n ],\n },\n ],\n};"} {"repo":"zod","file":"packages/zod/src/v3/tests/recursive.test.ts","line":32,"symbol":"Category","kind":"constant","lang":"typescript","code":"const Category: z.ZodType<Category> = z.late.object(() => ({\n name: z.string(),\n subcategories: z.array(Category),\n }));"} {"repo":"zod","file":"packages/zod/src/v3/tests/recursive.test.ts","line":40,"symbol":"Category","kind":"constant","lang":"typescript","code":"const Category: z.ZodType<Category> = z.lazy(() =>\n z.object({\n name: z.string(),\n subcategories: z.array(Category),\n })\n );"} {"repo":"zod","file":"packages/zod/src/v3/tests/recursive.test.ts","line":53,"symbol":"LinkedList","kind":"type","lang":"typescript","code":"type LinkedList = null | { value: number; next: LinkedList };"} {"repo":"zod","file":"packages/zod/src/v3/tests/recursive.test.ts","line":55,"symbol":"linkedListExample","kind":"constant","lang":"typescript","code":"const linkedListExample = {\n value: 1,\n next: {\n value: 2,\n next: {\n value: 3,\n next: {\n value: 4,\n next: null,\n },\n },\n },\n};"} {"repo":"zod","file":"packages/zod/src/v3/tests/recursive.test.ts","line":70,"symbol":"LinkedListSchema","kind":"constant","lang":"typescript","code":"const LinkedListSchema: z.ZodType<LinkedList> = z.lazy(() =>\n z.union([\n z.null(),\n z.object({\n value: z.number(),\n next: LinkedListSchema,\n }),\n ])\n );"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":9,"symbol":"obj1","kind":"constant","lang":"typescript","code":"const obj1 = z.object({\n first: z.string(),\n second: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":13,"symbol":"obj2","kind":"constant","lang":"typescript","code":"const obj2 = obj1.partial().strict();"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":15,"symbol":"obj3","kind":"constant","lang":"typescript","code":"const obj3 = obj2.refine((data) => data.first || data.second, \"Either first or second should be filled in.\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":29,"symbol":"validationSchema","kind":"constant","lang":"typescript","code":"const validationSchema = z\n .object({\n email: z.string().email(),\n password: z.string(),\n confirmPassword: z.string(),\n })\n .refine((data) => data.password === data.confirmPassword, \"Both password and confirmation must match\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":47,"symbol":"validationSchema","kind":"constant","lang":"typescript","code":"const validationSchema = z.object({\n a: z.string().refine((s): s is \"a\" => s === \"a\"),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":50,"symbol":"Input","kind":"type","lang":"typescript","code":"type Input = z.input<typeof validationSchema>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":51,"symbol":"Schema","kind":"type","lang":"typescript","code":"type Schema = z.infer<typeof validationSchema>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":61,"symbol":"validationSchema","kind":"constant","lang":"typescript","code":"const validationSchema = z\n .object({\n email: z.string().email(),\n password: z.string(),\n confirmPassword: z.string(),\n })\n .refine(\n (data) => Promise.resolve().then(() => data.password === data.confirmPassword),\n \"Both password and confirmation must match\"\n );"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":80,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await z\n .object({\n password: z.string(),\n confirm: z.string(),\n })\n .refine((data) => data.confirm === data.password, { path: [\"confirm\"] })\n .spa({ password: \"asdf\", confirm: \"qewr\" });"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":94,"symbol":"noNested","kind":"constant","lang":"typescript","code":"const noNested = z.string()._refinement((_val, ctx) => {\n if (ctx.path.length > 0) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `schema cannot be nested. path: ${ctx.path.join(\".\")}`,\n });\n return false;\n } else {\n return true;\n }\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":106,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = z.object({\n foo: noNested,\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":110,"symbol":"t1","kind":"constant","lang":"typescript","code":"const t1 = await noNested.spa(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":111,"symbol":"t2","kind":"constant","lang":"typescript","code":"const t2 = await data.spa({ foo: \"asdf\" });"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":121,"symbol":"Strings","kind":"constant","lang":"typescript","code":"const Strings = z.array(z.string()).superRefine((val, ctx) => {\n if (val.length > 3) {\n ctx.addIssue({\n code: z.ZodIssueCode.too_big,\n maximum: 3,\n type: \"array\",\n inclusive: true,\n exact: true,\n message: \"Too many items 😡\",\n });\n }\n\n if (val.length !== new Set(val).size) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `No duplicates allowed.`,\n });\n }\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":141,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = Strings.safeParse([\"asfd\", \"asfd\", \"asfd\", \"asfd\"]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":150,"symbol":"Strings","kind":"constant","lang":"typescript","code":"const Strings = z.array(z.string()).superRefine(async (val, ctx) => {\n if (val.length > 3) {\n ctx.addIssue({\n code: z.ZodIssueCode.too_big,\n maximum: 3,\n type: \"array\",\n inclusive: true,\n exact: true,\n message: \"Too many items 😡\",\n });\n }\n\n if (val.length !== new Set(val).size) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `No duplicates allowed.`,\n });\n }\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":170,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await Strings.safeParseAsync([\"asfd\", \"asfd\", \"asfd\", \"asfd\"]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":179,"symbol":"NarrowType","kind":"type","lang":"typescript","code":"type NarrowType = { type: string; age: number };"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":180,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n type: z.string(),\n age: z.number(),\n })\n .nullable()\n .superRefine((arg, ctx): arg is NarrowType => {\n if (!arg) {\n // still need to make a call to ctx.addIssue\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: \"cannot be null\",\n fatal: true,\n });\n return false;\n }\n return true;\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":206,"symbol":"firstRefinement","kind":"type","lang":"typescript","code":"type firstRefinement = { first: string; second: number; third: true };"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":207,"symbol":"secondRefinement","kind":"type","lang":"typescript","code":"type secondRefinement = { first: \"bob\"; second: number; third: true };"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":208,"symbol":"thirdRefinement","kind":"type","lang":"typescript","code":"type thirdRefinement = { first: \"bob\"; second: 33; third: true };"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":209,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n first: z.string(),\n second: z.number(),\n third: z.boolean(),\n })\n .nullable()\n .refine((arg): arg is firstRefinement => !!arg?.third)\n .superRefine((arg, ctx): arg is secondRefinement => {\n util.assertEqual<typeof arg, firstRefinement>(true);\n if (arg.first !== \"bob\") {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: \"`first` property must be `bob`\",\n });\n return false;\n }\n return true;\n })\n .refine((arg): arg is thirdRefinement => {\n util.assertEqual<typeof arg, secondRefinement>(true);\n return arg.second === 33;\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":244,"symbol":"objectSchema","kind":"constant","lang":"typescript","code":"const objectSchema = z\n .object({\n length: z.number(),\n size: z.number(),\n })\n .refine(({ length }) => length > 5, {\n path: [\"length\"],\n message: \"length greater than 5\",\n })\n .refine(({ size }) => size > 7, {\n path: [\"size\"],\n message: \"size greater than 7\",\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":257,"symbol":"r1","kind":"constant","lang":"typescript","code":"const r1 = objectSchema.safeParse({\n length: 4,\n size: 9,\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":264,"symbol":"r2","kind":"constant","lang":"typescript","code":"const r2 = objectSchema.safeParse({\n length: 4,\n size: 3,\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":273,"symbol":"Strings","kind":"constant","lang":"typescript","code":"const Strings = z\n .string()\n .superRefine((val, ctx) => {\n if (val === \"\") {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: \"foo\",\n fatal: true,\n });\n }\n })\n .superRefine((val, ctx) => {\n if (val !== \" \") {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: \"bar\",\n });\n }\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":293,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = Strings.safeParse(\"\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":300,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .string()\n .regex(/^\\d+$/)\n .transform((val) => Number(val))\n .superRefine((val) => {\n if (typeof val !== \"number\") {\n throw new Error(\"Called without transform\");\n }\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/refine.test.ts","line":310,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/safeparse.test.ts","line":5,"symbol":"stringSchema","kind":"constant","lang":"typescript","code":"const stringSchema = z.string();"} {"repo":"zod","file":"packages/zod/src/v3/tests/safeparse.test.ts","line":8,"symbol":"safe","kind":"constant","lang":"typescript","code":"const safe = stringSchema.safeParse(12);"} {"repo":"zod","file":"packages/zod/src/v3/tests/safeparse.test.ts","line":14,"symbol":"safe","kind":"constant","lang":"typescript","code":"const safe = stringSchema.safeParse(\"12\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":8,"symbol":"stringSet","kind":"constant","lang":"typescript","code":"const stringSet = z.set(z.string());"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":9,"symbol":"stringSet","kind":"type","lang":"typescript","code":"type stringSet = z.infer<typeof stringSet>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":11,"symbol":"minTwo","kind":"constant","lang":"typescript","code":"const minTwo = z.set(z.string()).min(2);"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":12,"symbol":"maxTwo","kind":"constant","lang":"typescript","code":"const maxTwo = z.set(z.string()).max(2);"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":13,"symbol":"justTwo","kind":"constant","lang":"typescript","code":"const justTwo = z.set(z.string()).size(2);"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":14,"symbol":"nonEmpty","kind":"constant","lang":"typescript","code":"const nonEmpty = z.set(z.string()).nonempty();"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":15,"symbol":"nonEmptyMax","kind":"constant","lang":"typescript","code":"const nonEmptyMax = z.set(z.string()).nonempty().max(2);"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":22,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringSet.safeParse(new Set([\"first\", \"second\"]));"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":42,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await stringSet.spa(new Set([\"first\", \"second\"]));"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":50,"symbol":"asyncResult","kind":"constant","lang":"typescript","code":"const asyncResult = await stringSet.safeParse(new Set([\"first\", \"second\"]));"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":70,"symbol":"sizeZeroResult","kind":"constant","lang":"typescript","code":"const sizeZeroResult = stringSet.parse(new Set());"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":73,"symbol":"sizeTwoResult","kind":"constant","lang":"typescript","code":"const sizeTwoResult = minTwo.parse(new Set([\"a\", \"b\"]));"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":78,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = nonEmpty.safeParse(new Set());"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":88,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = minTwo.safeParse(new Set([\"just_one\"]));"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":98,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = maxTwo.safeParse(new Set([\"one\", \"two\", \"three\"]));"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":108,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringSet.safeParse(new Set([]));"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":113,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringSet.safeParse(new Map([]));"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":122,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringSet.safeParse(new Set([Symbol()]));"} {"repo":"zod","file":"packages/zod/src/v3/tests/set.test.ts","line":132,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringSet.safeParse(new Set([1, 2] as any[]) as Set<any>);"} {"repo":"zod","file":"packages/zod/src/v3/tests/standard-schema.test.ts","line":10,"symbol":"_s1","kind":"constant","lang":"typescript","code":"const _s1: StandardSchemaV1 = z.string();"} {"repo":"zod","file":"packages/zod/src/v3/tests/standard-schema.test.ts","line":11,"symbol":"_s2","kind":"constant","lang":"typescript","code":"const _s2: StandardSchemaV1<string> = z.string();"} {"repo":"zod","file":"packages/zod/src/v3/tests/standard-schema.test.ts","line":12,"symbol":"_s3","kind":"constant","lang":"typescript","code":"const _s3: StandardSchemaV1<string, string> = z.string();"} {"repo":"zod","file":"packages/zod/src/v3/tests/standard-schema.test.ts","line":13,"symbol":"_s4","kind":"constant","lang":"typescript","code":"const _s4: StandardSchemaV1<unknown, string> = z.string();"} {"repo":"zod","file":"packages/zod/src/v3/tests/standard-schema.test.ts","line":18,"symbol":"stringToNumber","kind":"constant","lang":"typescript","code":"const stringToNumber = z.string().transform((x) => x.length);"} {"repo":"zod","file":"packages/zod/src/v3/tests/standard-schema.test.ts","line":19,"symbol":"input","kind":"type","lang":"typescript","code":"type input = StandardSchemaV1.InferInput<typeof stringToNumber>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/standard-schema.test.ts","line":21,"symbol":"output","kind":"type","lang":"typescript","code":"type output = StandardSchemaV1.InferOutput<typeof stringToNumber>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/standard-schema.test.ts","line":26,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v3/tests/standard-schema.test.ts","line":27,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema[\"~standard\"].validate(\"hello\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/standard-schema.test.ts","line":40,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v3/tests/standard-schema.test.ts","line":41,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema[\"~standard\"].validate(1234);"} {"repo":"zod","file":"packages/zod/src/v3/tests/standard-schema.test.ts","line":54,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().refine(async () => true);"} {"repo":"zod","file":"packages/zod/src/v3/tests/standard-schema.test.ts","line":55,"symbol":"_result","kind":"constant","lang":"typescript","code":"const _result = schema[\"~standard\"].validate(\"hello\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/standard-schema.test.ts","line":57,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await _result;"} {"repo":"zod","file":"packages/zod/src/v3/tests/standard-schema.test.ts","line":70,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().refine(async () => false);"} {"repo":"zod","file":"packages/zod/src/v3/tests/standard-schema.test.ts","line":71,"symbol":"_result","kind":"constant","lang":"typescript","code":"const _result = schema[\"~standard\"].validate(\"hello\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/standard-schema.test.ts","line":73,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await _result;"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":7,"symbol":"minFive","kind":"constant","lang":"typescript","code":"const minFive = z.string().min(5, \"min5\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":8,"symbol":"maxFive","kind":"constant","lang":"typescript","code":"const maxFive = z.string().max(5, \"max5\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":9,"symbol":"justFive","kind":"constant","lang":"typescript","code":"const justFive = z.string().length(5);"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":10,"symbol":"nonempty","kind":"constant","lang":"typescript","code":"const nonempty = z.string().nonempty(\"nonempty\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":11,"symbol":"includes","kind":"constant","lang":"typescript","code":"const includes = z.string().includes(\"includes\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":12,"symbol":"includesFromIndex2","kind":"constant","lang":"typescript","code":"const includesFromIndex2 = z.string().includes(\"includes\", { position: 2 });"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":13,"symbol":"startsWith","kind":"constant","lang":"typescript","code":"const startsWith = z.string().startsWith(\"startsWith\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":14,"symbol":"endsWith","kind":"constant","lang":"typescript","code":"const endsWith = z.string().endsWith(\"endsWith\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":42,"symbol":"validEmails","kind":"constant","lang":"typescript","code":"const validEmails = [\n `email@domain.com`,\n `firstname.lastname@domain.com`,\n `email@subdomain.domain.com`,\n `firstname+lastname@domain.com`,\n `1234567890@domain.com`,\n `email@domain-one.com`,\n `_______@domain.com`,\n `email@domain.name`,\n `email@domain.co.jp`,\n `firstname-lastname@domain.com`,\n `very.common@example.com`,\n `disposable.style.email.with+symbol@example.com`,\n `other.email-with-hyphen@example.com`,\n `fully-qualified-domain@example.com`,\n `user.name+tag+sorting@example.com`,\n `x@example.com`,\n `mojojojo@asdf.example.com`,\n `example-indeed@strange-example.com`,\n `example@s.example`,\n `user-@example.org`,\n `user@my-example.com`,\n `a@b.cd`,\n `work+user@mail.com`,\n `tom@test.te-st.com`,\n `something@subdomain.domain-with-hyphens.tld`,\n `common'name@domain.com`,\n `francois@etu.inp-n7.fr`,\n ];"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":71,"symbol":"invalidEmails","kind":"constant","lang":"typescript","code":"const invalidEmails = [\n // no \"printable characters\"\n // `user%example.com@example.org`,\n // `mailhost!username@example.org`,\n // `test/test@test.com`,\n\n // double @\n `francois@@etu.inp-n7.fr`,\n // do not support quotes\n `\"email\"@domain.com`,\n `\"e asdf sadf ?<>ail\"@domain.com`,\n `\" \"@example.org`,\n `\"john..doe\"@example.org`,\n `\"very.(),:;<>[]\\\".VERY.\\\"very@\\\\ \\\"very\\\".unusual\"@strange.example.com`,\n // do not support comma\n `a,b@domain.com`,\n\n // do not support IPv4\n `email@123.123.123.123`,\n `email@[123.123.123.123]`,\n `postmaster@123.123.123.123`,\n `user@[68.185.127.196]`,\n `ipv4@[85.129.96.247]`,\n `valid@[79.208.229.53]`,\n `valid@[255.255.255.255]`,\n `valid@[255.0.55.2]`,\n `valid@[255.0.55.2]`,\n\n // do not support ipv6\n `hgrebert0@[IPv6:4dc8:ac7:ce79:8878:1290:6098:5c50:1f25]`,\n `bshapiro4@[IPv6:3669:c709:e981:4884:59a3:75d1:166b:9ae]`,\n `jsmith@[IPv6:2001:db8::1]`,\n `postmaster@[IPv6:2001:0db8:85a3:0000:0000:8a2e:0370:7334]`,\n `postmaster@[IPv6:2001:0db8:85a3:0000:0000:8a2e:0370:192.168.1.1]`,\n\n // microsoft test cases\n `plainaddress`,\n `#@%^%#$@#$@#.com`,\n `@domain.com`,\n "} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":154,"symbol":"emailSchema","kind":"constant","lang":"typescript","code":"const emailSchema = z.string().email();"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":168,"symbol":"validBase64Strings","kind":"constant","lang":"typescript","code":"const validBase64Strings = [\n \"SGVsbG8gV29ybGQ=\", // \"Hello World\"\n \"VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==\", // \"This is an encoded string\"\n \"TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcms=\", // \"Many hands make light work\"\n \"UGF0aWVuY2UgaXMgdGhlIGtleSB0byBzdWNjZXNz\", // \"Patience is the key to success\"\n \"QmFzZTY0IGVuY29kaW5nIGlzIGZ1bg==\", // \"Base64 encoding is fun\"\n \"MTIzNDU2Nzg5MA==\", // \"1234567890\"\n \"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo=\", // \"abcdefghijklmnopqrstuvwxyz\"\n \"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo=\", // \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n \"ISIkJSMmJyonKCk=\", // \"!\\\"#$%&'()*\"\n \"\", // Empty string is technically valid base64\n \"w7/Dv8O+w74K\", // ÿÿþþ\n];"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":188,"symbol":"invalidBase64Strings","kind":"constant","lang":"typescript","code":"const invalidBase64Strings = [\n \"12345\", // Not padded correctly, not a multiple of 4 characters\n \"12345===\", // Not padded correctly\n \"SGVsbG8gV29ybGQ\", // Missing padding\n \"VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw\", // Missing padding\n \"!UGF0aWVuY2UgaXMgdGhlIGtleSB0byBzdWNjZXNz\", // Invalid character '!'\n \"?QmFzZTY0IGVuY29kaW5nIGlzIGZ1bg==\", // Invalid character '?'\n \".MTIzND2Nzg5MC4=\", // Invalid character '.'\n \"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo\", // Missing padding\n \"w7_Dv8O-w74K\", // Has - and _ characters (is base64url)\n];"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":206,"symbol":"validBase64URLStrings","kind":"constant","lang":"typescript","code":"const validBase64URLStrings = [\n \"SGVsbG8gV29ybGQ\", // \"Hello World\"\n \"SGVsbG8gV29ybGQ=\", // \"Hello World\" with padding\n \"VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw\", // \"This is an encoded string\"\n \"VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==\", // \"This is an encoded string\" with padding\n \"TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcms\", // \"Many hands make light work\"\n \"TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcms=\", // \"Many hands make light work\" with padding\n \"UGF0aWVuY2UgaXMgdGhlIGtleSB0byBzdWNjZXNz\", // \"Patience is the key to success\"\n \"QmFzZTY0IGVuY29kaW5nIGlzIGZ1bg\", // \"Base64 encoding is fun\"\n \"QmFzZTY0IGVuY29kaW5nIGlzIGZ1bg==\", // \"Base64 encoding is fun\" with padding\n \"MTIzNDU2Nzg5MA\", // \"1234567890\"\n \"MTIzNDU2Nzg5MA==\", // \"1234567890\" with padding\n \"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo\", // \"abcdefghijklmnopqrstuvwxyz\"\n \"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo=\", // \"abcdefghijklmnopqrstuvwxyz with padding\"\n \"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo\", // \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n \"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo=\", // \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" with padding\n \"ISIkJSMmJyonKCk\", // \"!\\\"#$%&'()*\"\n \"ISIkJSMmJyonKCk=\", // \"!\\\"#$%&'()*\" with padding\n \"\", // Empty string is technically va"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":235,"symbol":"invalidBase64URLStrings","kind":"constant","lang":"typescript","code":"const invalidBase64URLStrings = [\n \"w7/Dv8O+w74K\", // Has + and / characters (is base64)\n \"12345\", // Invalid length (not a multiple of 4 characters when adding allowed number of padding characters)\n \"12345===\", // Not padded correctly\n \"!UGF0aWVuY2UgaXMgdGhlIGtleSB0byBzdWNjZXNz\", // Invalid character '!'\n \"?QmFzZTY0IGVuY29kaW5nIGlzIGZ1bg==\", // Invalid character '?'\n \".MTIzND2Nzg5MC4=\", // Invalid character '.'\n];"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":250,"symbol":"makeJwt","kind":"function","lang":"typescript","code":"function makeJwt(header: object, payload: object) {\n const headerBase64 = Buffer.from(JSON.stringify(header)).toString(\"base64url\");\n const payloadBase64 = Buffer.from(JSON.stringify(payload)).toString(\"base64url\");\n const signature = \"signature\"; // Placeholder for the signature\n return `${headerBase64}.${payloadBase64}.${signature}`;\n}"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":251,"symbol":"headerBase64","kind":"constant","lang":"typescript","code":"const headerBase64 = Buffer.from(JSON.stringify(header)).toString(\"base64url\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":252,"symbol":"payloadBase64","kind":"constant","lang":"typescript","code":"const payloadBase64 = Buffer.from(JSON.stringify(payload)).toString(\"base64url\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":253,"symbol":"signature","kind":"constant","lang":"typescript","code":"const signature = \"signature\";"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":258,"symbol":"jwt","kind":"constant","lang":"typescript","code":"const jwt = z.string().jwt();"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":259,"symbol":"jwtWithAlg","kind":"constant","lang":"typescript","code":"const jwtWithAlg = z.string().jwt({ alg: \"HS256\" });"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":266,"symbol":"d1","kind":"constant","lang":"typescript","doc":"Valid JWTs","code":"const d1 = makeJwt({ typ: \"JWT\", alg: \"HS256\" }, {});"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":271,"symbol":"d2","kind":"constant","lang":"typescript","doc":"Invalid header","code":"const d2 = makeJwt({}, {});"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":275,"symbol":"d3","kind":"constant","lang":"typescript","doc":"Wrong algorithm","code":"const d3 = makeJwt({ typ: \"JWT\", alg: \"RS256\" }, {});"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":279,"symbol":"d4","kind":"constant","lang":"typescript","doc":"missing typ is fine","code":"const d4 = makeJwt({ alg: \"HS256\" }, {});"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":283,"symbol":"d5","kind":"constant","lang":"typescript","doc":"type isn't JWT","code":"const d5 = makeJwt({ typ: \"SUP\", alg: \"HS256\" }, { foo: \"bar\" });"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":287,"symbol":"customMsg","kind":"constant","lang":"typescript","doc":"Custom error message","code":"const customMsg = \"Invalid JWT token\";"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":288,"symbol":"jwtWithMsg","kind":"constant","lang":"typescript","code":"const jwtWithMsg = z.string().jwt({ message: customMsg });"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":297,"symbol":"url","kind":"constant","lang":"typescript","code":"const url = z.string().url();"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":324,"symbol":"emoji","kind":"constant","lang":"typescript","code":"const emoji = z.string().emoji();"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":341,"symbol":"start","kind":"constant","lang":"typescript","doc":"a failing match over the overlapping code points used to backtrack exponentially","code":"const start = performance.now();"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":347,"symbol":"uuid","kind":"constant","lang":"typescript","code":"const uuid = z.string().uuid(\"custom error\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":353,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = uuid.safeParse(\"9491d710-3185-4e06-bea0-6a2f275345e0X\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":361,"symbol":"uuid","kind":"constant","lang":"typescript","code":"const uuid = z.string().uuid(\"custom error\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":363,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = uuid.safeParse(\"invalid uuid\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":371,"symbol":"nanoid","kind":"constant","lang":"typescript","code":"const nanoid = z.string().nanoid(\"custom error\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":376,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = nanoid.safeParse(\"Xq90uDyhddC53KsoASYJGX\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":384,"symbol":"nanoid","kind":"constant","lang":"typescript","code":"const nanoid = z.string().nanoid(\"custom error\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":386,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = nanoid.safeParse(\"invalid nanoid\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":394,"symbol":"cuid","kind":"constant","lang":"typescript","code":"const cuid = z.string().cuid();"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":396,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = cuid.safeParse(\"cifjhdsfhsd-invalid-cuid\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":404,"symbol":"cuid2","kind":"constant","lang":"typescript","code":"const cuid2 = z.string().cuid2();"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":405,"symbol":"validStrings","kind":"constant","lang":"typescript","code":"const validStrings = [\n \"a\", // short string\n \"tz4a98xxat96iws9zmbrgj3a\", // normal string\n \"kf5vz6ssxe4zjcb409rjgo747tc5qjazgptvotk6\", // longer than require(\"@paralleldrive/cuid2\").bigLength\n ];"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":414,"symbol":"invalidStrings","kind":"constant","lang":"typescript","code":"const invalidStrings = [\n \"\", // empty string\n \"tz4a98xxat96iws9zMbrgj3a\", // include uppercase\n \"tz4a98xxat96iws-zmbrgj3a\", // involve symbols\n ];"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":419,"symbol":"results","kind":"constant","lang":"typescript","code":"const results = invalidStrings.map((s) => cuid2.safeParse(s));"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":427,"symbol":"ulid","kind":"constant","lang":"typescript","code":"const ulid = z.string().ulid();"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":429,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = ulid.safeParse(\"invalidulid\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":431,"symbol":"tooLong","kind":"constant","lang":"typescript","code":"const tooLong = \"01ARZ3NDEKTSV4RRFFQ69G5FAVA\";"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":436,"symbol":"caseInsensitive","kind":"constant","lang":"typescript","code":"const caseInsensitive = ulid.safeParse(\"01arZ3nDeKTsV4RRffQ69G5FAV\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":448,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z\n .string()\n .regex(/^moo+$/)\n .safeParse(\"boooo\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":462,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().regex(/^\\d+$/g);"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":586,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string().datetime({});"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":589,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.string().datetime({ offset: true });"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":592,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.string().datetime({ precision: 3 });"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":595,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = z.string().datetime({ offset: true, precision: 0 });"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":603,"symbol":"datetime","kind":"constant","lang":"typescript","code":"const datetime = z.string().datetime();"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":617,"symbol":"datetimeNoMs","kind":"constant","lang":"typescript","code":"const datetimeNoMs = z.string().datetime({ precision: 0 });"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":626,"symbol":"datetime3Ms","kind":"constant","lang":"typescript","code":"const datetime3Ms = z.string().datetime({ precision: 3 });"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":635,"symbol":"datetimeOffset","kind":"constant","lang":"typescript","code":"const datetimeOffset = z.string().datetime({ offset: true });"} {"repo":"zod","file":"packages/zod/src/v3/tests/string.test.ts","line":648,"symbol":"datetimeOffsetNoMs","kind":"constant","lang":"typescript","code":"const datetimeOffsetNoMs = z.string().datetime({ offset: true, precision: 0 });"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":7,"symbol":"stringToNumber","kind":"constant","lang":"typescript","code":"const stringToNumber = z.string().transform((arg) => Number.parseFloat(arg));"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":11,"symbol":"asyncNumberToString","kind":"constant","lang":"typescript","doc":"const numberToString = z .transformer(z.number()) .transform((n) => String(n));","code":"const asyncNumberToString = z.number().transform(async (n) => String(n));"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":14,"symbol":"strs","kind":"constant","lang":"typescript","code":"const strs = [\"foo\", \"bar\"];"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":19,"symbol":"i","kind":"constant","lang":"typescript","code":"const i = strs.indexOf(data);"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":45,"symbol":"strs","kind":"constant","lang":"typescript","code":"const strs = [\"foo\", \"bar\"];"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":47,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await z\n .string()\n .transform(async (data, ctx) => {\n const i = strs.indexOf(data);\n if (i === -1) {\n ctx.addIssue({\n code: \"custom\",\n message: `${data} is not one of our allowed strings`,\n });\n }\n return data.length;\n })\n .safeParseAsync(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":50,"symbol":"i","kind":"constant","lang":"typescript","code":"const i = strs.indexOf(data);"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":77,"symbol":"foo","kind":"constant","lang":"typescript","code":"const foo = z\n .number()\n .optional()\n .transform((val, ctx) => {\n if (!val) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, message: \"bad\" });\n return z.NEVER;\n }\n return val;\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":87,"symbol":"foo","kind":"type","lang":"typescript","code":"type foo = z.infer<typeof foo>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":89,"symbol":"arg","kind":"constant","lang":"typescript","code":"const arg = foo.safeParse(undefined);"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":96,"symbol":"r1","kind":"constant","lang":"typescript","code":"const r1 = z\n .string()\n .transform((data) => data.length)\n .parse(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":104,"symbol":"numToString","kind":"constant","lang":"typescript","code":"const numToString = z.number().transform((n) => String(n));"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":105,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = z\n .object({\n id: numToString,\n })\n .parse({ id: 5 });"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":115,"symbol":"numToString","kind":"constant","lang":"typescript","code":"const numToString = z.number().transform(async (n) => String(n));"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":116,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = await z\n .object({\n id: numToString,\n })\n .parseAsync({ id: 5 });"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":137,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = z.string().default(\"asdf\").parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":142,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = z\n .string()\n .default(() => \"string\")\n .parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":150,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = z\n .object({\n foo: z.boolean().nullable().default(true),\n bar: z.boolean().default(true),\n })\n .parse({ foo: null });"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":161,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n emptyStr: z.string().default(\"def\"),\n zero: z.number().default(5),\n falseBoolean: z.boolean().default(true),\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":166,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = { emptyStr: \"\", zero: 0, falseBoolean: true };"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":167,"symbol":"output","kind":"constant","lang":"typescript","code":"const output = schema.parse(input);"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":173,"symbol":"t1","kind":"constant","lang":"typescript","code":"const t1 = z.object({\n stringToNumber,\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":177,"symbol":"t1","kind":"type","lang":"typescript","code":"type t1 = z.input<typeof t1>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":178,"symbol":"t2","kind":"type","lang":"typescript","code":"type t2 = z.output<typeof t1>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":185,"symbol":"t1","kind":"constant","lang":"typescript","code":"const t1 = z.string().transform((val) => val.toUpperCase());"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":188,"symbol":"t2","kind":"constant","lang":"typescript","code":"const t2 = z.string().transform((val) => val.length);"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":193,"symbol":"doubler","kind":"constant","lang":"typescript","code":"const doubler = stringToNumber.transform((val) => {\n return val * 2;\n });"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":200,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .string()\n .refine(() => false)\n .transform((val) => val.toUpperCase());"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":204,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":210,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = schema.safeParse(1234);"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":218,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .string()\n .refine(() => false)\n .transform((val) => val.toUpperCase());"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":222,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await schema.spa(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/transformer.test.ts","line":228,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = await schema.spa(1234);"} {"repo":"zod","file":"packages/zod/src/v3/tests/tuple.test.ts","line":8,"symbol":"testTuple","kind":"constant","lang":"typescript","code":"const testTuple = z.tuple([z.string(), z.object({ name: z.literal(\"Rudy\") }), z.array(z.literal(\"blue\"))]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/tuple.test.ts","line":9,"symbol":"testData","kind":"constant","lang":"typescript","code":"const testData = [\"asdf\", { name: \"Rudy\" }, [\"blue\"]];"} {"repo":"zod","file":"packages/zod/src/v3/tests/tuple.test.ts","line":10,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = [123, { name: \"Rudy2\" }, [\"blue\", \"red\"]];"} {"repo":"zod","file":"packages/zod/src/v3/tests/tuple.test.ts","line":13,"symbol":"args1","kind":"constant","lang":"typescript","code":"const args1 = z.tuple([z.string()]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/tuple.test.ts","line":14,"symbol":"returns1","kind":"constant","lang":"typescript","code":"const returns1 = z.number();"} {"repo":"zod","file":"packages/zod/src/v3/tests/tuple.test.ts","line":15,"symbol":"func1","kind":"constant","lang":"typescript","code":"const func1 = z.function(args1, returns1);"} {"repo":"zod","file":"packages/zod/src/v3/tests/tuple.test.ts","line":16,"symbol":"func1","kind":"type","lang":"typescript","code":"type func1 = z.TypeOf<typeof func1>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/tuple.test.ts","line":21,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = testTuple.parse(testData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/tuple.test.ts","line":26,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = await testTuple.parseAsync(testData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/tuple.test.ts","line":31,"symbol":"checker","kind":"constant","lang":"typescript","code":"const checker = () => {\n testTuple.parse([123, { name: \"Rudy2\" }, [\"blue\", \"red\"]] as any);\n };"} {"repo":"zod","file":"packages/zod/src/v3/tests/tuple.test.ts","line":44,"symbol":"res","kind":"constant","lang":"typescript","code":"const res = await testTuple.safeParse(badData);"} {"repo":"zod","file":"packages/zod/src/v3/tests/tuple.test.ts","line":59,"symbol":"stringToNumber","kind":"constant","lang":"typescript","code":"const stringToNumber = z.string().transform((val) => val.length);"} {"repo":"zod","file":"packages/zod/src/v3/tests/tuple.test.ts","line":60,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = z.tuple([stringToNumber]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/tuple.test.ts","line":62,"symbol":"t1","kind":"type","lang":"typescript","code":"type t1 = z.input<typeof val>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/tuple.test.ts","line":64,"symbol":"t2","kind":"type","lang":"typescript","code":"type t2 = z.output<typeof val>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/tuple.test.ts","line":70,"symbol":"myTuple","kind":"constant","lang":"typescript","code":"const myTuple = z.tuple([z.string(), z.number()]).rest(z.boolean());"} {"repo":"zod","file":"packages/zod/src/v3/tests/tuple.test.ts","line":76,"symbol":"t1","kind":"type","lang":"typescript","code":"type t1 = z.output<typeof myTuple>;"} {"repo":"zod","file":"packages/zod/src/v3/tests/unions.test.ts","line":7,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.union([z.string().refine(() => false), z.number().refine(() => false)]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/unions.test.ts","line":8,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/unions.test.ts","line":13,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.union([z.number(), z.string().refine(() => false)]).safeParse(\"a\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/unions.test.ts","line":18,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.union([\n z.object({\n email: z.string().email(),\n }),\n z.string(),\n ]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/unions.test.ts","line":31,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.union([z.number(), z.string().refine(() => false)]).safeParse(\"a\");"} {"repo":"zod","file":"packages/zod/src/v3/tests/unions.test.ts","line":45,"symbol":"union","kind":"constant","lang":"typescript","code":"const union = z.union([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v3/tests/unions.test.ts","line":53,"symbol":"options","kind":"constant","lang":"typescript","code":"const options = [z.string(), z.number()] as const;"} {"repo":"zod","file":"packages/zod/src/v3/tests/unions.test.ts","line":54,"symbol":"union","kind":"constant","lang":"typescript","code":"const union = z.union(options);"} {"repo":"zod","file":"packages/zod/src/v3/tests/validations.test.ts","line":130,"symbol":"int","kind":"constant","lang":"typescript","code":"const int = z.number().int();"} {"repo":"zod","file":"packages/zod/src/v3/tests/void.test.ts","line":7,"symbol":"v","kind":"constant","lang":"typescript","code":"const v = z.void();"} {"repo":"zod","file":"packages/zod/src/v3/tests/void.test.ts","line":13,"symbol":"v","kind":"type","lang":"typescript","code":"type v = z.infer<typeof v>;"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":45,"symbol":"RefinementCtx","kind":"interface","lang":"typescript","code":"interface RefinementCtx {\n addIssue: (arg: IssueData) => void;\n path: (string | number)[];\n}"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":49,"symbol":"ZodRawShape","kind":"type","lang":"typescript","code":"type ZodRawShape = { [k: string]: ZodTypeAny };"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":50,"symbol":"ZodTypeAny","kind":"type","lang":"typescript","code":"type ZodTypeAny = ZodType<any, any, any>;"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":51,"symbol":"TypeOf","kind":"type","lang":"typescript","code":"type TypeOf<T extends ZodType<any, any, any>> = T[\"_output\"];"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":52,"symbol":"input","kind":"type","lang":"typescript","code":"type input<T extends ZodType<any, any, any>> = T[\"_input\"];"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":53,"symbol":"output","kind":"type","lang":"typescript","code":"type output<T extends ZodType<any, any, any>> = T[\"_output\"];"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":56,"symbol":"CustomErrorParams","kind":"type","lang":"typescript","code":"type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, \"code\">>;"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":57,"symbol":"ZodTypeDef","kind":"interface","lang":"typescript","code":"interface ZodTypeDef {\n errorMap?: ZodErrorMap | undefined;\n description?: string | undefined;\n}"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":62,"symbol":"ParseInputLazyPath","kind":"class","lang":"typescript","code":"class ParseInputLazyPath implements ParseInput {\n parent: ParseContext;\n data: any;\n _path: ParsePath;\n _key: string | number | (string | number)[];\n _cachedPath: ParsePath = [];\n constructor(parent: ParseContext, value: any, path: ParsePath, key: string | number | (string | number)[]) {\n this.parent = parent;\n this.data = value;\n this._path = path;\n this._key = key;\n }\n get path() {\n if (!this._cachedPath.length) {\n if (Array.isArray(this._key)) {\n this._cachedPath.push(...this._path, ...this._key);\n } else {\n this._cachedPath.push(...this._path, this._key);\n }\n }\n\n return this._cachedPath;\n }\n}"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":68,"symbol":"constructor","kind":"method","lang":"typescript","code":"constructor(parent: ParseContext, value: any, path: ParsePath, key: string | number | (string | number)[]) {\n this.parent = parent;\n this.data = value;\n this._path = path;\n this._key = key;\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":74,"symbol":"path","kind":"method","lang":"typescript","code":"get path() {\n if (!this._cachedPath.length) {\n if (Array.isArray(this._key)) {\n this._cachedPath.push(...this._path, ...this._key);\n } else {\n this._cachedPath.push(...this._path, this._key);\n }\n }\n\n return this._cachedPath;\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":87,"symbol":"handleResult","kind":"constant","lang":"typescript","code":"const handleResult = <Input, Output>(\n ctx: ParseContext,\n result: SyncParseReturnType<Output>\n): { success: true; data: Output } | { success: false; error: ZodError<Input> } => {\n if (isValid(result)) {\n return { success: true, data: result.value };\n } else {\n if (!ctx.common.issues.length) {\n throw new Error(\"Validation failed but no issues detected.\");\n }\n\n return {\n success: false,\n get error() {\n if ((this as any)._error) return (this as any)._error as Error;\n const error = new ZodError(ctx.common.issues);\n (this as any)._error = error;\n return (this as any)._error;\n },\n };\n }\n};"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":100,"symbol":"error","kind":"method","lang":"typescript","code":"get error() {\n if ((this as any)._error) return (this as any)._error as Error;\n const error = new ZodError(ctx.common.issues);\n (this as any)._error = error;\n return (this as any)._error;\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":102,"symbol":"error","kind":"constant","lang":"typescript","code":"const error = new ZodError(ctx.common.issues);"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":110,"symbol":"RawCreateParams","kind":"type","lang":"typescript","code":"type RawCreateParams =\n | {\n errorMap?: ZodErrorMap | undefined;\n invalid_type_error?: string | undefined;\n required_error?: string | undefined;\n message?: string | undefined;\n description?: string | undefined;\n }\n | undefined;"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":119,"symbol":"ProcessedCreateParams","kind":"type","lang":"typescript","code":"type ProcessedCreateParams = {\n errorMap?: ZodErrorMap | undefined;\n description?: string | undefined;\n};"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":123,"symbol":"processCreateParams","kind":"function","lang":"typescript","code":"function processCreateParams(params: RawCreateParams): ProcessedCreateParams {\n if (!params) return {};\n const { errorMap, invalid_type_error, required_error, description } = params;\n if (errorMap && (invalid_type_error || required_error)) {\n throw new Error(`Can't use \"invalid_type_error\" or \"required_error\" in conjunction with custom error map.`);\n }\n if (errorMap) return { errorMap: errorMap, description };\n const customMap: ZodErrorMap = (iss, ctx) => {\n const { message } = params;\n\n if (iss.code === \"invalid_enum_value\") {\n return { message: message ?? ctx.defaultError };\n }\n if (typeof ctx.data === \"undefined\") {\n return { message: message ?? required_error ?? ctx.defaultError };\n }\n if (iss.code !== \"invalid_type\") return { message: ctx.defaultError };\n return { message: message ?? invalid_type_error ?? ctx.defaultError };\n };\n return { errorMap: customMap, description };\n}"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":130,"symbol":"customMap","kind":"constant","lang":"typescript","code":"const customMap: ZodErrorMap = (iss, ctx) => {\n const { message } = params;\n\n if (iss.code === \"invalid_enum_value\") {\n return { message: message ?? ctx.defaultError };\n }\n if (typeof ctx.data === \"undefined\") {\n return { message: message ?? required_error ?? ctx.defaultError };\n }\n if (iss.code !== \"invalid_type\") return { message: ctx.defaultError };\n return { message: message ?? invalid_type_error ?? ctx.defaultError };\n };"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":145,"symbol":"SafeParseSuccess","kind":"type","lang":"typescript","code":"type SafeParseSuccess<Output> = {\n success: true;\n data: Output;\n error?: never;\n};"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":150,"symbol":"SafeParseError","kind":"type","lang":"typescript","code":"type SafeParseError<Input> = {\n success: false;\n error: ZodError<Input>;\n data?: never;\n};"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":156,"symbol":"SafeParseReturnType","kind":"type","lang":"typescript","code":"type SafeParseReturnType<Input, Output> = SafeParseSuccess<Output> | SafeParseError<Input>;"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":164,"symbol":"description","kind":"method","lang":"typescript","code":"get description(): string | undefined {\n return this._def.description;\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":172,"symbol":"_getType","kind":"method","lang":"typescript","code":"_getType(input: ParseInput): string {\n return getParsedType(input.data);\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":176,"symbol":"_getOrReturnCtx","kind":"method","lang":"typescript","code":"_getOrReturnCtx(input: ParseInput, ctx?: ParseContext | undefined): ParseContext {\n return (\n ctx || {\n common: input.parent.common,\n data: input.data,\n\n parsedType: getParsedType(input.data),\n\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n }\n );\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":191,"symbol":"_processInputParams","kind":"method","lang":"typescript","code":"_processInputParams(input: ParseInput): {\n status: ParseStatus;\n ctx: ParseContext;\n } {\n return {\n status: new ParseStatus(),\n ctx: {\n common: input.parent.common,\n data: input.data,\n\n parsedType: getParsedType(input.data),\n\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n },\n };\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":210,"symbol":"_parseSync","kind":"method","lang":"typescript","code":"_parseSync(input: ParseInput): SyncParseReturnType<Output> {\n const result = this._parse(input);\n if (isAsync(result)) {\n throw new Error(\"Synchronous parse encountered promise.\");\n }\n return result;\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":211,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = this._parse(input);"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":218,"symbol":"_parseAsync","kind":"method","lang":"typescript","code":"_parseAsync(input: ParseInput): AsyncParseReturnType<Output> {\n const result = this._parse(input);\n return Promise.resolve(result);\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":219,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = this._parse(input);"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":223,"symbol":"parse","kind":"method","lang":"typescript","code":"parse(data: unknown, params?: util.InexactPartial<ParseParams>): Output {\n const result = this.safeParse(data, params);\n if (result.success) return result.data;\n throw result.error;\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":224,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = this.safeParse(data, params);"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":229,"symbol":"safeParse","kind":"method","lang":"typescript","code":"safeParse(data: unknown, params?: util.InexactPartial<ParseParams>): SafeParseReturnType<Input, Output> {\n const ctx: ParseContext = {\n common: {\n issues: [],\n async: params?.async ?? false,\n contextualErrorMap: params?.errorMap,\n },\n path: params?.path || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const result = this._parseSync({ data, path: ctx.path, parent: ctx });\n\n return handleResult(ctx, result);\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":230,"symbol":"ctx","kind":"constant","lang":"typescript","code":"const ctx: ParseContext = {\n common: {\n issues: [],\n async: params?.async ?? false,\n contextualErrorMap: params?.errorMap,\n },\n path: params?.path || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":242,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = this._parseSync({ data, path: ctx.path, parent: ctx });"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":248,"symbol":"ctx","kind":"constant","lang":"typescript","code":"const ctx: ParseContext = {\n common: {\n issues: [],\n async: !!(this[\"~standard\"] as any).async,\n },\n path: [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":262,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = this._parseSync({ data, path: [], parent: ctx });"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":292,"symbol":"parseAsync","kind":"method","lang":"typescript","code":"async parseAsync(data: unknown, params?: util.InexactPartial<ParseParams>): Promise<Output> {\n const result = await this.safeParseAsync(data, params);\n if (result.success) return result.data;\n throw result.error;\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":293,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await this.safeParseAsync(data, params);"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":298,"symbol":"safeParseAsync","kind":"method","lang":"typescript","code":"async safeParseAsync(\n data: unknown,\n params?: util.InexactPartial<ParseParams>\n ): Promise<SafeParseReturnType<Input, Output>> {\n const ctx: ParseContext = {\n common: {\n issues: [],\n contextualErrorMap: params?.errorMap,\n async: true,\n },\n path: params?.path || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n\n const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });\n const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));\n return handleResult(ctx, result);\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":302,"symbol":"ctx","kind":"constant","lang":"typescript","code":"const ctx: ParseContext = {\n common: {\n issues: [],\n contextualErrorMap: params?.errorMap,\n async: true,\n },\n path: params?.path || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":315,"symbol":"maybeAsyncResult","kind":"constant","lang":"typescript","code":"const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":316,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":331,"symbol":"refine","kind":"method","lang":"typescript","code":"refine(\n check: (arg: Output) => unknown,\n message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)\n ): ZodEffects<this, Output, Input> {\n const getIssueProperties = (val: Output) => {\n if (typeof message === \"string\" || typeof message === \"undefined\") {\n return { message };\n } else if (typeof message === \"function\") {\n return message(val);\n } else {\n return message;\n }\n };\n return this._refinement((val, ctx) => {\n const result = check(val);\n const setError = () =>\n ctx.addIssue({\n code: ZodIssueCode.custom,\n ...getIssueProperties(val),\n });\n if (typeof Promise !== \"undefined\" && result instanceof Promise) {\n return result.then((data) => {\n if (!data) {\n setError();\n return false;\n } else {\n return true;\n }\n });\n }\n if (!result) {\n setError();\n return false;\n } else {\n return true;\n }\n });\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":335,"symbol":"getIssueProperties","kind":"constant","lang":"typescript","code":"const getIssueProperties = (val: Output) => {\n if (typeof message === \"string\" || typeof message === \"undefined\") {\n return { message };\n } else if (typeof message === \"function\") {\n return message(val);\n } else {\n return message;\n }\n };"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":345,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = check(val);"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":346,"symbol":"setError","kind":"constant","lang":"typescript","code":"const setError = () =>\n ctx.addIssue({\n code: ZodIssueCode.custom,\n ...getIssueProperties(val),\n });"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":378,"symbol":"refinement","kind":"method","lang":"typescript","code":"refinement(\n check: (arg: Output) => unknown,\n refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)\n ): ZodEffects<this, Output, Input> {\n return this._refinement((val, ctx) => {\n if (!check(val)) {\n ctx.addIssue(typeof refinementData === \"function\" ? refinementData(val, ctx) : refinementData);\n return false;\n } else {\n return true;\n }\n });\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":392,"symbol":"_refinement","kind":"method","lang":"typescript","code":"_refinement(refinement: RefinementEffect<Output>[\"refinement\"]): ZodEffects<this, Output, Input> {\n return new ZodEffects({\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"refinement\", refinement },\n });\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":405,"symbol":"superRefine","kind":"method","lang":"typescript","code":"superRefine(\n refinement: (arg: Output, ctx: RefinementCtx) => unknown | Promise<unknown>\n ): ZodEffects<this, Output, Input> {\n return this._refinement(refinement);\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":411,"symbol":"constructor","kind":"method","lang":"typescript","code":"constructor(def: Def) {\n this._def = def;\n this.parse = this.parse.bind(this);\n this.safeParse = this.safeParse.bind(this);\n this.parseAsync = this.parseAsync.bind(this);\n this.safeParseAsync = this.safeParseAsync.bind(this);\n this.spa = this.spa.bind(this);\n this.refine = this.refine.bind(this);\n this.refinement = this.refinement.bind(this);\n this.superRefine = this.superRefine.bind(this);\n this.optional = this.optional.bind(this);\n this.nullable = this.nullable.bind(this);\n this.nullish = this.nullish.bind(this);\n this.array = this.array.bind(this);\n this.promise = this.promise.bind(this);\n this.or = this.or.bind(this);\n this.and = this.and.bind(this);\n this.transform = this.transform.bind(this);\n this.brand = this.brand.bind(this);\n this.default = this.default.bind(this);\n this.catch = this.catch.bind(this);\n this.describe = this.describe.bind(this);\n this.pipe = this.pipe.bind(this);\n this.readonly = this.readonly.bind(this);\n this.isNullable = this.isNullable.bind(this);\n this.isOptional = this.isOptional.bind(this);\n this[\"~standard\"] = {\n version: 1,\n vendor: \"zod\",\n validate: (data)"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":444,"symbol":"optional","kind":"method","lang":"typescript","code":"optional(): ZodOptional<this> {\n return ZodOptional.create(this, this._def) as any;\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":447,"symbol":"nullable","kind":"method","lang":"typescript","code":"nullable(): ZodNullable<this> {\n return ZodNullable.create(this, this._def) as any;\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":450,"symbol":"nullish","kind":"method","lang":"typescript","code":"nullish(): ZodOptional<ZodNullable<this>> {\n return this.nullable().optional();\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":453,"symbol":"array","kind":"method","lang":"typescript","code":"array(): ZodArray<this> {\n return ZodArray.create(this);\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":456,"symbol":"promise","kind":"method","lang":"typescript","code":"promise(): ZodPromise<this> {\n return ZodPromise.create(this, this._def);\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":460,"symbol":"or","kind":"method","lang":"typescript","code":"or<T extends ZodTypeAny>(option: T): ZodUnion<[this, T]> {\n return ZodUnion.create([this, option], this._def) as any;\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":464,"symbol":"and","kind":"method","lang":"typescript","code":"and<T extends ZodTypeAny>(incoming: T): ZodIntersection<this, T> {\n return ZodIntersection.create(this, incoming, this._def);\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":468,"symbol":"transform","kind":"method","lang":"typescript","code":"transform<NewOut>(\n transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>\n ): ZodEffects<this, NewOut> {\n return new ZodEffects({\n ...processCreateParams(this._def),\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"transform\", transform },\n }) as any;\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":481,"symbol":"default","kind":"method","lang":"typescript","code":"default(def: any) {\n const defaultValueFunc = typeof def === \"function\" ? def : () => def;\n\n return new ZodDefault({\n ...processCreateParams(this._def),\n innerType: this,\n defaultValue: defaultValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n }) as any;\n }"} {"repo":"zod","file":"packages/zod/src/v3/types.ts","line":482,"symbol":"defaultValueFunc","kind":"constant","lang":"typescript","code":"const defaultValueFunc = typeof def === \"function\" ? def : () => def;"} {"repo":"zod","file":"packages/zod/src/v4/classic/coerce.ts","line":4,"symbol":"ZodCoercedString","kind":"interface","lang":"typescript","code":"interface ZodCoercedString<T = unknown> extends schemas._ZodString<core.$ZodStringInternals<T>> {}"} {"repo":"zod","file":"packages/zod/src/v4/classic/coerce.ts","line":5,"symbol":"string","kind":"function","lang":"typescript","code":"function string<T = unknown>(params?: string | core.$ZodStringParams): ZodCoercedString<T> {\n return core._coercedString(schemas.ZodString, params) as any;\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/coerce.ts","line":9,"symbol":"ZodCoercedNumber","kind":"interface","lang":"typescript","code":"interface ZodCoercedNumber<T = unknown> extends schemas._ZodNumber<core.$ZodNumberInternals<T>> {}"} {"repo":"zod","file":"packages/zod/src/v4/classic/coerce.ts","line":10,"symbol":"number","kind":"function","lang":"typescript","code":"function number<T = unknown>(params?: string | core.$ZodNumberParams): ZodCoercedNumber<T> {\n return core._coercedNumber(schemas.ZodNumber, params) as ZodCoercedNumber<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/coerce.ts","line":14,"symbol":"ZodCoercedBoolean","kind":"interface","lang":"typescript","code":"interface ZodCoercedBoolean<T = unknown> extends schemas._ZodBoolean<core.$ZodBooleanInternals<T>> {}"} {"repo":"zod","file":"packages/zod/src/v4/classic/coerce.ts","line":15,"symbol":"boolean","kind":"function","lang":"typescript","code":"function boolean<T = unknown>(params?: string | core.$ZodBooleanParams): ZodCoercedBoolean<T> {\n return core._coercedBoolean(schemas.ZodBoolean, params) as ZodCoercedBoolean<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/coerce.ts","line":19,"symbol":"ZodCoercedBigInt","kind":"interface","lang":"typescript","code":"interface ZodCoercedBigInt<T = unknown> extends schemas._ZodBigInt<core.$ZodBigIntInternals<T>> {}"} {"repo":"zod","file":"packages/zod/src/v4/classic/coerce.ts","line":20,"symbol":"bigint","kind":"function","lang":"typescript","code":"function bigint<T = unknown>(params?: string | core.$ZodBigIntParams): ZodCoercedBigInt<T> {\n return core._coercedBigint(schemas.ZodBigInt, params) as ZodCoercedBigInt<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/coerce.ts","line":24,"symbol":"ZodCoercedDate","kind":"interface","lang":"typescript","code":"interface ZodCoercedDate<T = unknown> extends schemas._ZodDate<core.$ZodDateInternals<T>> {}"} {"repo":"zod","file":"packages/zod/src/v4/classic/coerce.ts","line":25,"symbol":"date","kind":"function","lang":"typescript","code":"function date<T = unknown>(params?: string | core.$ZodDateParams): ZodCoercedDate<T> {\n return core._coercedDate(schemas.ZodDate, params) as ZodCoercedDate<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/compat.ts","line":7,"symbol":"TypeOf","kind":"type","lang":"typescript","doc":"@deprecated Use `z.output<T>` instead.","code":"type TypeOf<T> = core.output<T>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/compat.ts","line":9,"symbol":"Infer","kind":"type","lang":"typescript","doc":"@deprecated Use `z.output<T>` instead.","code":"type Infer<T> = core.output<T>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/compat.ts","line":11,"symbol":"ZodFirstPartySchemaTypes","kind":"type","lang":"typescript","doc":"@deprecated Use `z.core.$ZodTypes` instead","code":"type ZodFirstPartySchemaTypes = core.$ZodTypes;"} {"repo":"zod","file":"packages/zod/src/v4/classic/compat.ts","line":14,"symbol":"ZodIssueCode","kind":"constant","lang":"typescript","doc":"@deprecated Use the raw string literal codes instead, e.g. \"invalid_type\".","code":"const ZodIssueCode = {\n invalid_type: \"invalid_type\",\n too_big: \"too_big\",\n too_small: \"too_small\",\n invalid_format: \"invalid_format\",\n not_multiple_of: \"not_multiple_of\",\n unrecognized_keys: \"unrecognized_keys\",\n invalid_union: \"invalid_union\",\n invalid_key: \"invalid_key\",\n invalid_element: \"invalid_element\",\n invalid_value: \"invalid_value\",\n custom: \"custom\",\n} as const;"} {"repo":"zod","file":"packages/zod/src/v4/classic/compat.ts","line":29,"symbol":"inferFlattenedErrors","kind":"type","lang":"typescript","doc":"@deprecated Use `z.core.$ZodFlattenedError<z.output<T>>` instead; it takes an inferred type, not a schema.","code":"type inferFlattenedErrors<T extends core.$ZodType, U = string> = core.$ZodFlattenedError<core.output<T>, U>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/compat.ts","line":32,"symbol":"inferFormattedError","kind":"type","lang":"typescript","doc":"@deprecated Use `z.core.$ZodFormattedError<z.output<T>>` instead; it takes an inferred type, not a schema.","code":"type inferFormattedError<T extends core.$ZodType<any, any>, U = string> = core.$ZodFormattedError<\n core.output<T>,\n U\n>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/compat.ts","line":38,"symbol":"BRAND","kind":"type","lang":"typescript","doc":"Use `z.$brand` instead","code":"type BRAND<T extends string | number | symbol = string | number | symbol> = {\n [core.$brand]: { [k in T]: true };\n};"} {"repo":"zod","file":"packages/zod/src/v4/classic/compat.ts","line":44,"symbol":"setErrorMap","kind":"function","lang":"typescript","doc":"@deprecated Use `z.config(params)` instead.","code":"function setErrorMap(map: core.$ZodErrorMap): void {\n core.config({\n customError: map,\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/compat.ts","line":51,"symbol":"getErrorMap","kind":"function","lang":"typescript","doc":"@deprecated Use `z.config()` instead.","code":"function getErrorMap(): core.$ZodErrorMap<core.$ZodIssue> | undefined {\n return core.config().customError;\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/compat.ts","line":56,"symbol":"ZodTypeAny","kind":"type","lang":"typescript","doc":"@deprecated Use z.ZodType (without generics) instead.","code":"type ZodTypeAny<\n Output = unknown,\n Input = unknown,\n Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>,\n> = ZodType<Output, Input, Internals>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/compat.ts","line":62,"symbol":"ZodSchema","kind":"type","lang":"typescript","doc":"@deprecated Use `z.ZodType`","code":"type ZodSchema<\n Output = unknown,\n Input = unknown,\n Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>,\n> = ZodType<Output, Input, Internals>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/compat.ts","line":68,"symbol":"Schema","kind":"type","lang":"typescript","doc":"@deprecated Use `z.ZodType`","code":"type Schema<\n Output = unknown,\n Input = unknown,\n Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>,\n> = ZodType<Output, Input, Internals>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/compat.ts","line":75,"symbol":"ZodRawShape","kind":"type","lang":"typescript","doc":"Included for Zod 3 compatibility","code":"type ZodRawShape = core.$ZodShape;"} {"repo":"zod","file":"packages/zod/src/v4/classic/compat.ts","line":78,"symbol":"ZodFirstPartyTypeKind","kind":"type","lang":"typescript","doc":"@deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility.","code":"enum ZodFirstPartyTypeKind {}"} {"repo":"zod","file":"packages/zod/src/v4/classic/deep-partial.ts","line":7,"symbol":"DeepPartial","kind":"type","lang":"typescript","doc":"Distributes `.partial()` through every object in a schema type, preserving the wrappers around them. biome-ignore format: preserve vertical layout for readability.","code":"type DeepPartial<T extends core.SomeType> =\n T extends schemas.ZodObject<infer Shape, infer Config>\n ? schemas.ZodObject<\n { -readonly [K in keyof Shape]: schemas.ZodOptional<DeepPartial<Shape[K]>> },\n Config\n >\n // Must precede ZodUnion; degrades to it, matching the runtime.\n : T extends schemas.ZodDiscriminatedUnion<infer Options, any>\n ? schemas.ZodUnion<\n { -readonly [I in keyof Options]: Options[I] extends core.SomeType ? DeepPartial<Options[I]> : Options[I] }\n >\n : T extends schemas.ZodUnion<infer Options>\n ? schemas.ZodUnion<\n { -readonly [I in keyof Options]: Options[I] extends core.SomeType ? DeepPartial<Options[I]> : Options[I] }\n >\n : T extends schemas.ZodArray<infer El>\n ? schemas.ZodArray<DeepPartial<El>>\n : T extends schemas.ZodTuple<infer Items, infer Rest>\n ? schemas.ZodTuple<\n { -readonly [K in keyof Items]: Items[K] extends core.SomeType ? DeepPartial<Items[K]> : Items[K] },\n Rest extends core.SomeType ? DeepPartial<Rest> : Rest\n >\n : T extends schemas.ZodIntersection<infer A, infer B>\n ? schemas.ZodIntersection<DeepPartial<A>, DeepPartial<B>>\n : T extends schemas.ZodRecord<inf"} {"repo":"zod","file":"packages/zod/src/v4/classic/deep-partial.ts","line":67,"symbol":"deepPartial","kind":"function","lang":"typescript","doc":"Returns a copy of the schema with every nested object's properties made optional.","code":"function deepPartial<T extends core.SomeType>(schema: T): DeepPartial<T> {\n return visit(schema, {\n object: (s) => (s as schemas.ZodObject).partial(),\n // Every partialed option now admits `undefined`, which the constructor rejects as a duplicate.\n union: (s) => {\n const def = s._zod.def as core.$ZodDiscriminatedUnionDef;\n return def.discriminator === undefined ? s : schemas.union(def.options as schemas.ZodType[]);\n },\n }) as unknown as DeepPartial<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/deep-partial.ts","line":72,"symbol":"def","kind":"constant","lang":"typescript","code":"const def = s._zod.def as core.$ZodDiscriminatedUnionDef;"} {"repo":"zod","file":"packages/zod/src/v4/classic/errors.ts","line":6,"symbol":"ZodIssue","kind":"type","lang":"typescript","doc":"@deprecated Use `z.core.$ZodIssue` from `@zod/core` instead, especially if you are building a library on top of Zod.","code":"type ZodIssue = core.$ZodIssue;"} {"repo":"zod","file":"packages/zod/src/v4/classic/errors.ts","line":9,"symbol":"ZodError","kind":"interface","lang":"typescript","doc":"An Error-like class used to store Zod validation issues.","code":"interface ZodError<T = unknown> extends $ZodError<T> {\n /** @deprecated Use the `z.treeifyError(err)` function instead. */\n format(): core.$ZodFormattedError<T>;\n format<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFormattedError<T, U>;\n /** @deprecated Use the `z.treeifyError(err)` function instead. */\n flatten(): core.$ZodFlattenedError<T>;\n flatten<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFlattenedError<T, U>;\n /** @deprecated Push directly to `.issues` instead. */\n addIssue(issue: core.$ZodIssue): void;\n /** @deprecated Push directly to `.issues` instead. */\n addIssues(issues: core.$ZodIssue[]): void;\n\n /** @deprecated Check `err.issues.length === 0` instead. */\n isEmpty: boolean;\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/errors.ts","line":28,"symbol":"_installedErrorProtos","kind":"constant","lang":"typescript","doc":"Prototypes that already carry the lazy helper methods. Seeded with the intrinsics so that `init` on a foreign object — it accepts any object — can never install an accessor onto a prototype we do not own.","code":"const _installedErrorProtos = /* @__PURE__ */ new WeakSet<object>([Object.prototype, Error.prototype]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/errors.ts","line":35,"symbol":"_lazyMethod","kind":"function","lang":"typescript","doc":"Helper methods live as non-enumerable lazy getters on the shared prototype instead of own properties on every instance. On first access the getter allocates the per-instance closure and caches it as a non-enumerable own property, so detached usage still works and the allocation only happens for methods actually touched.","code":"function _lazyMethod(proto: object, key: string, make: (self: ZodError) => unknown): void {\n Object.defineProperty(proto, key, {\n configurable: true,\n enumerable: false,\n get(this: ZodError) {\n const value = make(this);\n Object.defineProperty(this, key, { value, configurable: true, writable: true });\n return value;\n },\n set(this: ZodError, value: unknown) {\n Object.defineProperty(this, key, { value, configurable: true, writable: true });\n },\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/errors.ts","line":39,"symbol":"get","kind":"method","lang":"typescript","code":"get(this: ZodError) {\n const value = make(this);\n Object.defineProperty(this, key, { value, configurable: true, writable: true });\n return value;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/errors.ts","line":40,"symbol":"value","kind":"constant","lang":"typescript","code":"const value = make(this);"} {"repo":"zod","file":"packages/zod/src/v4/classic/errors.ts","line":44,"symbol":"set","kind":"method","lang":"typescript","code":"set(this: ZodError, value: unknown) {\n Object.defineProperty(this, key, { value, configurable: true, writable: true });\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/errors.ts","line":50,"symbol":"initializer","kind":"constant","lang":"typescript","code":"const initializer = (inst: ZodError, issues: core.$ZodIssue[]) => {\n $ZodError.init(inst, issues);\n inst.name = \"ZodError\";\n\n const proto = Object.getPrototypeOf(inst);\n if (_installedErrorProtos.has(proto)) return;\n _installedErrorProtos.add(proto);\n\n _lazyMethod(proto, \"format\", (self) => (mapper: any) => core.formatError(self, mapper));\n _lazyMethod(proto, \"flatten\", (self) => (mapper: any) => core.flattenError(self, mapper));\n _lazyMethod(proto, \"addIssue\", (self) => (issue: any) => {\n self.issues.push(issue);\n self.message = JSON.stringify(self.issues, util.jsonStringifyReplacer, 2);\n });\n _lazyMethod(proto, \"addIssues\", (self) => (issues: any) => {\n self.issues.push(...issues);\n self.message = JSON.stringify(self.issues, util.jsonStringifyReplacer, 2);\n });\n Object.defineProperty(proto, \"isEmpty\", {\n configurable: true,\n enumerable: false,\n get(this: ZodError) {\n return this.issues.length === 0;\n },\n });\n};"} {"repo":"zod","file":"packages/zod/src/v4/classic/errors.ts","line":54,"symbol":"proto","kind":"constant","lang":"typescript","code":"const proto = Object.getPrototypeOf(inst);"} {"repo":"zod","file":"packages/zod/src/v4/classic/errors.ts","line":71,"symbol":"get","kind":"method","lang":"typescript","code":"get(this: ZodError) {\n return this.issues.length === 0;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/errors.ts","line":76,"symbol":"ZodError","kind":"constant","lang":"typescript","code":"const ZodError: core.$constructor<ZodError> = /*@__PURE__*/ core.$constructor(\"ZodError\", initializer);"} {"repo":"zod","file":"packages/zod/src/v4/classic/errors.ts","line":77,"symbol":"ZodRealError","kind":"constant","lang":"typescript","code":"const ZodRealError: core.$constructor<ZodError> = /*@__PURE__*/ core.$constructor(\n \"ZodError\",\n initializer,\n undefined,\n {\n Parent: Error,\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/classic/errors.ts","line":87,"symbol":"ZodFlattenedError","kind":"type","lang":"typescript","doc":"@deprecated Use `z.core.$ZodFlattenedError` instead.","code":"type ZodFlattenedError<T, U = string> = core.$ZodFlattenedError<T, U>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/errors.ts","line":89,"symbol":"ZodFormattedError","kind":"type","lang":"typescript","doc":"@deprecated Use `z.core.$ZodFormattedError` instead.","code":"type ZodFormattedError<T, U = string> = core.$ZodFormattedError<T, U>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/errors.ts","line":91,"symbol":"ZodErrorMap","kind":"type","lang":"typescript","doc":"@deprecated Use `z.core.$ZodErrorMap` instead.","code":"type ZodErrorMap<T extends core.$ZodIssueBase = core.$ZodIssue> = core.$ZodErrorMap<T>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/errors.ts","line":94,"symbol":"IssueData","kind":"type","lang":"typescript","doc":"@deprecated Use `z.core.$ZodRawIssue` instead.","code":"type IssueData = core.$ZodRawIssue;"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":10,"symbol":"z","kind":"constant","lang":"typescript","doc":"Local z object to avoid circular dependency with ../index.js","code":"const z = {\n ..._schemas,\n ..._checks,\n iso: _iso,\n};"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":16,"symbol":"JSONSchemaVersion","kind":"type","lang":"typescript","code":"type JSONSchemaVersion = \"draft-2020-12\" | \"draft-7\" | \"draft-4\" | \"openapi-3.0\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":18,"symbol":"FromJSONSchemaParams","kind":"interface","lang":"typescript","code":"interface FromJSONSchemaParams {\n defaultTarget?: JSONSchemaVersion;\n registry?: $ZodRegistry<any>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":23,"symbol":"ConversionContext","kind":"interface","lang":"typescript","code":"interface ConversionContext {\n version: JSONSchemaVersion;\n defs: Record<string, JSONSchema.JSONSchema>;\n refs: Map<string, ZodType>;\n processing: Set<string>;\n rootSchema: JSONSchema.JSONSchema;\n registry: $ZodRegistry<any>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":33,"symbol":"RECOGNIZED_KEYS","kind":"constant","lang":"typescript","doc":"Keys that are recognized and handled by the conversion logic","code":"const RECOGNIZED_KEYS = /*@__PURE__*/ new Set([\n // Schema identification\n \"$schema\",\n \"$ref\",\n \"$defs\",\n \"definitions\",\n // Core schema keywords\n \"$id\",\n \"id\",\n \"$comment\",\n \"$anchor\",\n \"$vocabulary\",\n \"$dynamicRef\",\n \"$dynamicAnchor\",\n // Type\n \"type\",\n \"enum\",\n \"const\",\n // Composition\n \"anyOf\",\n \"oneOf\",\n \"allOf\",\n \"not\",\n // Object\n \"properties\",\n \"required\",\n \"additionalProperties\",\n \"patternProperties\",\n \"propertyNames\",\n \"minProperties\",\n \"maxProperties\",\n // Array\n \"items\",\n \"prefixItems\",\n \"additionalItems\",\n \"minItems\",\n \"maxItems\",\n \"uniqueItems\",\n \"contains\",\n \"minContains\",\n \"maxContains\",\n // String\n \"minLength\",\n \"maxLength\",\n \"pattern\",\n \"format\",\n // Number\n \"minimum\",\n \"maximum\",\n \"exclusiveMinimum\",\n \"exclusiveMaximum\",\n \"multipleOf\",\n // Already handled metadata\n \"description\",\n \"default\",\n // Content\n \"contentEncoding\",\n \"contentMediaType\",\n \"contentSchema\",\n // Unsupported (error-throwing)\n \"unevaluatedItems\",\n \"unevaluatedProperties\",\n \"if\",\n \"then\",\n \"else\",\n \"dependentSchemas\",\n \"dependentRequired\",\n // OpenAPI\n \"nullable\",\n \"readOnly\",\n]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":105,"symbol":"detectVersion","kind":"function","lang":"typescript","code":"function detectVersion(schema: JSONSchema.JSONSchema, defaultTarget?: JSONSchemaVersion): JSONSchemaVersion {\n const $schema = schema.$schema;\n\n if ($schema === \"https://json-schema.org/draft/2020-12/schema\") {\n return \"draft-2020-12\";\n }\n if ($schema === \"http://json-schema.org/draft-07/schema#\") {\n return \"draft-7\";\n }\n if ($schema === \"http://json-schema.org/draft-04/schema#\") {\n return \"draft-4\";\n }\n\n // Use defaultTarget if provided, otherwise default to draft-2020-12\n return defaultTarget ?? \"draft-2020-12\";\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":106,"symbol":"$schema","kind":"constant","lang":"typescript","code":"const $schema = schema.$schema;"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":123,"symbol":"applyMinItems","kind":"function","lang":"typescript","doc":"Positional schemas constrain the elements that are present; only minItems makes them required.","code":"function applyMinItems(items: ZodType[], minItems: number): ZodType[] {\n return items.map((item, index) => (index < minItems ? item : item.optional()));\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":128,"symbol":"decodeJSONPointerSegment","kind":"function","lang":"typescript","doc":"Inverse of the encoding applied to $ref pointer segments in to-json-schema.ts. Per RFC 6901 the `~1` replacement must run before `~0`.","code":"function decodeJSONPointerSegment(segment: string): string {\n return segment.replace(/~1/g, \"/\").replace(/~0/g, \"~\");\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":132,"symbol":"resolveRef","kind":"function","lang":"typescript","code":"function resolveRef(ref: string, ctx: ConversionContext): JSONSchema.JSONSchema {\n if (!ref.startsWith(\"#\")) {\n throw new Error(\"External $ref is not supported, only local refs (#/...) are allowed\");\n }\n\n const path = ref.slice(1).split(\"/\").filter(Boolean);\n\n // Handle root reference \"#\"\n if (path.length === 0) {\n return ctx.rootSchema;\n }\n\n const defsKey = ctx.version === \"draft-2020-12\" ? \"$defs\" : \"definitions\";\n\n if (path[0] === defsKey) {\n const key = path[1] === undefined ? undefined : decodeJSONPointerSegment(path[1]);\n if (!key || !ctx.defs[key]) {\n throw new Error(`Reference not found: ${ref}`);\n }\n return ctx.defs[key]!;\n }\n\n throw new Error(`Reference not found: ${ref}`);\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":137,"symbol":"path","kind":"constant","lang":"typescript","code":"const path = ref.slice(1).split(\"/\").filter(Boolean);"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":144,"symbol":"defsKey","kind":"constant","lang":"typescript","code":"const defsKey = ctx.version === \"draft-2020-12\" ? \"$defs\" : \"definitions\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":147,"symbol":"key","kind":"constant","lang":"typescript","code":"const key = path[1] === undefined ? undefined : decodeJSONPointerSegment(path[1]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":164,"symbol":"checkObjectGuards","kind":"function","lang":"typescript","doc":"Enforces the keywords that constrain an object's own keys — `propertyNames`, `minProperties`, `maxProperties` — before `objectSchema` runs. The guard has to see the raw input: an object parse drops `__proto__` and can add keys from a property `default`, so its output is not the set of names the instance actually carried.","code":"function checkObjectGuards(\n objectSchema: ZodType,\n guards: { keySchema?: ZodType | undefined; minProperties?: number | undefined; maxProperties?: number | undefined }\n): ZodType {\n // An identity transform, not z.any(), so `toJSONSchema` reports the object on both the input and the output side of the pipe.\n const guard = z\n .transform((value: unknown) => value)\n .check((payload) => {\n const value = payload.value;\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return;\n const keys = Object.getOwnPropertyNames(value);\n if (guards.minProperties !== undefined && keys.length < guards.minProperties) {\n payload.issues.push({\n origin: \"object\",\n code: \"too_small\",\n minimum: guards.minProperties,\n inclusive: true,\n message: `Too small: expected object to have >=${guards.minProperties} properties`,\n input: value,\n inst: objectSchema,\n continue: true,\n });\n }\n if (guards.maxProperties !== undefined && keys.length > guards.maxProperties) {\n payload.issues.push({\n origin: \"object\",\n code: \"too_big\",\n maximum: "} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":169,"symbol":"guard","kind":"constant","lang":"typescript","doc":"An identity transform, not z.any(), so `toJSONSchema` reports the object on both the input and the output side of the pipe.","code":"const guard = z\n .transform((value: unknown) => value)\n .check((payload) => {\n const value = payload.value;\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return;\n const keys = Object.getOwnPropertyNames(value);\n if (guards.minProperties !== undefined && keys.length < guards.minProperties) {\n payload.issues.push({\n origin: \"object\",\n code: \"too_small\",\n minimum: guards.minProperties,\n inclusive: true,\n message: `Too small: expected object to have >=${guards.minProperties} properties`,\n input: value,\n inst: objectSchema,\n continue: true,\n });\n }\n if (guards.maxProperties !== undefined && keys.length > guards.maxProperties) {\n payload.issues.push({\n origin: \"object\",\n code: \"too_big\",\n maximum: guards.maxProperties,\n inclusive: true,\n message: `Too big: expected object to have <=${guards.maxProperties} properties`,\n input: value,\n inst: objectSchema,\n continue: true,\n });\n }\n if (guards.keySchema) {\n for (const key of keys) {\n "} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":172,"symbol":"value","kind":"constant","lang":"typescript","code":"const value = payload.value;"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":174,"symbol":"keys","kind":"constant","lang":"typescript","code":"const keys = Object.getOwnPropertyNames(value);"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":201,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = guards.keySchema.safeParse(key);"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":223,"symbol":"canonicalKey","kind":"function","lang":"typescript","doc":"An injective string for JSON data: two values share a key exactly when `uniqueItems` calls them equal, so duplicate detection is a Map lookup rather than a pairwise walk. Strings and keys are length-prefixed so no value can spell another one. `null` means \"never equal to anything\" — a cycle or a NaN, neither of which JSON can express.","code":"function canonicalKey(value: unknown, seen: Set<object>): string | null {\n if (value === null) return \"z\";\n const type = typeof value;\n if (type !== \"object\") {\n if (type === \"number\" && Number.isNaN(value)) return null;\n const raw = String(value);\n return `${type[0]}${raw.length}:${raw}`;\n }\n if (seen.has(value as object)) return null;\n seen.add(value as object);\n try {\n if (Array.isArray(value)) {\n const parts: string[] = [];\n for (const item of value) {\n const key = canonicalKey(item, seen);\n if (key === null) return null;\n parts.push(key);\n }\n return `a${parts.length}:[${parts.join(\",\")}]`;\n }\n const keys = Object.keys(value as object).sort();\n const parts: string[] = [];\n for (const k of keys) {\n const key = canonicalKey((value as any)[k], seen);\n if (key === null) return null;\n parts.push(`${k.length}:${k}=${key}`);\n }\n return `o${parts.length}:{${parts.join(\",\")}}`;\n } finally {\n seen.delete(value as object);\n }\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":225,"symbol":"type","kind":"constant","lang":"typescript","code":"const type = typeof value;"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":228,"symbol":"raw","kind":"constant","lang":"typescript","code":"const raw = String(value);"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":235,"symbol":"parts","kind":"constant","lang":"typescript","code":"const parts: string[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":237,"symbol":"key","kind":"constant","lang":"typescript","code":"const key = canonicalKey(item, seen);"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":243,"symbol":"keys","kind":"constant","lang":"typescript","code":"const keys = Object.keys(value as object).sort();"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":244,"symbol":"parts","kind":"constant","lang":"typescript","code":"const parts: string[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":246,"symbol":"key","kind":"constant","lang":"typescript","code":"const key = canonicalKey((value as any)[k], seen);"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":257,"symbol":"SCHEMA_KEYWORDS","kind":"constant","lang":"typescript","doc":"keywords whose value is a schema or an array of them","code":"const SCHEMA_KEYWORDS = /*@__PURE__*/ new Set([\n \"items\",\n \"prefixItems\",\n \"additionalItems\",\n \"additionalProperties\",\n \"contains\",\n \"propertyNames\",\n \"not\",\n \"if\",\n \"then\",\n \"else\",\n \"allOf\",\n \"anyOf\",\n \"oneOf\",\n \"unevaluatedItems\",\n \"unevaluatedProperties\",\n \"contentSchema\",\n]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":277,"symbol":"SCHEMA_MAP_KEYWORDS","kind":"constant","lang":"typescript","doc":"keywords whose value maps names to schemas. draft-7 `dependencies` also allows an array of property names, which holds no schema to walk","code":"const SCHEMA_MAP_KEYWORDS = /*@__PURE__*/ new Set([\n \"properties\",\n \"patternProperties\",\n \"dependentSchemas\",\n \"dependencies\",\n \"$defs\",\n \"definitions\",\n]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":291,"symbol":"containsRef","kind":"function","lang":"typescript","doc":"True when a subschema holds a `$ref` anywhere a schema can appear. Only those positions are walked: `$ref` under `default` or an `x-` annotation is instance data with an ordinary key, and reading it as a reference would drop a constraint that resolves perfectly well.","code":"function containsRef(value: unknown): boolean {\n if (typeof value !== \"object\" || value === null) return false;\n if (Array.isArray(value)) return value.some(containsRef);\n if (typeof (value as any).$ref === \"string\") return true;\n return Object.entries(value).some(([key, sub]) => {\n if (SCHEMA_KEYWORDS.has(key)) return containsRef(sub);\n if (!SCHEMA_MAP_KEYWORDS.has(key) || typeof sub !== \"object\" || sub === null) return false;\n return Object.values(sub).some(containsRef);\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":302,"symbol":"plural","kind":"function","lang":"typescript","code":"function plural(n: number): string {\n return n === 1 ? \"element\" : \"elements\";\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":313,"symbol":"checkArrayGuards","kind":"function","lang":"typescript","doc":"Enforces `uniqueItems` and the `contains` family before `arraySchema` runs, for the same reason `checkObjectGuards` runs pre-pipe: an item parse can apply a nested `default`, so the parsed array is not the instance the keywords are defined over. A guard issue aborts the pipe, so `minItems`/`maxItems` are not also reported on the same parse — instance correctness is worth more than co-reporting two issues.","code":"function checkArrayGuards(\n arraySchema: ZodType,\n guards: {\n uniqueItems?: boolean | undefined;\n containsSchema?: ZodType | undefined;\n minContains?: number | undefined;\n maxContains?: number | undefined;\n }\n): ZodType {\n // An identity transform, not z.any(), so `toJSONSchema` reports the array on both the input and the output side of the pipe.\n const guard = z\n .transform((value: unknown) => value)\n .check((payload) => {\n const items = payload.value;\n if (!Array.isArray(items)) return;\n if (guards.uniqueItems === true) {\n const firstSeen = new Map<string, number>();\n for (let i = 0; i < items.length; i++) {\n const key = canonicalKey(items[i], new Set());\n if (key === null) continue;\n const first = firstSeen.get(key);\n if (first === undefined) {\n firstSeen.set(key, i);\n continue;\n }\n payload.issues.push({\n code: \"custom\",\n message: `Array items must be unique: element at index ${i} duplicates the one at index ${first}`,\n input: items,\n path: [i],\n continue: true,\n });\n }\n }\n "} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":323,"symbol":"guard","kind":"constant","lang":"typescript","doc":"An identity transform, not z.any(), so `toJSONSchema` reports the array on both the input and the output side of the pipe.","code":"const guard = z\n .transform((value: unknown) => value)\n .check((payload) => {\n const items = payload.value;\n if (!Array.isArray(items)) return;\n if (guards.uniqueItems === true) {\n const firstSeen = new Map<string, number>();\n for (let i = 0; i < items.length; i++) {\n const key = canonicalKey(items[i], new Set());\n if (key === null) continue;\n const first = firstSeen.get(key);\n if (first === undefined) {\n firstSeen.set(key, i);\n continue;\n }\n payload.issues.push({\n code: \"custom\",\n message: `Array items must be unique: element at index ${i} duplicates the one at index ${first}`,\n input: items,\n path: [i],\n continue: true,\n });\n }\n }\n if (guards.containsSchema) {\n const minContains = guards.minContains ?? 1;\n // one past the ceiling already proves the failure, and nothing above it changes the verdict\n const ceiling = guards.maxContains !== undefined ? guards.maxContains + 1 : Number.POSITIVE_INFINITY;\n let matches = 0;\n for (const item of items) {\n if"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":326,"symbol":"items","kind":"constant","lang":"typescript","code":"const items = payload.value;"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":329,"symbol":"firstSeen","kind":"constant","lang":"typescript","code":"const firstSeen = new Map<string, number>();"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":331,"symbol":"key","kind":"constant","lang":"typescript","code":"const key = canonicalKey(items[i], new Set());"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":333,"symbol":"first","kind":"constant","lang":"typescript","code":"const first = firstSeen.get(key);"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":348,"symbol":"minContains","kind":"constant","lang":"typescript","code":"const minContains = guards.minContains ?? 1;"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":350,"symbol":"ceiling","kind":"constant","lang":"typescript","doc":"one past the ceiling already proves the failure, and nothing above it changes the verdict","code":"const ceiling = guards.maxContains !== undefined ? guards.maxContains + 1 : Number.POSITIVE_INFINITY;"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":377,"symbol":"getTupleRest","kind":"function","lang":"typescript","code":"function getTupleRest(restSchema: JSONSchema._JSONSchema | undefined, ctx: ConversionContext): ZodType | undefined {\n if (restSchema === false) {\n return undefined;\n }\n if (restSchema === undefined || restSchema === true) {\n return z.any();\n }\n return convertSchema(restSchema, ctx);\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":388,"symbol":"fullTime","kind":"constant","lang":"typescript","doc":"the RFC 3339 full-time keyword, narrower than `z.iso.time()`; local because sharing it via `timeSource` pins that builder into every bundle (+139 B gzipped on a mini `z.boolean()`)","code":"const fullTime = /^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|[+-](?:[01]\\d|2[0-3]):[0-5]\\d)$/;"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":390,"symbol":"convertBaseSchema","kind":"function","lang":"typescript","code":"function convertBaseSchema(schema: JSONSchema.JSONSchema, ctx: ConversionContext): ZodType {\n // Handle unsupported features\n if (schema.not !== undefined) {\n // Special case: { not: {} } represents never\n if (typeof schema.not === \"object\" && Object.keys(schema.not).length === 0) {\n return z.never();\n }\n throw new Error(\"not is not supported in Zod (except { not: {} } for never)\");\n }\n if (schema.unevaluatedItems !== undefined) {\n throw new Error(\"unevaluatedItems is not supported\");\n }\n if (schema.unevaluatedProperties !== undefined) {\n throw new Error(\"unevaluatedProperties is not supported\");\n }\n if (schema.if !== undefined || schema.then !== undefined || schema.else !== undefined) {\n throw new Error(\"Conditional schemas (if/then/else) are not supported\");\n }\n if (schema.dependentSchemas !== undefined || schema.dependentRequired !== undefined) {\n throw new Error(\"dependentSchemas and dependentRequired are not supported\");\n }\n\n // Handle $ref\n if (schema.$ref) {\n const refPath = schema.$ref;\n if (ctx.refs.has(refPath)) {\n return ctx.refs.get(refPath)!;\n }\n\n if (ctx.processing.has(refPath)) {\n // Circular reference -"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":414,"symbol":"refPath","kind":"constant","lang":"typescript","code":"const refPath = schema.$ref;"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":430,"symbol":"resolved","kind":"constant","lang":"typescript","code":"const resolved = resolveRef(refPath, ctx);"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":431,"symbol":"zodSchema","kind":"constant","lang":"typescript","code":"const zodSchema = convertSchema(resolved, ctx);"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":439,"symbol":"enumValues","kind":"constant","lang":"typescript","code":"const enumValues = schema.enum;"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":462,"symbol":"literalSchemas","kind":"constant","lang":"typescript","doc":"Mixed types - use union of literals","code":"const literalSchemas = enumValues.map((v) => z.literal(v));"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":479,"symbol":"type","kind":"constant","lang":"typescript","doc":"Handle type","code":"const type = schema.type;"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":483,"symbol":"typeSchemas","kind":"constant","lang":"typescript","doc":"Expand type array into anyOf union","code":"const typeSchemas = type.map((t) => {\n const typeSchema: JSONSchema.JSONSchema = { ...schema, type: t };\n return convertBaseSchema(typeSchema, ctx);\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":484,"symbol":"typeSchema","kind":"constant","lang":"typescript","code":"const typeSchema: JSONSchema.JSONSchema = { ...schema, type: t };"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":509,"symbol":"format","kind":"constant","lang":"typescript","code":"const format = schema.format;"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":626,"symbol":"shape","kind":"constant","lang":"typescript","code":"const shape: Record<string, ZodType> = {};"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":627,"symbol":"properties","kind":"constant","lang":"typescript","code":"const properties = schema.properties || {};"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":628,"symbol":"requiredSet","kind":"constant","lang":"typescript","code":"const requiredSet = new Set(schema.required || []);"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":630,"symbol":"additionalSchema","kind":"constant","lang":"typescript","code":"const additionalSchema =\n typeof schema.additionalProperties === \"object\"\n ? convertSchema(schema.additionalProperties as JSONSchema.JSONSchema, ctx)\n : undefined;"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":637,"symbol":"propZodSchema","kind":"constant","lang":"typescript","code":"const propZodSchema = convertSchema(propSchema as JSONSchema.JSONSchema, ctx);"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":645,"symbol":"patternProps","kind":"constant","lang":"typescript","doc":"patternProperties: keys matching pattern must satisfy corresponding schema. Use loose records so non-matching keys pass through","code":"const patternProps = schema.patternProperties;"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":646,"symbol":"patternKeys","kind":"constant","lang":"typescript","code":"const patternKeys = Object.keys(patternProps);"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":647,"symbol":"looseRecords","kind":"constant","lang":"typescript","code":"const looseRecords: ZodType[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":650,"symbol":"patternValue","kind":"constant","lang":"typescript","code":"const patternValue = convertSchema(patternProps[pattern] as JSONSchema.JSONSchema, ctx);"} {"repo":"zod","file":"packages/zod/src/v4/classic/from-json-schema.ts","line":651,"symbol":"keySchema","kind":"constant","lang":"typescript","code":"const keySchema = z.string().regex(new RegExp(pattern));"} {"repo":"zod","file":"packages/zod/src/v4/classic/in-out.ts","line":7,"symbol":"input","kind":"type","lang":"typescript","doc":"Co-located with the functions: a type and a value can only share a name from one module.","code":"type input<T> = core.input<T>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/in-out.ts","line":8,"symbol":"output","kind":"type","lang":"typescript","code":"type output<T> = core.output<T>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/in-out.ts","line":11,"symbol":"withChecks","kind":"function","lang":"typescript","doc":"Appends a pipe's own checks to the side that replaces it, mirroring how `.check()` clones.","code":"function withChecks(side: core.$ZodType, checks: core.$ZodTypeDef[\"checks\"]): core.$ZodType {\n if (!checks?.length) return side;\n const def = side._zod.def;\n return clone(side, mergeDefs(def, { checks: [...(def.checks ?? []), ...checks] }), { parent: true });\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/in-out.ts","line":13,"symbol":"def","kind":"constant","lang":"typescript","code":"const def = side._zod.def;"} {"repo":"zod","file":"packages/zod/src/v4/classic/in-out.ts","line":18,"symbol":"outSide","kind":"function","lang":"typescript","doc":"The out side, carrying the pipe's own checks: those run against the decoded value, which is what `out` produces.","code":"function outSide(def: core.$ZodPipeDef): core.$ZodType {\n return withChecks(def.out, def.checks);\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/in-out.ts","line":23,"symbol":"inSide","kind":"function","lang":"typescript","doc":"The in side. `z.preprocess` pipes a transform into a schema, and a bare transform validates nothing, so the schema it feeds is the real input side — the resolution `toJSONSchema` already makes for this case.","code":"function inSide(def: core.$ZodPipeDef): core.$ZodType {\n return def.in._zod.traits.has(\"$ZodTransform\") ? outSide(def) : def.in;\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/in-out.ts","line":28,"symbol":"input","kind":"function","lang":"typescript","doc":"Returns a copy of the schema with every pipe replaced by its input side. A codec's checks are dropped: they constrain the decoded value the input side never produces.","code":"function input<T extends core.$ZodType>(schema: T): schemas.ZodType<core.input<T>, core.input<T>> {\n return visit(schema, {\n pipe: (s) => inSide(s._zod.def),\n // A default value belongs to the output side, so a rewritten inner type leaves it stranded. `.default()` widens the declared input type with `undefined`, and `optional` is what carries that across.\n default: (s, rewritten) => (rewritten ? schemas.optional(s._zod.def.innerType) : s),\n // A catch value is output-side too, but `.catch()` leaves the declared input type alone, so the inner schema stands on its own.\n catch: (s, rewritten) => (rewritten ? s._zod.def.innerType : s),\n }) as schemas.ZodType<core.input<T>, core.input<T>>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/in-out.ts","line":39,"symbol":"output","kind":"function","lang":"typescript","doc":"Returns a copy of the schema with every pipe replaced by its output side, carrying over the pipe's own checks.","code":"function output<T extends core.$ZodType>(schema: T): schemas.ZodType<core.output<T>, core.output<T>> {\n return visit(schema, {\n pipe: (s) => outSide(s._zod.def),\n // A prefault value is fed through the schema, which makes it input-side, so a rewritten inner type leaves it stranded.\n prefault: (s, rewritten) => (rewritten ? s._zod.def.innerType : s),\n }) as schemas.ZodType<core.output<T>, core.output<T>>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/iso.ts","line":6,"symbol":"datetime","kind":"function","lang":"typescript","code":"function datetime(params?: string | core.$ZodISODateTimeParams): ZodISODateTime {\n return core._isoDateTime(ZodISODateTime, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/iso.ts","line":10,"symbol":"date","kind":"function","lang":"typescript","code":"function date(params?: string | core.$ZodISODateParams): ZodISODate {\n return core._isoDate(ZodISODate, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/iso.ts","line":14,"symbol":"time","kind":"function","lang":"typescript","code":"function time(params?: string | core.$ZodISOTimeParams): ZodISOTime {\n return core._isoTime(ZodISOTime, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/iso.ts","line":18,"symbol":"duration","kind":"function","lang":"typescript","code":"function duration(params?: string | core.$ZodISODurationParams): ZodISODuration {\n return core._isoDuration(ZodISODuration, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/parse.ts","line":4,"symbol":"ZodSafeParseResult","kind":"type","lang":"typescript","code":"type ZodSafeParseResult<T> = ZodSafeParseSuccess<T> | ZodSafeParseError<T>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/parse.ts","line":5,"symbol":"ZodSafeParseSuccess","kind":"type","lang":"typescript","code":"type ZodSafeParseSuccess<T> = { success: true; data: T; error?: never };"} {"repo":"zod","file":"packages/zod/src/v4/classic/parse.ts","line":6,"symbol":"ZodSafeParseError","kind":"type","lang":"typescript","code":"type ZodSafeParseError<T> = { success: false; data?: never; error: ZodError<T> };"} {"repo":"zod","file":"packages/zod/src/v4/classic/parse.ts","line":8,"symbol":"parse","kind":"constant","lang":"typescript","code":"const parse: <T extends core.$ZodType>(\n schema: T,\n value: unknown,\n _ctx?: core.ParseContext<core.$ZodIssue>,\n _params?: { callee?: core.util.AnyFunc; Err?: core.$ZodErrorClass }\n) => core.output<T> = /* @__PURE__ */ core._parse(ZodRealError);"} {"repo":"zod","file":"packages/zod/src/v4/classic/parse.ts","line":15,"symbol":"parseAsync","kind":"constant","lang":"typescript","code":"const parseAsync: <T extends core.$ZodType>(\n schema: T,\n value: unknown,\n _ctx?: core.ParseContext<core.$ZodIssue>,\n _params?: { callee?: core.util.AnyFunc; Err?: core.$ZodErrorClass }\n) => Promise<core.output<T>> = /* @__PURE__ */ core._parseAsync(ZodRealError);"} {"repo":"zod","file":"packages/zod/src/v4/classic/parse.ts","line":22,"symbol":"safeParse","kind":"constant","lang":"typescript","code":"const safeParse: <T extends core.$ZodType>(\n schema: T,\n value: unknown,\n _ctx?: core.ParseContext<core.$ZodIssue>\n // _params?: { callee?: core.util.AnyFunc; Err?: core.$ZodErrorClass }\n) => ZodSafeParseResult<core.output<T>> = /* @__PURE__ */ core._safeParse(ZodRealError) as any;"} {"repo":"zod","file":"packages/zod/src/v4/classic/parse.ts","line":29,"symbol":"safeParseAsync","kind":"constant","lang":"typescript","code":"const safeParseAsync: <T extends core.$ZodType>(\n schema: T,\n value: unknown,\n _ctx?: core.ParseContext<core.$ZodIssue>\n) => Promise<ZodSafeParseResult<core.output<T>>> = /* @__PURE__ */ core._safeParseAsync(ZodRealError) as any;"} {"repo":"zod","file":"packages/zod/src/v4/classic/parse.ts","line":38,"symbol":"encode","kind":"constant","lang":"typescript","doc":"Codec functions","code":"const encode: <T extends core.$ZodType>(\n schema: T,\n value: core.output<T>,\n _ctx?: core.ParseContext<core.$ZodIssue>,\n _params?: { callee?: core.util.AnyFunc; Err?: core.$ZodErrorClass }\n) => core.input<T> = /* @__PURE__ */ core._encode(ZodRealError);"} {"repo":"zod","file":"packages/zod/src/v4/classic/parse.ts","line":45,"symbol":"decode","kind":"constant","lang":"typescript","code":"const decode: <T extends core.$ZodType>(\n schema: T,\n value: core.input<T>,\n _ctx?: core.ParseContext<core.$ZodIssue>,\n _params?: { callee?: core.util.AnyFunc; Err?: core.$ZodErrorClass }\n) => core.output<T> = /* @__PURE__ */ core._decode(ZodRealError);"} {"repo":"zod","file":"packages/zod/src/v4/classic/parse.ts","line":52,"symbol":"encodeAsync","kind":"constant","lang":"typescript","code":"const encodeAsync: <T extends core.$ZodType>(\n schema: T,\n value: core.output<T>,\n _ctx?: core.ParseContext<core.$ZodIssue>,\n _params?: { callee?: core.util.AnyFunc; Err?: core.$ZodErrorClass }\n) => Promise<core.input<T>> = /* @__PURE__ */ core._encodeAsync(ZodRealError);"} {"repo":"zod","file":"packages/zod/src/v4/classic/parse.ts","line":59,"symbol":"decodeAsync","kind":"constant","lang":"typescript","code":"const decodeAsync: <T extends core.$ZodType>(\n schema: T,\n value: core.input<T>,\n _ctx?: core.ParseContext<core.$ZodIssue>,\n _params?: { callee?: core.util.AnyFunc; Err?: core.$ZodErrorClass }\n) => Promise<core.output<T>> = /* @__PURE__ */ core._decodeAsync(ZodRealError);"} {"repo":"zod","file":"packages/zod/src/v4/classic/parse.ts","line":66,"symbol":"safeEncode","kind":"constant","lang":"typescript","code":"const safeEncode: <T extends core.$ZodType>(\n schema: T,\n value: core.output<T>,\n _ctx?: core.ParseContext<core.$ZodIssue>\n) => ZodSafeParseResult<core.input<T>> = /* @__PURE__ */ core._safeEncode(ZodRealError) as any;"} {"repo":"zod","file":"packages/zod/src/v4/classic/parse.ts","line":72,"symbol":"safeDecode","kind":"constant","lang":"typescript","code":"const safeDecode: <T extends core.$ZodType>(\n schema: T,\n value: core.input<T>,\n _ctx?: core.ParseContext<core.$ZodIssue>\n) => ZodSafeParseResult<core.output<T>> = /* @__PURE__ */ core._safeDecode(ZodRealError) as any;"} {"repo":"zod","file":"packages/zod/src/v4/classic/parse.ts","line":78,"symbol":"safeEncodeAsync","kind":"constant","lang":"typescript","code":"const safeEncodeAsync: <T extends core.$ZodType>(\n schema: T,\n value: core.output<T>,\n _ctx?: core.ParseContext<core.$ZodIssue>\n) => Promise<ZodSafeParseResult<core.input<T>>> = /* @__PURE__ */ core._safeEncodeAsync(ZodRealError) as any;"} {"repo":"zod","file":"packages/zod/src/v4/classic/parse.ts","line":84,"symbol":"safeDecodeAsync","kind":"constant","lang":"typescript","code":"const safeDecodeAsync: <T extends core.$ZodType>(\n schema: T,\n value: core.input<T>,\n _ctx?: core.ParseContext<core.$ZodIssue>\n) => Promise<ZodSafeParseResult<core.output<T>>> = /* @__PURE__ */ core._safeDecodeAsync(ZodRealError) as any;"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":14,"symbol":"_ensureDefaultLocale","kind":"function","lang":"typescript","doc":"Register English as the default locale on first ZodType construction. Hooked into the `ZodType` `$constructor` (rather than a top-level `config(en())` in `external.ts`) so bundlers honoring `sideEffects: false` can't tree-shake it out — see #5953, #5725. An explicit `z.config(z.locales.xx())` call wins regardless of order, since this only sets the default when none is present.","code":"function _ensureDefaultLocale(): void {\n if (!core.globalConfig.localeError) core.config(en());\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":19,"symbol":"_ensureDefaultMemoizer","kind":"function","lang":"typescript","doc":"the default memoizer is read by the core container init, which runs before `ZodType.init`, so each container calls this first","code":"function _ensureDefaultMemoizer(): void {\n if (!core.globalConfig.memoizer) core.config({ memoizer: core.memoizer() });\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":33,"symbol":"ZodStandardSchemaWithJSON","kind":"type","lang":"typescript","code":"type ZodStandardSchemaWithJSON<T> = StandardSchemaWithJSONProps<core.input<T>, core.output<T>>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":34,"symbol":"ZodType","kind":"interface","lang":"typescript","code":"interface ZodType<\n out Output = unknown,\n out Input = unknown,\n out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>,\n> extends core.$ZodType<Output, Input, Internals> {\n def: Internals[\"def\"];\n type: Internals[\"def\"][\"type\"];\n\n /** @deprecated Use `.def` instead. */\n _def: Internals[\"def\"];\n /** @deprecated Use `z.output<typeof schema>` instead. */\n _output: Internals[\"output\"];\n /** @deprecated Use `z.input<typeof schema>` instead. */\n _input: Internals[\"input\"];\n\n \"~standard\": ZodStandardSchemaWithJSON<this>;\n /** Converts this schema to a JSON Schema representation. */\n toJSONSchema(params?: core.ToJSONSchemaParams): core.ZodStandardJSONSchemaPayload<this>;\n\n // base methods\n check(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;\n with(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;\n clone(def?: Internals[\"def\"], params?: { parent: boolean }): this;\n register<R extends core.$ZodRegistry>(\n registry: R,\n ...meta: this extends R[\"_schema\"]\n ? undefined extends R[\"_meta\"]\n ? [core.$replace<R[\"_meta\"], this>?]\n "} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":170,"symbol":"_ZodType","kind":"interface","lang":"typescript","code":"interface _ZodType<out Internals extends core.$ZodTypeInternals = core.$ZodTypeInternals>\n extends ZodType<any, any, Internals> {}"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":173,"symbol":"ZodType","kind":"constant","lang":"typescript","code":"const ZodType: core.$constructor<ZodType> = /*@__PURE__*/ core.$constructor<ZodType>(\n \"ZodType\",\n (inst, def) => {\n _ensureDefaultLocale();\n core.$ZodType.init(inst, def);\n\n inst.def = def;\n inst.type = def.type;\n\n return inst;\n },\n {\n check(...chks) {\n const def = this.def;\n return this.clone(\n util.mergeDefs(def, {\n checks: [\n ...(def.checks ?? []),\n ...chks.map((ch) =>\n typeof ch === \"function\" ? { _zod: { check: ch, def: { check: \"custom\" }, onattach: [] } } : ch\n ),\n ],\n }),\n { parent: true }\n );\n },\n with(...chks) {\n return this.check(...chks);\n },\n clone(def, params) {\n return core.clone(this, def, params);\n },\n brand() {\n return this;\n },\n register(reg, meta) {\n reg.add(this, meta);\n return this;\n },\n refine(check, params) {\n return this.check(refine(check, params));\n },\n superRefine(refinement, params) {\n return this.check(superRefine(refinement, params));\n },\n overwrite(fn) {\n return this.check(checks.overwrite(fn));\n },\n optional() {\n return optional(this);\n "} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":185,"symbol":"check","kind":"method","lang":"typescript","code":"check(...chks) {\n const def = this.def;\n return this.clone(\n util.mergeDefs(def, {\n checks: [\n ...(def.checks ?? []),\n ...chks.map((ch) =>\n typeof ch === \"function\" ? { _zod: { check: ch, def: { check: \"custom\" }, onattach: [] } } : ch\n ),\n ],\n }),\n { parent: true }\n );\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":186,"symbol":"def","kind":"constant","lang":"typescript","code":"const def = this.def;"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":199,"symbol":"with","kind":"method","lang":"typescript","code":"with(...chks) {\n return this.check(...chks);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":202,"symbol":"clone","kind":"method","lang":"typescript","code":"clone(def, params) {\n return core.clone(this, def, params);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":205,"symbol":"brand","kind":"method","lang":"typescript","code":"brand() {\n return this;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":208,"symbol":"register","kind":"method","lang":"typescript","code":"register(reg, meta) {\n reg.add(this, meta);\n return this;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":212,"symbol":"refine","kind":"method","lang":"typescript","code":"refine(check, params) {\n return this.check(refine(check, params));\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":215,"symbol":"superRefine","kind":"method","lang":"typescript","code":"superRefine(refinement, params) {\n return this.check(superRefine(refinement, params));\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":218,"symbol":"overwrite","kind":"method","lang":"typescript","code":"overwrite(fn) {\n return this.check(checks.overwrite(fn));\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":221,"symbol":"optional","kind":"method","lang":"typescript","code":"optional() {\n return optional(this);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":224,"symbol":"exactOptional","kind":"method","lang":"typescript","code":"exactOptional() {\n return exactOptional(this);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":227,"symbol":"nullable","kind":"method","lang":"typescript","code":"nullable() {\n return nullable(this);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":230,"symbol":"nullish","kind":"method","lang":"typescript","code":"nullish() {\n return optional(nullable(this));\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":233,"symbol":"nonoptional","kind":"method","lang":"typescript","code":"nonoptional(params) {\n return nonoptional(this, params);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":236,"symbol":"array","kind":"method","lang":"typescript","code":"array() {\n return array(this);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":239,"symbol":"or","kind":"method","lang":"typescript","code":"or(arg) {\n return union([this, arg]);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":242,"symbol":"and","kind":"method","lang":"typescript","code":"and(arg) {\n return intersection(this, arg);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":245,"symbol":"transform","kind":"method","lang":"typescript","code":"transform(tx) {\n return pipe(this, transform(tx));\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":248,"symbol":"default","kind":"method","lang":"typescript","code":"default(d) {\n return _default(this, d);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":251,"symbol":"prefault","kind":"method","lang":"typescript","code":"prefault(d) {\n return prefault(this, d);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":254,"symbol":"catch","kind":"method","lang":"typescript","code":"catch(params) {\n return _catch(this, params);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":257,"symbol":"pipe","kind":"method","lang":"typescript","code":"pipe(target) {\n return pipe(this, target);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":260,"symbol":"readonly","kind":"method","lang":"typescript","code":"readonly() {\n return readonly(this);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":263,"symbol":"describe","kind":"method","lang":"typescript","code":"describe(description) {\n const cl = this.clone();\n core.globalRegistry.add(cl, { description });\n return cl;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":264,"symbol":"cl","kind":"constant","lang":"typescript","code":"const cl = this.clone();"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":268,"symbol":"meta","kind":"method","lang":"typescript","code":"meta(...args: any[]): any {\n // overloaded: meta() returns the registered metadata, meta(data) returns a clone with `data` registered. The mapped type picks up the second overload, so we accept variadic any-args and return `any` to satisfy both at runtime.\n if (args.length === 0) return core.globalRegistry.get(this);\n const cl = this.clone();\n core.globalRegistry.add(cl, args[0]);\n return cl;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":271,"symbol":"cl","kind":"constant","lang":"typescript","code":"const cl = this.clone();"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":275,"symbol":"isOptional","kind":"method","lang":"typescript","code":"isOptional() {\n return this.safeParse(undefined).success;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":278,"symbol":"isNullable","kind":"method","lang":"typescript","code":"isNullable() {\n return this.safeParse(null).success;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":281,"symbol":"apply","kind":"method","lang":"typescript","code":"apply(fn, ...args) {\n return args.length === 0 ? fn(this) : fn(this, ...args);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":303,"symbol":"safeParse","kind":"method","lang":"typescript","code":"safeParse(data, params) {\n return parse.safeParse(this, data, params);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":306,"symbol":"safeParseAsync","kind":"method","lang":"typescript","code":"async safeParseAsync(data, params) {\n return parse.safeParseAsync(this, data, params);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":310,"symbol":"spa","kind":"method","lang":"typescript","doc":"`spa` is an alias: same function object as `safeParseAsync`, as before.","code":"get spa(): ZodType[\"safeParseAsync\"] {\n return this?.safeParseAsync;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":313,"symbol":"spa","kind":"method","lang":"typescript","code":"set spa(value: ZodType[\"safeParseAsync\"]) {\n util.own(this, \"spa\", value);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":316,"symbol":"validate","kind":"method","lang":"typescript","code":"validate(data, params) {\n return parse.validate(this, data, params);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":319,"symbol":"validateAsync","kind":"method","lang":"typescript","code":"validateAsync(data, params) {\n return parse.validateAsync(this, data, params);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":334,"symbol":"safeEncode","kind":"method","lang":"typescript","code":"safeEncode(data, params) {\n return parse.safeEncode(this, data, params);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":337,"symbol":"safeDecode","kind":"method","lang":"typescript","code":"safeDecode(data, params) {\n return parse.safeDecode(this, data, params);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":340,"symbol":"safeEncodeAsync","kind":"method","lang":"typescript","code":"async safeEncodeAsync(data, params) {\n return parse.safeEncodeAsync(this, data, params);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":343,"symbol":"safeDecodeAsync","kind":"method","lang":"typescript","code":"async safeDecodeAsync(data, params) {\n return parse.safeDecodeAsync(this, data, params);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":346,"symbol":"toJSONSchema","kind":"method","lang":"typescript","code":"toJSONSchema(params) {\n return createToJSONSchemaMethod(this, {})(params);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":350,"symbol":"description","kind":"method","lang":"typescript","doc":"Reads through to the registry on every access, so it must not cache.","code":"get description(): string | undefined {\n return core.globalRegistry.get(this as unknown as ZodType)?.description;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":354,"symbol":"_def","kind":"method","lang":"typescript","doc":"No setter: `schema._def = x` throws, as it did when `_def` was a non-writable own property.","code":"get _def(): core.$ZodTypeDef {\n return (this as unknown as ZodType)._zod.def;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":361,"symbol":"_ZodString","kind":"interface","lang":"typescript","doc":"ZodString","code":"interface _ZodString<T extends core.$ZodStringInternals<unknown> = core.$ZodStringInternals<unknown>>\n extends _ZodType<T> {\n format: string | null;\n minLength: number | null;\n maxLength: number | null;\n\n // miscellaneous checks\n regex(regex: RegExp, params?: string | core.$ZodCheckRegexParams): this;\n includes(value: string, params?: string | core.$ZodCheckIncludesParams): this;\n startsWith(value: string, params?: string | core.$ZodCheckStartsWithParams): this;\n endsWith(value: string, params?: string | core.$ZodCheckEndsWithParams): this;\n min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;\n max(maxLength: number, params?: string | core.$ZodCheckMaxLengthParams): this;\n length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;\n nonempty(params?: string | core.$ZodCheckMinLengthParams): this;\n lowercase(params?: string | core.$ZodCheckLowerCaseParams): this;\n uppercase(params?: string | core.$ZodCheckUpperCaseParams): this;\n\n // transforms\n trim(): this;\n normalize(form?: \"NFC\" | \"NFD\" | \"NFKC\" | \"NFKD\" | (string & {})): this;\n toLowerCase(): this;\n toUpperCase(): this;\n slugify(): this;\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":388,"symbol":"_ZodString","kind":"constant","lang":"typescript","doc":"@internal","code":"const _ZodString: core.$constructor<_ZodString> = /*@__PURE__*/ core.$constructor<_ZodString>(\n \"_ZodString\",\n (inst, def) => {\n core.$ZodString.init(inst, def);\n ZodType.init(inst, def);\n\n inst._zod.processJSONSchema = (ctx, json, params) => processors.stringProcessor(inst, ctx, json, params);\n },\n /*@__PURE__*/ util.derived<_ZodString>(\n {\n format: (inst) => processors.aggregateChecks(inst).format ?? null,\n minLength: (inst) => processors.aggregateChecks<number>(inst).minimum ?? null,\n maxLength: (inst) => processors.aggregateChecks<number>(inst).maximum ?? null,\n },\n {\n regex(...args) {\n return this.check((checks.regex as any)(...args));\n },\n includes(...args) {\n return this.check((checks.includes as any)(...args));\n },\n startsWith(...args) {\n return this.check((checks.startsWith as any)(...args));\n },\n endsWith(...args) {\n return this.check((checks.endsWith as any)(...args));\n },\n min(...args) {\n return this.check((checks.minLength as any)(...args));\n },\n max(...args) {\n return this.check((checks.maxLength as any)(...args));\n },\n length"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":403,"symbol":"regex","kind":"method","lang":"typescript","code":"regex(...args) {\n return this.check((checks.regex as any)(...args));\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":406,"symbol":"includes","kind":"method","lang":"typescript","code":"includes(...args) {\n return this.check((checks.includes as any)(...args));\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":409,"symbol":"startsWith","kind":"method","lang":"typescript","code":"startsWith(...args) {\n return this.check((checks.startsWith as any)(...args));\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":412,"symbol":"endsWith","kind":"method","lang":"typescript","code":"endsWith(...args) {\n return this.check((checks.endsWith as any)(...args));\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":415,"symbol":"min","kind":"method","lang":"typescript","code":"min(...args) {\n return this.check((checks.minLength as any)(...args));\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":418,"symbol":"max","kind":"method","lang":"typescript","code":"max(...args) {\n return this.check((checks.maxLength as any)(...args));\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":421,"symbol":"length","kind":"method","lang":"typescript","code":"length(...args) {\n return this.check((checks.length as any)(...args));\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":424,"symbol":"nonempty","kind":"method","lang":"typescript","code":"nonempty(...args) {\n return this.check((checks.minLength as any)(1, ...args));\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/schemas.ts","line":427,"symbol":"lowercase","kind":"method","lang":"typescript","code":"lowercase(params) {\n return this.check(checks.lowercase(params));\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/anyunknown.test.ts","line":6,"symbol":"t1","kind":"constant","lang":"typescript","code":"const t1 = z.any();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/anyunknown.test.ts","line":9,"symbol":"t1","kind":"type","lang":"typescript","code":"type t1 = z.infer<typeof t1>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/anyunknown.test.ts","line":14,"symbol":"t1","kind":"constant","lang":"typescript","code":"const t1 = z.unknown();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/anyunknown.test.ts","line":17,"symbol":"t1","kind":"type","lang":"typescript","code":"type t1 = z.infer<typeof t1>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/anyunknown.test.ts","line":22,"symbol":"t1","kind":"constant","lang":"typescript","code":"const t1 = z.never();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/apply.test.ts","line":6,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n a: z.number(),\n b: z.string(),\n })\n .apply((s) => s.omit({ b: true }))\n .apply((s) => s.extend({ c: z.boolean() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/apply.test.ts","line":40,"symbol":"setCommonNumberChecks","kind":"constant","lang":"typescript","code":"const setCommonNumberChecks = <T extends z.ZodNumber>(schema: T) => {\n return schema.min(0).max(100);\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/apply.test.ts","line":44,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().apply(setCommonNumberChecks).nullable();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/apply.test.ts","line":54,"symbol":"symbol","kind":"constant","lang":"typescript","code":"const symbol = Symbol();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/apply.test.ts","line":55,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.number().apply(() => symbol);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/apply.test.ts","line":62,"symbol":"withDefault","kind":"constant","lang":"typescript","code":"const withDefault = <TSchema extends z.ZodType>(schema: TSchema, defaultValue: z.output<TSchema>) => {\n return schema.nullish().transform((x) => x ?? defaultValue);\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/apply.test.ts","line":66,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().apply(withDefault, \"default-id\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/apply.test.ts","line":75,"symbol":"withMin","kind":"constant","lang":"typescript","code":"const withMin = (schema: z.ZodString, n: number) => schema.min(n);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/array.test.ts","line":5,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().array();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/array.test.ts","line":10,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.array(z.string()).min(2).max(2);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/array.test.ts","line":11,"symbol":"r1","kind":"constant","lang":"typescript","code":"const r1 = schema.safeParse([\"asdf\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/array.test.ts","line":26,"symbol":"r2","kind":"constant","lang":"typescript","code":"const r2 = schema.safeParse([\"asdf\", \"asdf\", \"asdf\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/array.test.ts","line":43,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.array(z.string()).length(2);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/array.test.ts","line":46,"symbol":"r1","kind":"constant","lang":"typescript","code":"const r1 = schema.safeParse([\"asdf\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/array.test.ts","line":62,"symbol":"r2","kind":"constant","lang":"typescript","code":"const r2 = schema.safeParse([\"asdf\", \"asdf\", \"asdf\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/array.test.ts","line":80,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().array().nonempty();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/array.test.ts","line":86,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().array().nonempty().max(2);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/array.test.ts","line":102,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().array();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/array.test.ts","line":108,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n people: z.string().array().min(2),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/array.test.ts","line":112,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({\n people: [123],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/array.test.ts","line":144,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.array(z.string()).nonempty().min(1).max(3);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/array.test.ts","line":145,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(new Array(3));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":107,"symbol":"lazySchema","kind":"constant","lang":"typescript","doc":"$ZodLazy","code":"const lazySchema = z.lazy(() => z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":167,"symbol":"Company","kind":"type","lang":"typescript","code":"type Company = {\n id: string;\n name: string;\n webAddress: string | null;\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":173,"symbol":"CompanySchema","kind":"constant","lang":"typescript","code":"const CompanySchema = z.object({\n id: z.string(),\n name: z.string(),\n webAddress: z.string().url().nullable(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":178,"symbol":"Company","kind":"constant","lang":"typescript","code":"const Company = z.toZod<Company>()(CompanySchema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":183,"symbol":"CoreCompany","kind":"constant","lang":"typescript","code":"const CoreCompany = core.toZod<Company>()(CompanySchema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":186,"symbol":"UtilCompany","kind":"constant","lang":"typescript","code":"const UtilCompany = z.core.util.toZod<Company>()(CompanySchema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":189,"symbol":"Complex","kind":"type","lang":"typescript","code":"type Complex = {\n kind: \"company\";\n nested: {\n founded: Date;\n tags: string[];\n };\n scores: Record<\"a\" | \"b\", number>;\n tuple: [string, number];\n status: \"active\" | \"inactive\";\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":200,"symbol":"Complex","kind":"constant","lang":"typescript","code":"const Complex = z.toZod<Complex>()(\n z.object({\n kind: z.literal(\"company\"),\n nested: z.object({\n founded: z.date(),\n tags: z.array(z.string()),\n }),\n scores: z.record(z.enum([\"a\", \"b\"]), z.number()),\n tuple: z.tuple([z.string(), z.number()]),\n status: z.union([z.literal(\"active\"), z.literal(\"inactive\")]),\n })\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":214,"symbol":"Items","kind":"type","lang":"typescript","code":"type Items = {\n items: { value: string }[];\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":218,"symbol":"Items","kind":"constant","lang":"typescript","code":"const Items = z.toZod<Items>()(\n z.object({\n items: z.array(z.object({ value: z.string() })),\n })\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":225,"symbol":"ReadonlyItem","kind":"type","lang":"typescript","code":"type ReadonlyItem = Readonly<{\n id: string;\n }>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":229,"symbol":"ReadonlyItem","kind":"constant","lang":"typescript","code":"const ReadonlyItem = z.toZod<ReadonlyItem>()(z.object({ id: z.string() }).readonly());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":232,"symbol":"Transformed","kind":"constant","lang":"typescript","code":"const Transformed = z.toZod<{ count: number }>()(\n z.object({\n count: z.string().transform((value) => value.length),\n })\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":241,"symbol":"SkillLevel","kind":"type","lang":"typescript","doc":"An enum target matches z.enum(...) even though the enum reference is not identical to the union of its members (#6524)","code":"enum SkillLevel {\n Noob = \"noob\",\n Pro = \"pro\",\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":245,"symbol":"Rank","kind":"type","lang":"typescript","code":"enum Rank {\n First = 1,\n Second = 2,\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":251,"symbol":"Enums","kind":"constant","lang":"typescript","code":"const Enums = z.toZod<{\n skill: SkillLevel;\n members: SkillLevel.Noob | SkillLevel.Pro;\n rank: Rank;\n maybe: SkillLevel | null;\n list: SkillLevel[];\n nested: { skill: SkillLevel };\n }>()(\n z.object({\n skill: z.enum(SkillLevel),\n members: z.enum(SkillLevel),\n rank: z.enum(Rank),\n maybe: z.enum(SkillLevel).nullable(),\n list: z.array(z.enum(SkillLevel)),\n nested: z.object({ skill: z.enum(SkillLevel) }),\n })\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":325,"symbol":"Intersected","kind":"type","lang":"typescript","doc":"An intersection and the flat object with the same keys are interchangeable as targets, since the normalizer flattens both.","code":"type Intersected = { a: number } & { b: string };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":326,"symbol":"viaAnd","kind":"constant","lang":"typescript","code":"const viaAnd = z.object({ a: z.number() }).and(z.object({ b: z.string() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":327,"symbol":"viaExtend","kind":"constant","lang":"typescript","code":"const viaExtend = z.object({ a: z.number() }).safeExtend({ b: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":351,"symbol":"_a","kind":"constant","lang":"typescript","code":"const _a: z.core.$ZodCheck = {} as any as z.core.$ZodChecks;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":352,"symbol":"_b","kind":"constant","lang":"typescript","code":"const _b: z.core.$ZodCheck = {} as any as z.core.$ZodStringFormatChecks;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":353,"symbol":"_c","kind":"constant","lang":"typescript","code":"const _c: z.core.$ZodType = {} as any as z.core.$ZodTypes;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":354,"symbol":"_d","kind":"constant","lang":"typescript","code":"const _d: z.core.$ZodType = {} as any as z.core.$ZodStringFormatTypes;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":377,"symbol":"_RefinedSchema","kind":"type","lang":"typescript","code":"type _RefinedSchema<T extends z.ZodType<object> | z.ZodUnion> = T extends z.ZodUnion\n ? RefinedUnionSchema<T> // <-- Type instantiation is excessively deep and possibly infinite.\n : T extends z.ZodType<object>\n ? RefinedTypeSchema<z.output<T>> // <-- Type instantiation is excessively deep and possibly infinite.\n : never;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":383,"symbol":"RefinedTypeSchema","kind":"type","lang":"typescript","code":"type RefinedTypeSchema<T extends object> = T;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":385,"symbol":"RefinedUnionSchema","kind":"type","lang":"typescript","code":"type RefinedUnionSchema<T extends z.ZodUnion> = T;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":389,"symbol":"SortItem","kind":"interface","lang":"typescript","code":"interface SortItem<T extends string> {\n key: T;\n order: string;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/assignability.test.ts","line":394,"symbol":"createSortItemSchema","kind":"constant","lang":"typescript","code":"const createSortItemSchema = <T extends z.ZodType<string>>(sortKeySchema: T) =>\n z.object({\n key: sortKeySchema,\n order: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":6,"symbol":"stringSchema","kind":"constant","lang":"typescript","doc":"string","code":"const stringSchema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":9,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = \"XXX\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":10,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = 12;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":12,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await stringSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":16,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await stringSchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":22,"symbol":"numberSchema","kind":"constant","lang":"typescript","doc":"number","code":"const numberSchema = z.number();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":24,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = 1234.2353;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":25,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = \"1234\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":27,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await numberSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":31,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await numberSchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":37,"symbol":"bigIntSchema","kind":"constant","lang":"typescript","doc":"bigInt","code":"const bigIntSchema = z.bigint();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":39,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = BigInt(145);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":40,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = 134;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":42,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await bigIntSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":46,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await bigIntSchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":52,"symbol":"booleanSchema","kind":"constant","lang":"typescript","doc":"boolean","code":"const booleanSchema = z.boolean();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":54,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = true;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":55,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = 1;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":57,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await booleanSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":61,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await booleanSchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":67,"symbol":"dateSchema","kind":"constant","lang":"typescript","doc":"date","code":"const dateSchema = z.date();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":69,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = new Date();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":70,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = new Date().toISOString();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":72,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await dateSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":76,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await dateSchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":82,"symbol":"undefinedSchema","kind":"constant","lang":"typescript","doc":"undefined","code":"const undefinedSchema = z.undefined();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":84,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = undefined;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":85,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = \"XXX\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":87,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await undefinedSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":91,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await undefinedSchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":97,"symbol":"nullSchema","kind":"constant","lang":"typescript","doc":"null","code":"const nullSchema = z.null();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":99,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = null;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":100,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = undefined;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":102,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await nullSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":106,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await nullSchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":112,"symbol":"anySchema","kind":"constant","lang":"typescript","doc":"any","code":"const anySchema = z.any();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":114,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = [{}];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":117,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await anySchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":127,"symbol":"unknownSchema","kind":"constant","lang":"typescript","doc":"unknown","code":"const unknownSchema = z.unknown();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":129,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = [\"asdf\", 124, () => {}];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":132,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await unknownSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":142,"symbol":"voidSchema","kind":"constant","lang":"typescript","doc":"void","code":"const voidSchema = z.void();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":144,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = undefined;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":145,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = 0;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":147,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await voidSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":151,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await voidSchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":157,"symbol":"arraySchema","kind":"constant","lang":"typescript","doc":"array","code":"const arraySchema = z.array(z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":159,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = [\"XXX\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":160,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = \"XXX\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":162,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await arraySchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":166,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await arraySchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":172,"symbol":"objectSchema","kind":"constant","lang":"typescript","doc":"object","code":"const objectSchema = z.object({ string: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":174,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = { string: \"XXX\" };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":175,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = { string: 12 };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":177,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await objectSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":181,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = await objectSchema.safeParseAsync(badData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":187,"symbol":"unionSchema","kind":"constant","lang":"typescript","doc":"union","code":"const unionSchema = z.union([z.string(), z.undefined()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":189,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = undefined;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":190,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = null;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-parsing.test.ts","line":192,"symbol":"goodResult","kind":"constant","lang":"typescript","code":"const goodResult = await unionSchema.safeParseAsync(goodData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-refinements.test.ts","line":7,"symbol":"s1","kind":"constant","lang":"typescript","doc":"throws ZodAsyncError","code":"const s1 = z.string().refine(async (_val) => true);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-refinements.test.ts","line":12,"symbol":"s1","kind":"constant","lang":"typescript","code":"const s1 = z.string().refine(async (_val) => true);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-refinements.test.ts","line":13,"symbol":"r1","kind":"constant","lang":"typescript","code":"const r1 = await s1.parseAsync(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-refinements.test.ts","line":16,"symbol":"s2","kind":"constant","lang":"typescript","code":"const s2 = z.string().refine(async (_val) => false);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-refinements.test.ts","line":17,"symbol":"r2","kind":"constant","lang":"typescript","code":"const r2 = await s2.safeParseAsync(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-refinements.test.ts","line":36,"symbol":"schema1","kind":"constant","lang":"typescript","code":"const schema1 = z.string().refine((_val) => Promise.resolve(true));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-refinements.test.ts","line":37,"symbol":"v1","kind":"constant","lang":"typescript","code":"const v1 = await schema1.parseAsync(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-refinements.test.ts","line":40,"symbol":"schema2","kind":"constant","lang":"typescript","code":"const schema2 = z.string().refine((_val) => Promise.resolve(false));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-refinements.test.ts","line":43,"symbol":"schema3","kind":"constant","lang":"typescript","code":"const schema3 = z.string().refine((_val) => Promise.resolve(true));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-refinements.test.ts","line":49,"symbol":"schema1","kind":"constant","lang":"typescript","code":"const schema1 = z.string().refine(async (val) => {\n return val.length > 5;\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-refinements.test.ts","line":53,"symbol":"r1","kind":"constant","lang":"typescript","code":"const r1 = await schema1.safeParseAsync(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/async-refinements.test.ts","line":65,"symbol":"r2","kind":"constant","lang":"typescript","code":"const r2 = await schema1.safeParseAsync(\"asdf123\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/base.test.ts","line":5,"symbol":"parse","kind":"constant","lang":"typescript","code":"const parse = z.string().parse;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/bigint.test.ts","line":5,"symbol":"gtFive","kind":"constant","lang":"typescript","code":"const gtFive = z.bigint().gt(BigInt(5));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/bigint.test.ts","line":6,"symbol":"gteFive","kind":"constant","lang":"typescript","code":"const gteFive = z.bigint().gte(BigInt(5));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/bigint.test.ts","line":7,"symbol":"ltFive","kind":"constant","lang":"typescript","code":"const ltFive = z.bigint().lt(BigInt(5));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/bigint.test.ts","line":8,"symbol":"lteFive","kind":"constant","lang":"typescript","code":"const lteFive = z.bigint().lte(BigInt(5));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/bigint.test.ts","line":9,"symbol":"positive","kind":"constant","lang":"typescript","code":"const positive = z.bigint().positive();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/bigint.test.ts","line":10,"symbol":"negative","kind":"constant","lang":"typescript","code":"const negative = z.bigint().negative();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/bigint.test.ts","line":11,"symbol":"nonnegative","kind":"constant","lang":"typescript","code":"const nonnegative = z.bigint().nonnegative();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/bigint.test.ts","line":12,"symbol":"nonpositive","kind":"constant","lang":"typescript","code":"const nonpositive = z.bigint().nonpositive();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/bigint.test.ts","line":13,"symbol":"multipleOfFive","kind":"constant","lang":"typescript","code":"const multipleOfFive = z.bigint().multipleOf(BigInt(5));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/bigint.test.ts","line":57,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.bigint().min(0n).max(23n).check(z.int64());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/bigint.test.ts","line":75,"symbol":"schema","kind":"constant","lang":"typescript","doc":"`value % 0n` throws RangeError, so the compiled path declines and the runtime reports the failure","code":"const schema = z.bigint().multipleOf(BigInt(0));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/bigint.test.ts","line":76,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(BigInt(10));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/bigint.test.ts","line":86,"symbol":"obj","kind":"constant","lang":"typescript","doc":"a zero divisor nested in an object must not break the surrounding parse","code":"const obj = z.object({ a: z.bigint().multipleOf(BigInt(0)), b: z.bigint() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":5,"symbol":"mySchema","kind":"constant","lang":"typescript","code":"const mySchema = z\n .object({\n name: z.string(),\n })\n .brand<\"superschema\">();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":12,"symbol":"MySchema","kind":"type","lang":"typescript","doc":"simple branding","code":"type MySchema = z.infer<typeof mySchema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":16,"symbol":"doStuff","kind":"constant","lang":"typescript","code":"const doStuff = (arg: MySchema) => arg;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":20,"symbol":"extendedSchema","kind":"constant","lang":"typescript","doc":"inheritance","code":"const extendedSchema = mySchema.brand<\"subschema\">();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":21,"symbol":"ExtendedSchema","kind":"type","lang":"typescript","code":"type ExtendedSchema = z.infer<typeof extendedSchema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":27,"symbol":"numberSchema","kind":"constant","lang":"typescript","doc":"number branding","code":"const numberSchema = z.number().brand<42>();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":28,"symbol":"NumberSchema","kind":"type","lang":"typescript","code":"type NumberSchema = z.infer<typeof numberSchema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":32,"symbol":"MyBrand","kind":"constant","lang":"typescript","doc":"symbol branding","code":"const MyBrand: unique symbol = Symbol(\"hello\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":33,"symbol":"MyBrand","kind":"type","lang":"typescript","code":"type MyBrand = typeof MyBrand;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":34,"symbol":"symbolBrand","kind":"constant","lang":"typescript","code":"const symbolBrand = z.number().brand<\"sup\">().brand<typeof MyBrand>();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":35,"symbol":"SymbolBrand","kind":"type","lang":"typescript","code":"type SymbolBrand = z.infer<typeof symbolBrand>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":40,"symbol":"age","kind":"constant","lang":"typescript","doc":"keeping brands out of input types","code":"const age = z.number().brand<\"age\">();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":42,"symbol":"Age","kind":"type","lang":"typescript","code":"type Age = z.infer<typeof age>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":43,"symbol":"AgeInput","kind":"type","lang":"typescript","code":"type AgeInput = z.input<typeof age>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":54,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string().brand<\"a\">();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":60,"symbol":"recordWithBrandedNumberKeys","kind":"constant","lang":"typescript","code":"const recordWithBrandedNumberKeys = z.record(z.string().brand(\"SomeBrand\"), z.number());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":61,"symbol":"recordWithBrandedNumberKeys","kind":"type","lang":"typescript","code":"type recordWithBrandedNumberKeys = z.infer<typeof recordWithBrandedNumberKeys>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":66,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().brand<\"A\">();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":67,"symbol":"Input","kind":"type","lang":"typescript","code":"type Input = z.input<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":68,"symbol":"Output","kind":"type","lang":"typescript","code":"type Output = z.output<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":77,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().brand<\"A\", \"out\">();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":78,"symbol":"Input","kind":"type","lang":"typescript","code":"type Input = z.input<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":79,"symbol":"Output","kind":"type","lang":"typescript","code":"type Output = z.output<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":88,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().brand<\"A\", \"in\">();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":89,"symbol":"Input","kind":"type","lang":"typescript","code":"type Input = z.input<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":90,"symbol":"Output","kind":"type","lang":"typescript","code":"type Output = z.output<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":99,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().brand<\"A\", \"inout\">();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":100,"symbol":"Input","kind":"type","lang":"typescript","code":"type Input = z.input<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/brand.test.ts","line":101,"symbol":"Output","kind":"type","lang":"typescript","code":"type Output = z.output<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":10,"symbol":"cb","kind":"constant","lang":"typescript","code":"const cb = () => {\n isCalled = true;\n return \"asdf\";\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":19,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await z.string().catch(\"default\").parseAsync(1243);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":34,"symbol":"stringWithDefault","kind":"constant","lang":"typescript","code":"const stringWithDefault = z\n .string()\n .transform((val) => val.toUpperCase())\n .catch(\"default\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":46,"symbol":"inp","kind":"type","lang":"typescript","code":"type inp = z.input<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":48,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":53,"symbol":"stringWithDefault","kind":"constant","lang":"typescript","code":"const stringWithDefault = z.string().optional().catch(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":60,"symbol":"inp","kind":"type","lang":"typescript","code":"type inp = z.input<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":62,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":67,"symbol":"stringWithDefault","kind":"constant","lang":"typescript","code":"const stringWithDefault = z.string().catch(\"asdf\").optional();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":69,"symbol":"inp","kind":"type","lang":"typescript","code":"type inp = z.input<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":71,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":76,"symbol":"complex","kind":"constant","lang":"typescript","code":"const complex = z\n .string()\n .catch(\"asdf\")\n .transform((val) => `${val}!`)\n .transform((val) => val.toUpperCase())\n .catch(\"qwer\")\n .unwrap()\n .optional()\n .catch(\"asdfasdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":92,"symbol":"stringWithRemovedDefault","kind":"constant","lang":"typescript","code":"const stringWithRemovedDefault = z.string().catch(\"asdf\").unwrap();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":94,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof stringWithRemovedDefault>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":99,"symbol":"inner","kind":"constant","lang":"typescript","code":"const inner = z.string().catch(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":100,"symbol":"outer","kind":"constant","lang":"typescript","code":"const outer = z.object({ inner }).catch({\n inner: \"asdf\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":103,"symbol":"input","kind":"type","lang":"typescript","code":"type input = z.input<typeof outer>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":105,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof outer>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":114,"symbol":"stringWithDefault","kind":"constant","lang":"typescript","code":"const stringWithDefault = z.string().catch(\"inner\").catch(\"outer\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":115,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringWithDefault.parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":117,"symbol":"resultDiff","kind":"constant","lang":"typescript","code":"const resultDiff = stringWithDefault.parse(5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":122,"symbol":"Fruits","kind":"type","lang":"typescript","code":"enum Fruits {\n apple = \"apple\",\n orange = \"orange\",\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":127,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n fruit: z.nativeEnum(Fruits).catch(Fruits.apple),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":138,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n fruit: z.enum([\"apple\", \"orange\"]).catch(\"apple\"),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":149,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n string: z.string(),\n obj: z.object({\n sub: z.object({\n lit: z.literal(\"a\"),\n subCatch: z.number().catch(23),\n }),\n midCatch: z.number().catch(42),\n }),\n number: z.number().catch(0),\n bool: z.boolean(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":176,"symbol":"issues","kind":"constant","lang":"typescript","code":"const issues = (error as z.ZodError).issues;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":218,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n age: z.number(),\n name: z.string().catch((ctx) => {\n ctx.issues;\n // issues = ctx.issues;\n\n return \"John Doe\";\n }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":228,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({\n age: null,\n name: null,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":249,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().catch((ctx) => {\n return String(ctx.input);\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":257,"symbol":"seen","kind":"constant","lang":"typescript","code":"const seen: unknown[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":258,"symbol":"cb","kind":"constant","lang":"typescript","code":"const cb = (ctx: z.core.$ZodCatchCtx) => {\n seen.push(ctx.value, ctx.input);\n return -1;\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":313,"symbol":"result","kind":"constant","lang":"typescript","doc":"A pipe hands its `out` schema the caller's issues array so an unrecognized key can survive to an enclosing intersection. The catch must not read that as its own inner failing.","code":"const result = z.strictObject({ a: z.string() }).pipe(z.any().catch(\"CAUGHT\")).safeParse({ a: \"x\", extra: 1 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":321,"symbol":"schema","kind":"constant","lang":"typescript","doc":"Forwarding the unrecognized key is what lets the intersection reconcile it. A catch that fired on it substituted its fallback into one side, and the merge threw out of safeParse.","code":"const schema = z.intersection(\n z.strictObject({ a: z.string() }).pipe(z.any().catch(\"CAUGHT\")),\n z.strictObject({ b: z.string() })\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":331,"symbol":"Node","kind":"constant","lang":"typescript","doc":"The memoizer marks a payload whose value is a node still being parsed. That mark has to survive the catch: an enclosing readonly must not freeze a half-built object, and the node's checks belong to the node itself rather than to the back-edge.","code":"const Node: any = z.object({\n get self() {\n return z\n .lazy(() => Node)\n .catch(null)\n .readonly()\n .optional();\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":332,"symbol":"self","kind":"method","lang":"typescript","code":"get self() {\n return z\n .lazy(() => Node)\n .catch(null)\n .readonly()\n .optional();\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":340,"symbol":"cyclic","kind":"constant","lang":"typescript","code":"const cyclic: any = {};"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":342,"symbol":"frozen","kind":"constant","lang":"typescript","code":"const frozen = Node.safeParse(cyclic);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":347,"symbol":"Checked","kind":"constant","lang":"typescript","code":"const Checked: any = z.object({\n get self() {\n return z\n .lazy(() => Checked)\n .catch(null)\n .refine(() => {\n checks++;\n return true;\n })\n .optional();\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":348,"symbol":"self","kind":"method","lang":"typescript","code":"get self() {\n return z\n .lazy(() => Checked)\n .catch(null)\n .refine(() => {\n checks++;\n return true;\n })\n .optional();\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":359,"symbol":"cyclic2","kind":"constant","lang":"typescript","code":"const cyclic2: any = {};"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":368,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z\n .strictObject({ a: z.string() })\n .pipe(\n z\n .object({ a: z.string() })\n .refine(() => false)\n .catch(() => {\n fired++;\n return { a: \"FALLBACK\" };\n })\n )\n .safeParse({ a: \"x\", extra: 1 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":387,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().catch(\"fallback\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":460,"symbol":"chains","kind":"constant","lang":"typescript","doc":"`.catch()` reads issues off the payload it passed down, so an optional that resolved a failure without clearing that array let the failure resurface. The pipe rows matter: a pipe shares the array with a different payload object.","code":"const chains: [string, () => z.ZodType][] = [\n [\n \"prefault.optional\",\n () =>\n z\n .undefined()\n .prefault(null as any)\n .optional(),\n ],\n [\n \"default.optional\",\n () =>\n z\n .undefined()\n .default(null as any)\n .optional(),\n ],\n [\"prefault.pipe.optional\", () => z.string().prefault(\"abc\").pipe(z.string().min(10)).optional()],\n [\"default.pipe.optional\", () => z.string().default(\"abc\").pipe(z.string().min(10)).optional()],\n [\n \"prefault.optional.optional\",\n () =>\n z\n .undefined()\n .prefault(null as any)\n .optional()\n .optional(),\n ],\n [\n \"prefault.pipe.optional.optional\",\n () => z.string().prefault(\"abc\").pipe(z.string().min(10)).optional().optional(),\n ],\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":518,"symbol":"schema","kind":"constant","lang":"typescript","doc":"A pipe marks the payload aborted when its `in` fails, and `util.aborted` tests that flag alone, so leaving it set skips every check after the optional.","code":"const schema = z\n .string()\n .min(10)\n .prefault(\"abc\")\n .pipe(z.string())\n .optional()\n .refine(() => false, \"REFINE RAN\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":526,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":533,"symbol":"schema","kind":"constant","lang":"typescript","doc":"Same as the optional case one wrapper over: a catch that clears only the issues leaves the flag set, skipping every check after it.","code":"const schema = z\n .string()\n .min(10)\n .pipe(z.string())\n .catch(\"FB\")\n .refine(() => false, \"REFINE RAN\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":540,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"abc\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":565,"symbol":"schema","kind":"constant","lang":"typescript","doc":"Reaching the async branch needs the catch's own inner to be async; an async refinement outside it leaves the inner sync.","code":"const schema = z\n .string()\n .refine(async () => false, \"INNER\")\n .pipe(z.string())\n .catch(\"FB\")\n .refine(() => false, \"REFINE RAN\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":580,"symbol":"inner","kind":"constant","lang":"typescript","doc":"A pipe runs its `out` on a payload sharing the caller's issues array, so a catch that rebinds its own reference leaves the caller's copy dirty.","code":"const inner = z.string().pipe(z.string().min(10).catch(\"FB\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/catch.test.ts","line":596,"symbol":"inner","kind":"constant","lang":"typescript","code":"const inner = z.string().pipe(\n z\n .string()\n .refine(async () => false, \"INNER\")\n .catch(\"FB\")\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":8,"symbol":"stringToNumber","kind":"constant","lang":"typescript","code":"const stringToNumber = () =>\n z.codec(z.string(), z.number(), {\n decode: (str) => Number.parseFloat(str),\n encode: (num) => num.toString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":15,"symbol":"codec","kind":"constant","lang":"typescript","code":"const codec = stringToNumber();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":28,"symbol":"original","kind":"constant","lang":"typescript","doc":"Test round trip","code":"const original = \"3.14159\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":29,"symbol":"roundTrip","kind":"constant","lang":"typescript","code":"const roundTrip = z.encode(codec, z.decode(codec, original));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":37,"symbol":"stringToInt","kind":"constant","lang":"typescript","code":"const stringToInt = () =>\n z.codec(z.string(), z.int(), {\n decode: (str) => Number.parseInt(str, 10),\n encode: (num) => num.toString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":44,"symbol":"codec","kind":"constant","lang":"typescript","code":"const codec = stringToInt();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":57,"symbol":"original","kind":"constant","lang":"typescript","doc":"Test round trip","code":"const original = \"999\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":58,"symbol":"roundTrip","kind":"constant","lang":"typescript","code":"const roundTrip = z.encode(codec, z.decode(codec, original));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":66,"symbol":"stringToBigInt","kind":"constant","lang":"typescript","code":"const stringToBigInt = () =>\n z.codec(z.string(), z.bigint(), {\n decode: (str) => BigInt(str),\n encode: (bigint) => bigint.toString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":73,"symbol":"codec","kind":"constant","lang":"typescript","code":"const codec = stringToBigInt();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":86,"symbol":"original","kind":"constant","lang":"typescript","doc":"Test round trip","code":"const original = \"987654321098765432109876543210\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":87,"symbol":"roundTrip","kind":"constant","lang":"typescript","code":"const roundTrip = z.encode(codec, z.decode(codec, original));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":95,"symbol":"numberToBigInt","kind":"constant","lang":"typescript","code":"const numberToBigInt = () =>\n z.codec(z.int(), z.bigint(), {\n decode: (num) => BigInt(num),\n encode: (bigint) => Number(bigint),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":102,"symbol":"codec","kind":"constant","lang":"typescript","code":"const codec = numberToBigInt();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":115,"symbol":"original","kind":"constant","lang":"typescript","doc":"Test round trip","code":"const original = 999;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":116,"symbol":"roundTrip","kind":"constant","lang":"typescript","code":"const roundTrip = z.encode(codec, z.decode(codec, original));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":124,"symbol":"isoDatetimeToDate","kind":"constant","lang":"typescript","code":"const isoDatetimeToDate = () =>\n z.codec(z.iso.datetime(), z.date(), {\n decode: (isoString) => new Date(isoString),\n encode: (date) => date.toISOString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":131,"symbol":"codec","kind":"constant","lang":"typescript","code":"const codec = isoDatetimeToDate();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":134,"symbol":"decoded","kind":"constant","lang":"typescript","doc":"Test decode","code":"const decoded = z.decode(codec, \"2024-01-15T10:30:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":139,"symbol":"date","kind":"constant","lang":"typescript","doc":"Test encode","code":"const date = new Date(\"2024-01-15T10:30:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":143,"symbol":"original","kind":"constant","lang":"typescript","doc":"Test round trip","code":"const original = \"2024-12-25T15:45:30.123Z\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":144,"symbol":"roundTrip","kind":"constant","lang":"typescript","code":"const roundTrip = z.encode(codec, z.decode(codec, original));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":152,"symbol":"epochSecondsToDate","kind":"constant","lang":"typescript","code":"const epochSecondsToDate = () =>\n z.codec(z.int().min(0), z.date(), {\n decode: (seconds) => new Date(seconds * 1000),\n encode: (date) => Math.floor(date.getTime() / 1000),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":159,"symbol":"codec","kind":"constant","lang":"typescript","code":"const codec = epochSecondsToDate();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":162,"symbol":"decoded","kind":"constant","lang":"typescript","doc":"Test decode","code":"const decoded = z.decode(codec, 1705314600);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":167,"symbol":"date","kind":"constant","lang":"typescript","doc":"Test encode","code":"const date = new Date(1705314600000);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":171,"symbol":"original","kind":"constant","lang":"typescript","doc":"Test round trip","code":"const original = 1640995200;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":172,"symbol":"roundTrip","kind":"constant","lang":"typescript","code":"const roundTrip = z.encode(codec, z.decode(codec, original));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":180,"symbol":"epochMillisToDate","kind":"constant","lang":"typescript","code":"const epochMillisToDate = () =>\n z.codec(z.int().min(0), z.date(), {\n decode: (millis) => new Date(millis),\n encode: (date) => date.getTime(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":187,"symbol":"codec","kind":"constant","lang":"typescript","code":"const codec = epochMillisToDate();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":190,"symbol":"decoded","kind":"constant","lang":"typescript","doc":"Test decode","code":"const decoded = z.decode(codec, 1705314600000);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":195,"symbol":"date","kind":"constant","lang":"typescript","doc":"Test encode","code":"const date = new Date(1705314600000);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":199,"symbol":"original","kind":"constant","lang":"typescript","doc":"Test round trip","code":"const original = 1640995200123;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":200,"symbol":"roundTrip","kind":"constant","lang":"typescript","code":"const roundTrip = z.encode(codec, z.decode(codec, original));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":208,"symbol":"jsonCodec","kind":"constant","lang":"typescript","code":"const jsonCodec = <T extends z.core.$ZodType>(schema: T) =>\n z.codec(z.string(), schema, {\n decode: (jsonString, ctx) => {\n try {\n return JSON.parse(jsonString);\n } catch (err: any) {\n ctx.issues.push({\n code: \"invalid_format\",\n format: \"json\",\n input: jsonString,\n message: err.message,\n });\n return z.NEVER;\n }\n },\n encode: (value) => JSON.stringify(value),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":227,"symbol":"codec","kind":"constant","lang":"typescript","code":"const codec = jsonCodec(z.object({ name: z.string(), age: z.number() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":230,"symbol":"decoded","kind":"constant","lang":"typescript","doc":"Test decode","code":"const decoded = z.decode(codec, '{\"name\":\"Alice\",\"age\":30}');"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":234,"symbol":"encoded","kind":"constant","lang":"typescript","doc":"Test encode","code":"const encoded = z.encode(codec, { name: \"Bob\", age: 25 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":238,"symbol":"original","kind":"constant","lang":"typescript","doc":"Test round trip","code":"const original = '{\"name\":\"Charlie\",\"age\":35}';"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":239,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = z.decode(codec, original);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":240,"symbol":"roundTrip","kind":"constant","lang":"typescript","code":"const roundTrip = z.encode(codec, parsed);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":248,"symbol":"utf8ToBytes","kind":"constant","lang":"typescript","code":"const utf8ToBytes = () =>\n z.codec(z.string(), z.instanceof(Uint8Array), {\n decode: (str) => new TextEncoder().encode(str),\n encode: (bytes) => new TextDecoder().decode(bytes),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":255,"symbol":"codec","kind":"constant","lang":"typescript","code":"const codec = utf8ToBytes();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":258,"symbol":"decoded","kind":"constant","lang":"typescript","doc":"Test decode","code":"const decoded = z.decode(codec, \"Hello, 世界!\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":263,"symbol":"bytes","kind":"constant","lang":"typescript","doc":"Test encode","code":"const bytes = new Uint8Array([72, 101, 108, 108, 111]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":267,"symbol":"original","kind":"constant","lang":"typescript","doc":"Test round trip","code":"const original = \"Hello, 世界! 🚀\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":268,"symbol":"roundTrip","kind":"constant","lang":"typescript","code":"const roundTrip = z.encode(codec, z.decode(codec, original));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":276,"symbol":"bytesToUtf8","kind":"constant","lang":"typescript","code":"const bytesToUtf8 = () =>\n z.codec(z.instanceof(Uint8Array), z.string(), {\n decode: (bytes) => new TextDecoder().decode(bytes),\n encode: (str) => new TextEncoder().encode(str),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":283,"symbol":"codec","kind":"constant","lang":"typescript","code":"const codec = bytesToUtf8();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":286,"symbol":"bytes","kind":"constant","lang":"typescript","doc":"Test decode","code":"const bytes = new Uint8Array([72, 101, 108, 108, 111]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":287,"symbol":"decoded","kind":"constant","lang":"typescript","code":"const decoded = z.decode(codec, bytes);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":291,"symbol":"encoded","kind":"constant","lang":"typescript","doc":"Test encode","code":"const encoded = z.encode(codec, \"Hello, 世界!\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":296,"symbol":"original","kind":"constant","lang":"typescript","doc":"Test round trip","code":"const original = new Uint8Array([72, 101, 108, 108, 111, 44, 32, 228, 184, 150, 231, 149, 140, 33]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":297,"symbol":"roundTrip","kind":"constant","lang":"typescript","code":"const roundTrip = z.encode(codec, z.decode(codec, original));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":305,"symbol":"base64","kind":"constant","lang":"typescript","code":"const base64 = () =>\n z.codec(z.base64(), z.instanceof(Uint8Array), {\n decode: (base64String) => z.util.base64ToUint8Array(base64String),\n encode: (bytes) => z.util.uint8ArrayToBase64(bytes),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":312,"symbol":"codec","kind":"constant","lang":"typescript","code":"const codec = base64();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":315,"symbol":"decoded","kind":"constant","lang":"typescript","doc":"Test decode","code":"const decoded = z.decode(codec, \"SGVsbG8=\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":320,"symbol":"bytes","kind":"constant","lang":"typescript","doc":"Test encode","code":"const bytes = new Uint8Array([72, 101, 108, 108, 111]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":324,"symbol":"original","kind":"constant","lang":"typescript","doc":"Test round trip","code":"const original = \"SGVsbG8gV29ybGQh\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec-examples.test.ts","line":325,"symbol":"roundTrip","kind":"constant","lang":"typescript","code":"const roundTrip = z.encode(codec, z.decode(codec, original));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":4,"symbol":"isoDateCodec","kind":"constant","lang":"typescript","code":"const isoDateCodec = z.codec(\n z.iso.datetime(), // Input: ISO string (validates to string)\n z.date(), // Output: Date object\n {\n decode: (isoString) => new Date(isoString), // Forward: ISO string → Date\n encode: (date) => date.toISOString(), // Backward: Date → ISO string\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":27,"symbol":"testIsoString","kind":"constant","lang":"typescript","code":"const testIsoString = \"2024-01-15T10:30:00.000Z\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":28,"symbol":"testDate","kind":"constant","lang":"typescript","code":"const testDate = new Date(\"2024-01-15T10:30:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":31,"symbol":"decodedResult","kind":"constant","lang":"typescript","doc":"Forward decoding (ISO string -> Date)","code":"const decodedResult = z.decode(isoDateCodec, testIsoString);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":36,"symbol":"encodedResult","kind":"constant","lang":"typescript","doc":"Backward encoding (Date -> ISO string)","code":"const encodedResult = z.encode(isoDateCodec, testDate);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":42,"symbol":"isoDateCodec","kind":"constant","lang":"typescript","code":"const isoDateCodec = z.codec(z.iso.datetime(), z.date(), {\n decode: (isoString) => new Date(isoString),\n encode: (date) => date.toISOString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":47,"symbol":"original","kind":"constant","lang":"typescript","code":"const original = \"2024-12-25T15:45:30.123Z\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":48,"symbol":"toDate","kind":"constant","lang":"typescript","code":"const toDate = z.decode(isoDateCodec, original);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":49,"symbol":"backToString","kind":"constant","lang":"typescript","code":"const backToString = z.encode(isoDateCodec, toDate);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":57,"symbol":"isoDateCodec","kind":"constant","lang":"typescript","code":"const isoDateCodec = z\n .codec(z.iso.datetime(), z.date(), {\n decode: (isoString) => new Date(isoString),\n encode: (date) => date.toISOString(),\n })\n .refine((val) => val.getFullYear() === 2024, { error: \"Year must be 2024\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":65,"symbol":"validDate","kind":"constant","lang":"typescript","doc":"Valid 2024 date","code":"const validDate = z.decode(isoDateCodec, \"2024-01-15T10:30:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":70,"symbol":"invalidYearResult","kind":"constant","lang":"typescript","doc":"Invalid year should fail safely","code":"const invalidYearResult = z.safeDecode(isoDateCodec, \"2023-01-15T10:30:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":86,"symbol":"isoDateCodec","kind":"constant","lang":"typescript","code":"const isoDateCodec = z.codec(z.iso.datetime(), z.date(), {\n decode: (isoString) => new Date(isoString),\n encode: (date) => date.toISOString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":92,"symbol":"safeDecodeResult","kind":"constant","lang":"typescript","doc":"Safe decode with invalid input","code":"const safeDecodeResult = z.safeDecode(isoDateCodec, \"invalid-date\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":110,"symbol":"safeDecodeValid","kind":"constant","lang":"typescript","doc":"Safe decode with valid input","code":"const safeDecodeValid = z.safeDecode(isoDateCodec, \"2024-01-15T10:30:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":118,"symbol":"safeEncodeResult","kind":"constant","lang":"typescript","doc":"Safe encode with valid input","code":"const safeEncodeResult = z.safeEncode(isoDateCodec, new Date(\"2024-01-01\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":127,"symbol":"stringNumberCodec","kind":"constant","lang":"typescript","doc":"String -> Number codec","code":"const stringNumberCodec = z.codec(z.string(), z.number(), {\n decode: (str) => Number.parseFloat(str),\n encode: (num) => num.toString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":132,"symbol":"decodedNumber","kind":"constant","lang":"typescript","code":"const decodedNumber = z.decode(stringNumberCodec, \"42.5\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":136,"symbol":"encodedString","kind":"constant","lang":"typescript","code":"const encodedString = z.encode(stringNumberCodec, 42.5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":142,"symbol":"isoDateCodec","kind":"constant","lang":"typescript","code":"const isoDateCodec = z.codec(z.iso.datetime(), z.date(), {\n decode: (isoString) => new Date(isoString),\n encode: (date) => date.toISOString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":148,"symbol":"decodedResult","kind":"constant","lang":"typescript","doc":"Async decode","code":"const decodedResult = await z.decodeAsync(isoDateCodec, \"2024-01-15T10:30:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":153,"symbol":"encodedResult","kind":"constant","lang":"typescript","doc":"Async encode","code":"const encodedResult = await z.encodeAsync(isoDateCodec, new Date(\"2024-01-15T10:30:00.000Z\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":158,"symbol":"safeDecodeResult","kind":"constant","lang":"typescript","doc":"Safe async operations","code":"const safeDecodeResult = await z.safeDecodeAsync(isoDateCodec, \"2024-01-15T10:30:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":164,"symbol":"safeEncodeResult","kind":"constant","lang":"typescript","code":"const safeEncodeResult = await z.safeEncodeAsync(isoDateCodec, new Date(\"2024-01-15T10:30:00.000Z\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":172,"symbol":"codec","kind":"constant","lang":"typescript","code":"const codec = z.codec(z.string(), z.number(), {\n decode: (str) => Number.parseInt(str),\n encode: (num) => num.toString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":178,"symbol":"decoded","kind":"constant","lang":"typescript","doc":"These should compile without type errors","code":"const decoded: number = z.decode(codec, \"123\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":179,"symbol":"encoded","kind":"constant","lang":"typescript","code":"const encoded: string = z.encode(codec, 123);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":187,"symbol":"waypointSchema","kind":"constant","lang":"typescript","doc":"Nested schema: object containing a codec as one of its properties, with refinements at all levels","code":"const waypointSchema = z\n .object({\n name: z.string().min(1, \"Waypoint name required\"),\n difficulty: z.enum([\"easy\", \"medium\", \"hard\"]),\n coordinate: z\n .codec(\n z\n .string()\n .regex(/^-?\\d+,-?\\d+$/, \"Must be 'x,y' format\"), // Input: coordinate string\n z\n .object({ x: z.number(), y: z.number() })\n .refine((coord) => coord.x >= 0 && coord.y >= 0, { error: \"Coordinates must be non-negative\" }), // Output: coordinate object\n {\n decode: (coordString: string) => {\n const [x, y] = coordString.split(\",\").map(Number);\n return { x, y };\n },\n encode: (coord: { x: number; y: number }) => `${coord.x},${coord.y}`,\n }\n )\n .refine((coord) => coord.x <= 1000 && coord.y <= 1000, { error: \"Coordinates must be within bounds\" }),\n })\n .refine((waypoint) => waypoint.difficulty !== \"hard\" || waypoint.coordinate.x >= 100, {\n error: \"Hard waypoints must be at least 100 units from origin\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":214,"symbol":"inputWaypoint","kind":"constant","lang":"typescript","doc":"Test data","code":"const inputWaypoint = {\n name: \"Summit Point\",\n difficulty: \"medium\" as const,\n coordinate: \"150,200\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":221,"symbol":"decodedWaypoint","kind":"constant","lang":"typescript","doc":"Forward decoding (object with string coordinate -> object with coordinate object)","code":"const decodedWaypoint = z.decode(waypointSchema, inputWaypoint);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":234,"symbol":"encodedWaypoint","kind":"constant","lang":"typescript","doc":"Backward encoding (object with coordinate object -> object with string coordinate)","code":"const encodedWaypoint = z.encode(waypointSchema, decodedWaypoint);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":246,"symbol":"emptyNameResult","kind":"constant","lang":"typescript","doc":"String validation (empty waypoint name)","code":"const emptyNameResult = z.safeDecode(waypointSchema, {\n name: \"\",\n difficulty: \"easy\",\n coordinate: \"10,20\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":270,"symbol":"invalidDifficultyResult","kind":"constant","lang":"typescript","doc":"Enum validation (invalid difficulty)","code":"const invalidDifficultyResult = z.safeDecode(waypointSchema, {\n name: \"Test Point\",\n difficulty: \"impossible\" as any,\n coordinate: \"10,20\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":296,"symbol":"invalidFormatResult","kind":"constant","lang":"typescript","doc":"Codec string format validation (invalid coordinate format)","code":"const invalidFormatResult = z.safeDecode(waypointSchema, {\n name: \"Test Point\",\n difficulty: \"easy\",\n coordinate: \"invalid\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":320,"symbol":"negativeCoordResult","kind":"constant","lang":"typescript","doc":"Codec object refinement (negative coordinates)","code":"const negativeCoordResult = z.safeDecode(waypointSchema, {\n name: \"Test Point\",\n difficulty: \"easy\",\n coordinate: \"-5,10\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":341,"symbol":"outOfBoundsResult","kind":"constant","lang":"typescript","doc":"Codec-level refinement (coordinates out of bounds)","code":"const outOfBoundsResult = z.safeDecode(waypointSchema, {\n name: \"Test Point\",\n difficulty: \"easy\",\n coordinate: \"1500,2000\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":362,"symbol":"hardWaypointResult","kind":"constant","lang":"typescript","doc":"Object-level refinement (hard waypoint too close to origin)","code":"const hardWaypointResult = z.safeDecode(waypointSchema, {\n name: \"Expert Point\",\n difficulty: \"hard\",\n coordinate: \"50,60\", // x < 100, but hard waypoints need x >= 100\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":381,"symbol":"roundTripResult","kind":"constant","lang":"typescript","doc":"Round trip test","code":"const roundTripResult = z.encode(waypointSchema, z.decode(waypointSchema, inputWaypoint));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":392,"symbol":"A","kind":"constant","lang":"typescript","code":"const A = z.codec(z.string(), z.string().trim(), {\n decode: (val) => val,\n encode: (val) => val,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":400,"symbol":"B","kind":"constant","lang":"typescript","code":"const B = z\n .codec(z.string(), z.string(), {\n decode: (val) => val,\n encode: (val) => val,\n })\n .check(z.trim(), z.maxLength(4));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":413,"symbol":"stringToNumberCodec","kind":"constant","lang":"typescript","doc":"Test that codec functions have correct type signatures","code":"const stringToNumberCodec = z.codec(z.string(), z.number(), {\n decode: (value: string) => Number(value), // core.output<A> -> core.input<B>\n encode: (value: number) => String(value), // core.input<B> -> core.output<A>\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":427,"symbol":"validDecode","kind":"constant","lang":"typescript","doc":"Test that decode parameter type is core.output<A> (string)","code":"const validDecode = (value: string) => Number(value);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":431,"symbol":"validEncode","kind":"constant","lang":"typescript","doc":"Test that encode parameter type is core.input<B> (number)","code":"const validEncode = (value: number) => String(value);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":460,"symbol":"User","kind":"type","lang":"typescript","code":"type User = { id: number; name: string };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":461,"symbol":"UserInput","kind":"type","lang":"typescript","code":"type UserInput = { id: string; name: string };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":463,"symbol":"userCodec","kind":"constant","lang":"typescript","code":"const userCodec = z.codec(\n z.object({ id: z.string(), name: z.string() }),\n z.object({ id: z.number(), name: z.string() }),\n {\n decode: (input: UserInput) => ({ id: Number(input.id), name: input.name }),\n encode: (user: User) => ({ id: String(user.id), name: user.name }),\n }\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":508,"symbol":"stringPlusA","kind":"constant","lang":"typescript","code":"const stringPlusA = z.string().overwrite((val) => val + \"a\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":509,"symbol":"A","kind":"constant","lang":"typescript","code":"const A = z\n .codec(stringPlusA, stringPlusA, {\n decode: (val) => val,\n encode: (val) => val,\n })\n .overwrite((val) => val + \"a\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":537,"symbol":"asyncCodec","kind":"constant","lang":"typescript","doc":"Test that async encode/decode functions work properly","code":"const asyncCodec = z.codec(z.string(), z.number(), {\n decode: async (str) => {\n await new Promise((resolve) => setTimeout(resolve, 1)); // Simulate async work\n return Number.parseFloat(str);\n },\n encode: async (num) => {\n await new Promise((resolve) => setTimeout(resolve, 1)); // Simulate async work\n return num.toString();\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":549,"symbol":"decoded","kind":"constant","lang":"typescript","doc":"Test async decode/encode","code":"const decoded = await z.decodeAsync(asyncCodec, \"42.5\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":552,"symbol":"encoded","kind":"constant","lang":"typescript","code":"const encoded = await z.encodeAsync(asyncCodec, 42.5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":556,"symbol":"mixedCodec","kind":"constant","lang":"typescript","doc":"Test that both sync and async work","code":"const mixedCodec = z.codec(z.string(), z.number(), {\n decode: async (str) => Number.parseFloat(str),\n encode: (num) => num.toString(), // sync encode\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":561,"symbol":"mixedResult","kind":"constant","lang":"typescript","code":"const mixedResult = await z.decodeAsync(mixedCodec, \"123\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":566,"symbol":"inverted","kind":"constant","lang":"typescript","code":"const inverted = z.invertCodec(isoDateCodec);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":568,"symbol":"testDate","kind":"constant","lang":"typescript","code":"const testDate = new Date(\"2024-01-15T10:30:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":569,"symbol":"decoded","kind":"constant","lang":"typescript","code":"const decoded = z.decode(inverted, testDate);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":573,"symbol":"encoded","kind":"constant","lang":"typescript","code":"const encoded = z.encode(inverted, \"2024-01-15T10:30:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":579,"symbol":"inverted","kind":"constant","lang":"typescript","code":"const inverted = z.invertCodec(isoDateCodec);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":580,"symbol":"testDate","kind":"constant","lang":"typescript","code":"const testDate = new Date(\"2024-06-01T12:00:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/codec.test.ts","line":582,"symbol":"toStr","kind":"constant","lang":"typescript","code":"const toStr = z.decode(inverted, testDate);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/coerce.test.ts","line":6,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.coerce.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/coerce.test.ts","line":28,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.coerce.number();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/coerce.test.ts","line":54,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.coerce.boolean();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/coerce.test.ts","line":79,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.coerce.bigint();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/coerce.test.ts","line":105,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.coerce.date();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/coerce.test.ts","line":155,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.coerce.string<any>();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/coerce.test.ts","line":156,"symbol":"input","kind":"type","lang":"typescript","code":"type input = z.input<typeof a>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/coerce.test.ts","line":158,"symbol":"output","kind":"type","lang":"typescript","code":"type output = z.infer<typeof a>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/credit-card.test.ts","line":6,"symbol":"valid","kind":"constant","lang":"typescript","doc":"Luhn-valid PANs. The last four are the schemes an issuer allowlist would turn away — validation is shape plus Luhn only, so the BIN is never consulted.","code":"const valid: [string, string][] = [\n [\"Visa\", \"4111111111111111\"],\n [\"Visa (13)\", \"4007000000027\"],\n [\"Mastercard\", \"5555555555554444\"],\n [\"AmEx\", \"378282246310005\"],\n [\"Discover\", \"6011111111111117\"],\n [\"JCB\", \"3530111333300000\"],\n [\"Diners Club\", \"30569309025904\"],\n [\"UnionPay\", \"6200000000000005\"],\n [\"Mir\", \"2200000000000004\"],\n [\"Elo\", \"6362000000000009\"],\n [\"Discover 644-649\", \"6450000000000002\"],\n [\"Troy\", \"9792000000000003\"],\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/credit-card.test.ts","line":64,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.fromJSONSchema(z.toJSONSchema(z.creditCard()));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/credit-card.test.ts","line":70,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.creditCard().safeParse(\"not-a-card\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/custom.test.ts","line":6,"symbol":"example1","kind":"constant","lang":"typescript","code":"const example1 = z.custom<number>((x) => typeof x === \"number\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/custom.test.ts","line":12,"symbol":"example1","kind":"constant","lang":"typescript","code":"const example1 = z.custom<number>((x) => typeof x !== \"number\", \"customerr\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/custom.test.ts","line":13,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = example1.safeParse(1234);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/custom.test.ts","line":19,"symbol":"fn","kind":"constant","lang":"typescript","code":"const fn = (value: string) => Uint8Array.from(Buffer.from(value, \"base64\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/custom.test.ts","line":26,"symbol":"A","kind":"constant","lang":"typescript","code":"const A = z\n .custom<string>((val) => typeof val === \"string\")\n .transform((_) => {\n throw new Error(\"Invalid input\");\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":7,"symbol":"Node","kind":"constant","lang":"typescript","code":"const Node: any = z.object({\n id: z.number(),\n get self() {\n return Node;\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":9,"symbol":"self","kind":"method","lang":"typescript","code":"get self() {\n return Node;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":14,"symbol":"input","kind":"constant","lang":"typescript","code":"const input: any = { id: 1 };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":17,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = Node.parse(input);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":24,"symbol":"A","kind":"constant","lang":"typescript","code":"const A: any = z.object({\n x: z.string(),\n get b() {\n return B;\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":26,"symbol":"b","kind":"method","lang":"typescript","code":"get b() {\n return B;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":30,"symbol":"B","kind":"constant","lang":"typescript","code":"const B: any = z.object({\n y: z.number(),\n get a() {\n return A;\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":32,"symbol":"a","kind":"method","lang":"typescript","code":"get a() {\n return A;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":37,"symbol":"input","kind":"constant","lang":"typescript","code":"const input: any = { x: \"s\", y: 1 };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":41,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = A.parse(input);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":47,"symbol":"bad","kind":"constant","lang":"typescript","code":"const bad: any = { x: \"s\", y: \"not a number\" };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":54,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases: [string, () => { schema: any; input: any }][] = [\n [\n \"array\",\n () => {\n const S: any = z.object({\n id: z.number(),\n get kids() {\n return z.array(S);\n },\n });\n const a: any = { id: 1, kids: [] };\n a.kids.push(a);\n return { schema: S, input: a };\n },\n ],\n [\n \"record\",\n () => {\n const S: any = z.object({\n id: z.number(),\n get kids() {\n return z.record(z.string(), S);\n },\n });\n const a: any = { id: 1, kids: {} };\n a.kids.self = a;\n return { schema: S, input: a };\n },\n ],\n [\n \"tuple\",\n () => {\n const S: any = z.object({\n id: z.number(),\n get pair() {\n return z.tuple([z.number(), S]);\n },\n });\n const a: any = { id: 1 };\n a.pair = [1, a];\n return { schema: S, input: a };\n },\n ],\n [\n \"set\",\n () => {\n const S: any = z.object({\n id: z.number(),\n get peers() {\n return z.set(S);\n },\n });\n const a: any = { id: 1, peers: new Set() };\n"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":58,"symbol":"S","kind":"constant","lang":"typescript","code":"const S: any = z.object({\n id: z.number(),\n get kids() {\n return z.array(S);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":60,"symbol":"kids","kind":"method","lang":"typescript","code":"get kids() {\n return z.array(S);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":64,"symbol":"a","kind":"constant","lang":"typescript","code":"const a: any = { id: 1, kids: [] };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":72,"symbol":"S","kind":"constant","lang":"typescript","code":"const S: any = z.object({\n id: z.number(),\n get kids() {\n return z.record(z.string(), S);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":74,"symbol":"kids","kind":"method","lang":"typescript","code":"get kids() {\n return z.record(z.string(), S);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":78,"symbol":"a","kind":"constant","lang":"typescript","code":"const a: any = { id: 1, kids: {} };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":86,"symbol":"S","kind":"constant","lang":"typescript","code":"const S: any = z.object({\n id: z.number(),\n get pair() {\n return z.tuple([z.number(), S]);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":88,"symbol":"pair","kind":"method","lang":"typescript","code":"get pair() {\n return z.tuple([z.number(), S]);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":92,"symbol":"a","kind":"constant","lang":"typescript","code":"const a: any = { id: 1 };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":100,"symbol":"S","kind":"constant","lang":"typescript","code":"const S: any = z.object({\n id: z.number(),\n get peers() {\n return z.set(S);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":102,"symbol":"peers","kind":"method","lang":"typescript","code":"get peers() {\n return z.set(S);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":106,"symbol":"a","kind":"constant","lang":"typescript","code":"const a: any = { id: 1, peers: new Set() };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":114,"symbol":"S","kind":"constant","lang":"typescript","code":"const S: any = z.object({\n id: z.number(),\n get links() {\n return z.map(z.string(), S);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":116,"symbol":"links","kind":"method","lang":"typescript","code":"get links() {\n return z.map(z.string(), S);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":120,"symbol":"a","kind":"constant","lang":"typescript","code":"const a: any = { id: 1, links: new Map() };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":128,"symbol":"S","kind":"constant","lang":"typescript","code":"const S: any = z.object({\n id: z.number(),\n get self() {\n return z.union([z.string(), S]);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":130,"symbol":"self","kind":"method","lang":"typescript","code":"get self() {\n return z.union([z.string(), S]);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":134,"symbol":"a","kind":"constant","lang":"typescript","code":"const a: any = { id: 1 };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":142,"symbol":"S","kind":"constant","lang":"typescript","code":"const S: any = z.discriminatedUnion(\"kind\", [\n z.object({ kind: z.literal(\"leaf\"), v: z.number() }),\n z.object({\n kind: z.literal(\"branch\"),\n get next() {\n return S;\n },\n }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":146,"symbol":"next","kind":"method","lang":"typescript","code":"get next() {\n return S;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":151,"symbol":"a","kind":"constant","lang":"typescript","code":"const a: any = { kind: \"branch\" };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":159,"symbol":"S","kind":"constant","lang":"typescript","code":"const S: any = z.object({ id: z.number(), self: z.lazy(() => S) });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":160,"symbol":"a","kind":"constant","lang":"typescript","code":"const a: any = { id: 1 };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":168,"symbol":"A","kind":"constant","lang":"typescript","code":"const A: any = z.object({\n get b() {\n return B;\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":169,"symbol":"b","kind":"method","lang":"typescript","code":"get b() {\n return B;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":173,"symbol":"B","kind":"constant","lang":"typescript","code":"const B: any = z.object({\n get c() {\n return C;\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":174,"symbol":"c","kind":"method","lang":"typescript","code":"get c() {\n return C;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":178,"symbol":"C","kind":"constant","lang":"typescript","code":"const C: any = z.object({\n get d() {\n return D;\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":179,"symbol":"d","kind":"method","lang":"typescript","code":"get d() {\n return D;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":183,"symbol":"D","kind":"constant","lang":"typescript","code":"const D: any = z.object({\n get e() {\n return E;\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":184,"symbol":"e","kind":"method","lang":"typescript","code":"get e() {\n return E;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":188,"symbol":"E","kind":"constant","lang":"typescript","code":"const E: any = z.object({\n get a() {\n return A;\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":189,"symbol":"a","kind":"method","lang":"typescript","code":"get a() {\n return A;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":193,"symbol":"a","kind":"constant","lang":"typescript","code":"const a: any = {};"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":209,"symbol":"seen","kind":"constant","lang":"typescript","code":"const seen: number[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":210,"symbol":"Node","kind":"constant","lang":"typescript","code":"const Node: any = z\n .object({\n id: z.number(),\n get self() {\n return Node;\n },\n })\n .refine((value: any) => {\n seen.push(Object.keys(value).length);\n return true;\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":213,"symbol":"self","kind":"method","lang":"typescript","code":"get self() {\n return Node;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":222,"symbol":"input","kind":"constant","lang":"typescript","code":"const input: any = { id: 1 };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":230,"symbol":"Node","kind":"constant","lang":"typescript","code":"const Node: any = z\n .object({\n id: z.number(),\n get self() {\n return Node;\n },\n })\n .refine((value: any) => value.id > 100, \"too small\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":233,"symbol":"self","kind":"method","lang":"typescript","code":"get self() {\n return Node;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":239,"symbol":"input","kind":"constant","lang":"typescript","code":"const input: any = { id: 1 };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":245,"symbol":"Node","kind":"constant","lang":"typescript","code":"const Node: any = z.object({\n id: z.number(),\n get self() {\n return Node;\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":247,"symbol":"self","kind":"method","lang":"typescript","code":"get self() {\n return Node;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":252,"symbol":"input","kind":"constant","lang":"typescript","code":"const input: any = { id: \"nope\" };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":255,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = Node.safeParse(input);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":262,"symbol":"Inner","kind":"constant","lang":"typescript","code":"const Inner: any = z.object({\n name: z.string(),\n get self() {\n return Wrapped;\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":264,"symbol":"self","kind":"method","lang":"typescript","code":"get self() {\n return Wrapped;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/cyclic-data.test.ts","line":268,"symbol":"Wrapped","kind":"constant","lang":"typescript","code":"const Wrapped: any = Inner.transform((value: any) => ({ wrapped: value }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/date.test.ts","line":5,"symbol":"beforeBenchmarkDate","kind":"constant","lang":"typescript","code":"const beforeBenchmarkDate = new Date(Date.UTC(2022, 10, 4));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/date.test.ts","line":6,"symbol":"benchmarkDate","kind":"constant","lang":"typescript","code":"const benchmarkDate = new Date(Date.UTC(2022, 10, 5));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/date.test.ts","line":7,"symbol":"afterBenchmarkDate","kind":"constant","lang":"typescript","code":"const afterBenchmarkDate = new Date(Date.UTC(2022, 10, 6));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/date.test.ts","line":9,"symbol":"minCheck","kind":"constant","lang":"typescript","code":"const minCheck = z.date().min(benchmarkDate);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/date.test.ts","line":10,"symbol":"maxCheck","kind":"constant","lang":"typescript","code":"const maxCheck = z.date().max(benchmarkDate);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/date.test.ts","line":21,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = minCheck.safeParse(beforeBenchmarkDate);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/date.test.ts","line":39,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = maxCheck.safeParse(afterBenchmarkDate);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/date.test.ts","line":57,"symbol":"minRes","kind":"constant","lang":"typescript","code":"const minRes = z.date().min(benchmarkDate.getTime()).safeParse(beforeBenchmarkDate);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/date.test.ts","line":71,"symbol":"maxRes","kind":"constant","lang":"typescript","code":"const maxRes = z.date().max(benchmarkDate.getTime()).safeParse(afterBenchmarkDate);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":5,"symbol":"datetime","kind":"constant","lang":"typescript","code":"const datetime = z.string().datetime();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":19,"symbol":"datetimeNoMs","kind":"constant","lang":"typescript","code":"const datetimeNoMs = z.string().datetime({ precision: -1, offset: true, local: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":33,"symbol":"datetimeNoMs","kind":"constant","lang":"typescript","code":"const datetimeNoMs = z.string().datetime({ precision: 0 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":43,"symbol":"datetime3Ms","kind":"constant","lang":"typescript","code":"const datetime3Ms = z.string().datetime({ precision: 3 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":53,"symbol":"datetimeOffset","kind":"constant","lang":"typescript","code":"const datetimeOffset = z.string().datetime({ offset: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":73,"symbol":"datetimeOffsetNoMs","kind":"constant","lang":"typescript","code":"const datetimeOffsetNoMs = z.string().datetime({ offset: true, precision: 0 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":87,"symbol":"datetimeOffset4Ms","kind":"constant","lang":"typescript","code":"const datetimeOffset4Ms = z.string().datetime({ offset: true, precision: 4 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":98,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.iso.datetime({ offset: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":106,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string().datetime({ local: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":124,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string().datetime({ local: true, offset: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":151,"symbol":"mixed","kind":"constant","lang":"typescript","doc":"no single precision covers both, so the docs point at this union — pin that it works","code":"const mixed = z.union([z.iso.datetime(), z.iso.datetime({ precision: -1 })]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":159,"symbol":"date","kind":"constant","lang":"typescript","code":"const date = z.string().date();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":213,"symbol":"time","kind":"constant","lang":"typescript","code":"const time = z.string().time();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":234,"symbol":"time2","kind":"constant","lang":"typescript","code":"const time2 = z.string().time({ precision: 2 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":246,"symbol":"time3","kind":"constant","lang":"typescript","code":"const time3 = z.string().time({ precision: z.TimePrecision.Minute });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":252,"symbol":"duration","kind":"constant","lang":"typescript","code":"const duration = z.string().duration();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":254,"symbol":"validDurations","kind":"constant","lang":"typescript","code":"const validDurations = [\n \"P3Y6M4DT12H30M5S\",\n \"P2Y9M3DT12H31M8.001S\",\n // \"+P3Y6M4DT12H30M5S\",\n // \"-PT0.001S\",\n // \"+PT0.001S\",\n \"PT0,001S\",\n \"PT12H30M5S\",\n // \"-P2M1D\",\n // \"P-2M-1D\",\n // \"-P5DT10H\",\n // \"P-5DT-10H\",\n \"P1Y\",\n \"P2MT30M\",\n \"PT6H\",\n \"P5W\",\n // \"P0.5Y\",\n // \"P0,5Y\",\n // \"P42YT7.004M\",\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":275,"symbol":"invalidDurations","kind":"constant","lang":"typescript","code":"const invalidDurations = [\n \"foo bar\",\n \"\",\n \" \",\n \"P\",\n \"PT\",\n \"P1Y2MT\",\n \"T1H\",\n \"P0.5Y1D\",\n \"P0,5Y6M\",\n \"P1YT\",\n \"P-2M-1D\",\n \"P-5DT-10H\",\n \"P1W2D\",\n \"-P1D\",\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":293,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = duration.safeParse(val);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/datetime.test.ts","line":300,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = duration.safeParse(val);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":8,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string(), b: z.number() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":9,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":16,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n name: z.string(),\n profile: z.object({\n bio: z.string(),\n age: z.number(),\n }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":23,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":30,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ items: z.array(z.object({ a: z.string(), b: z.number() })) });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":31,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":36,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.tuple([z.object({ a: z.string() }), z.object({ b: z.number() })], z.object({ c: z.boolean() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":37,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":43,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.union([z.object({ a: z.string() }), z.object({ b: z.number() })]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":44,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":49,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ x: z.object({ a: z.string() }).optional() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":50,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":56,"symbol":"Node","kind":"constant","lang":"typescript","code":"const Node: z.ZodType = z.object({\n name: z.string(),\n children: z.array(z.lazy(() => Node)).optional(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":60,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(Node);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":70,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string().min(1), b: z.number().int() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":71,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":78,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n name: z.string(),\n profile: z.object({ bio: z.string() }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":82,"symbol":"Out","kind":"type","lang":"typescript","code":"type Out = z.output<typeof schema> extends infer X ? X : never;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":83,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":84,"symbol":"PartialOut","kind":"type","lang":"typescript","code":"type PartialOut = z.output<typeof partial>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":89,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n name: z.string(),\n nested: z.object({ age: z.number() }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":93,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":99,"symbol":"innerShape","kind":"constant","lang":"typescript","doc":"Nested shape access is still typed.","code":"const innerShape = partial.shape.nested._zod.def.innerType.shape;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":104,"symbol":"Category","kind":"constant","lang":"typescript","code":"const Category = z.object({\n name: z.string(),\n get subcategories() {\n return z.array(Category).optional();\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":106,"symbol":"subcategories","kind":"method","lang":"typescript","code":"get subcategories() {\n return z.array(Category).optional();\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":110,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(Category);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":117,"symbol":"arr","kind":"constant","lang":"typescript","code":"const arr = deepPartial(z.array(z.object({ a: z.string() })));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":120,"symbol":"tup","kind":"constant","lang":"typescript","code":"const tup = deepPartial(z.tuple([z.object({ a: z.string() }), z.object({ b: z.number() })]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":123,"symbol":"uni","kind":"constant","lang":"typescript","code":"const uni = deepPartial(z.union([z.object({ a: z.string() }), z.object({ b: z.number() })]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":128,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n a: z.object({\n b: z.object({\n c: z.object({ d: z.string() }),\n }),\n }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":135,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":142,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\"kind\", [\n z.object({ kind: z.literal(\"a\"), a: z.string() }),\n z.object({ kind: z.literal(\"b\"), b: z.number() }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":146,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":153,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.intersection(z.object({ a: z.string() }), z.object({ b: z.number() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":154,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":161,"symbol":"rec","kind":"constant","lang":"typescript","code":"const rec = deepPartial(z.record(z.string(), z.object({ a: z.string() })));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":164,"symbol":"m","kind":"constant","lang":"typescript","code":"const m = deepPartial(z.map(z.string(), z.object({ a: z.string() })));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":167,"symbol":"s","kind":"constant","lang":"typescript","code":"const s = deepPartial(z.set(z.object({ a: z.string() })));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":172,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n x: z.object({ a: z.string() }).default({ a: \"hi\" }).readonly(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":175,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":181,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string().transform((s) => s.length) });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":182,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":188,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string() }).pipe(z.object({ a: z.string() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":189,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":194,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.tuple([z.object({ a: z.string() }), z.string()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":195,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":204,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.intersection(\n z.object({ a: z.object({ inner: z.string() }) }),\n z.object({ b: z.object({ inner: z.number() }) })\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":208,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":217,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.promise(z.object({ a: z.string() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":218,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":223,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.success(z.object({ a: z.string() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":224,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":229,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.codec(z.object({ a: z.string() }), z.object({ a: z.string() }), {\n decode: (v) => v,\n encode: (v) => v,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":233,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":239,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.preprocess((v) => v, z.object({ a: z.string() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":240,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":246,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(z.object({ a: z.string() }).catchall(z.object({ n: z.number() })));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":258,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n shapes: z.array(\n z.discriminatedUnion(\"kind\", [\n z.object({ kind: z.literal(\"circle\"), meta: z.object({ id: z.string() }) }),\n z.object({ kind: z.literal(\"square\"), side: z.number() }),\n ])\n ),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":266,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/deep-partial.test.ts","line":267,"symbol":"element","kind":"constant","lang":"typescript","code":"const element = (partial.shape.shapes._zod.def.innerType as z.ZodArray)._zod.def.element;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default-locale.test.ts","line":11,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.enum([\"km\", \"mi\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default-locale.test.ts","line":13,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"feet\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default-locale.test.ts","line":20,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.enum([\"km\", \"mi\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default-locale.test.ts","line":21,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"feet\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default-locale.test.ts","line":27,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.enum([\"km\", \"mi\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default-locale.test.ts","line":29,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"feet\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":9,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().optional().default(\"default\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":15,"symbol":"stringWithDefault","kind":"constant","lang":"typescript","code":"const stringWithDefault = z\n .string()\n .transform((val) => val.toUpperCase())\n .default(\"default\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":25,"symbol":"inp","kind":"type","lang":"typescript","code":"type inp = z.input<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":27,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":32,"symbol":"stringWithDefault","kind":"constant","lang":"typescript","code":"const stringWithDefault = z.string().optional().default(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":38,"symbol":"inp","kind":"type","lang":"typescript","code":"type inp = z.input<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":40,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":45,"symbol":"stringWithDefault","kind":"constant","lang":"typescript","code":"const stringWithDefault = z.string().default(\"asdf\").optional();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":47,"symbol":"inp","kind":"type","lang":"typescript","code":"type inp = z.input<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":49,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof stringWithDefault>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":69,"symbol":"stringWithRemovedDefault","kind":"constant","lang":"typescript","code":"const stringWithRemovedDefault = z.string().default(\"asdf\").removeDefault();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":71,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof stringWithRemovedDefault>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":76,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .string()\n .transform((_) => (Math.random() > 0 ? undefined : _))\n .default(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":84,"symbol":"inner","kind":"constant","lang":"typescript","code":"const inner = z.string().default(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":85,"symbol":"outer","kind":"constant","lang":"typescript","code":"const outer = z.object({ inner }).default({\n inner: \"qwer\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":88,"symbol":"input","kind":"type","lang":"typescript","code":"type input = z.input<typeof outer>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":90,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof outer>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":98,"symbol":"stringWithDefault","kind":"constant","lang":"typescript","code":"const stringWithDefault = z.string().default(\"inner\").default(\"outer\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":99,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringWithDefault.parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":104,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n hi: z.string().default(\"hi\"),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":107,"symbol":"schemaInput","kind":"type","lang":"typescript","code":"type schemaInput = z.input<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":108,"symbol":"schemaOutput","kind":"type","lang":"typescript","code":"type schemaOutput = z.output<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":117,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z\n .string()\n .default(\"a\")\n .refine((val) => val.startsWith(\"a\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":121,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z\n .string()\n .refine((val) => val.startsWith(\"b\"))\n .default(\"b\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":125,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z\n .string()\n .prefault(\"c\")\n .refine((val) => val.startsWith(\"c\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":129,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = z\n .string()\n .refine((val) => val.startsWith(\"d\"))\n .prefault(\"d\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":134,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = z.object({\n a,\n b,\n c,\n d,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":213,"symbol":"obj2","kind":"constant","lang":"typescript","code":"const obj2 = z.object({\n a: a.optional(),\n b: b.optional(),\n c: c.optional(),\n d: d.optional(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":238,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z\n .string()\n .default(\"z\")\n .refine((val) => val.startsWith(\"a\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":242,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z\n .string()\n .refine((val) => val.startsWith(\"b\"))\n .default(\"z\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":246,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z\n .string()\n .prefault(\"z\")\n .refine((val) => val.startsWith(\"c\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":250,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = z\n .string()\n .refine((val) => val.startsWith(\"d\"))\n .prefault(\"z\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":255,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = z.object({\n a,\n b,\n c,\n d,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":297,"symbol":"objWithDefaults","kind":"constant","lang":"typescript","code":"const objWithDefaults = z.object({\n a: z.string().default(\"defaultA\"),\n b: z.string().default(\"defaultB\"),\n c: z.string().default(\"defaultC\"),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":303,"symbol":"objPartialWithOneRequired","kind":"constant","lang":"typescript","code":"const objPartialWithOneRequired = objWithDefaults.partial();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":305,"symbol":"test","kind":"constant","lang":"typescript","code":"const test = objPartialWithOneRequired.parse({});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":316,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n a: z.string(),\n })\n .default({ a: \"x\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":321,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = schema.parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":322,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = schema.parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":328,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.array(z.string()).default([\"x\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":329,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = schema.parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":330,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = schema.parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":336,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.map(z.string(), z.number()).default(new Map([[\"a\", 1]]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":337,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = schema.parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":338,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = schema.parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":344,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.set(z.string()).default(new Set([\"x\"]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":345,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = schema.parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":346,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = schema.parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":352,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.map(z.string(), z.number()).default(new Map());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":353,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = schema.parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":354,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = schema.parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":366,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.set(z.string()).default(new Set());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":367,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = schema.parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":368,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = schema.parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":380,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().default(\"hello\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":413,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n a: z.string().default(() => {\n calls++;\n return \"d\";\n }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":430,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n a: z.string().prefault(() => {\n calls++;\n return \"d\";\n }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/default.test.ts","line":443,"symbol":"compiled","kind":"constant","lang":"typescript","code":"const compiled = z.compile(\n z.object({\n a: z.string().default(() => {\n calls++;\n return \"d\";\n }),\n })\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/describe-meta-checks.test.ts","line":6,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().check(z.describe(\"A string\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/describe-meta-checks.test.ts","line":13,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().check(z.meta({ title: \"Age\", description: \"User's age\" }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/describe-meta-checks.test.ts","line":14,"symbol":"meta","kind":"constant","lang":"typescript","code":"const meta = z.globalRegistry.get(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/describe-meta-checks.test.ts","line":22,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().check(z.describe(\"Email address\"), z.meta({ title: \"Email\" }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/describe-meta-checks.test.ts","line":23,"symbol":"meta","kind":"constant","lang":"typescript","code":"const meta = z.globalRegistry.get(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/description.test.ts","line":5,"symbol":"description","kind":"constant","lang":"typescript","code":"const description = \"a description\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/description.test.ts","line":20,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":16,"symbol":"probeArgs","kind":"constant","lang":"typescript","code":"const probeArgs: Record<string, unknown[]> = {\n // ZodType\n optional: [],\n exactOptional: [],\n nullable: [],\n nullish: [],\n array: [],\n describe: [\"x\"],\n brand: [],\n readonly: [],\n default: [\"fallback\"],\n catch: [\"fallback\"],\n // _ZodString\n min: [1],\n max: [10],\n length: [5],\n nonempty: [],\n trim: [],\n toLowerCase: [],\n toUpperCase: [],\n // ZodString format methods\n email: [],\n url: [],\n uuid: [],\n cuid: [],\n cuid2: [],\n ulid: [],\n base64: [],\n base64url: [],\n ipv4: [],\n ipv6: [],\n // ZodNumber\n int: [],\n positive: [],\n negative: [],\n finite: [],\n};"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":55,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":63,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":64,"symbol":"opt","kind":"constant","lang":"typescript","code":"const opt = schema.optional;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":66,"symbol":"detached","kind":"constant","lang":"typescript","code":"const detached = opt();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":75,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":76,"symbol":"nul","kind":"constant","lang":"typescript","code":"const nul = schema.nullable;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":78,"symbol":"detached","kind":"constant","lang":"typescript","code":"const detached = nul();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":87,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":88,"symbol":"arr","kind":"constant","lang":"typescript","code":"const arr = schema.array;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":90,"symbol":"detached","kind":"constant","lang":"typescript","code":"const detached = arr();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":98,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":99,"symbol":"describe","kind":"constant","lang":"typescript","code":"const describe = schema.describe;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":101,"symbol":"described","kind":"constant","lang":"typescript","code":"const described = describe(\"hello world\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":107,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":108,"symbol":"refine","kind":"constant","lang":"typescript","code":"const refine = schema.refine;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":110,"symbol":"refined","kind":"constant","lang":"typescript","code":"const refined = refine((s: string) => s.startsWith(\"x\"), \"must start with x\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":117,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":118,"symbol":"opt","kind":"constant","lang":"typescript","code":"const opt = schema.optional;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":119,"symbol":"optionalSchema","kind":"constant","lang":"typescript","code":"const optionalSchema = opt();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":127,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":128,"symbol":"parse","kind":"constant","lang":"typescript","code":"const parse = schema.parse;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":129,"symbol":"inputs","kind":"constant","lang":"typescript","code":"const inputs = [\"a\", \"b\", \"c\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":131,"symbol":"results","kind":"constant","lang":"typescript","code":"const results = inputs.map((v) => parse(v));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":137,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":139,"symbol":"min","kind":"constant","lang":"typescript","code":"const min = schema.min;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":140,"symbol":"max","kind":"constant","lang":"typescript","code":"const max = schema.max;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":141,"symbol":"positive","kind":"constant","lang":"typescript","code":"const positive = schema.positive;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":149,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string(), b: z.number() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":151,"symbol":"pick","kind":"constant","lang":"typescript","code":"const pick = schema.pick;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":152,"symbol":"omit","kind":"constant","lang":"typescript","code":"const omit = schema.omit;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":153,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = schema.partial;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":154,"symbol":"exactPartial","kind":"constant","lang":"typescript","code":"const exactPartial = schema.exactPartial;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":155,"symbol":"extend","kind":"constant","lang":"typescript","code":"const extend = schema.extend;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":162,"symbol":"extended","kind":"constant","lang":"typescript","code":"const extended = extend({ c: z.boolean() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":168,"symbol":"stringSchema","kind":"constant","lang":"typescript","code":"const stringSchema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":169,"symbol":"numberSchema","kind":"constant","lang":"typescript","code":"const numberSchema = z.number();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":171,"symbol":"broken","kind":"constant","lang":"typescript","code":"const broken: Array<{ method: string; reason: string }> = [];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":174,"symbol":"target","kind":"constant","lang":"typescript","code":"const target: any = methodName in stringSchema ? stringSchema : methodName in numberSchema ? numberSchema : null;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":177,"symbol":"detached","kind":"constant","lang":"typescript","code":"const detached = target[methodName] as Function | undefined;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":181,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = detached(...args);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":184,"symbol":"probeValue","kind":"constant","lang":"typescript","code":"const probeValue = target === stringSchema ? \"x\" : 1;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":185,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = (result as any).safeParse(probeValue);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":200,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":201,"symbol":"spy","kind":"constant","lang":"typescript","code":"const spy = vi.spyOn(schema, \"safeParse\").mockReturnValue({ success: true, data: { a: \"mocked\" } });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":210,"symbol":"json","kind":"constant","lang":"typescript","code":"const json = vi.spyOn(schema, \"toJSONSchema\").mockReturnValue({ type: \"null\" } as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":217,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/detached-methods.test.ts","line":218,"symbol":"get","kind":"constant","lang":"typescript","code":"const get = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(schema), \"spa\")!.get!;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":16,"symbol":"t","kind":"constant","lang":"typescript","code":"const t = z.literal(\"test\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":22,"symbol":"pre","kind":"constant","lang":"typescript","code":"const pre = z.preprocess((val) => String(val), z.string()).pipe(z.literal(\"test\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":25,"symbol":"post","kind":"constant","lang":"typescript","code":"const post = z.literal(\"test\").transform((_) => Math.random());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":55,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"a\").optional(), a: z.string() }),\n z.object({ type: z.literal(\"b\"), b: z.string() }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":64,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"1\"), val: z.string() }),\n z.object({ type: z.literal(1), val: z.string() }),\n z.object({ type: z.literal(BigInt(1)), val: z.string() }),\n z.object({ type: z.literal(\"true\"), val: z.string() }),\n z.object({ type: z.literal(true), val: z.string() }),\n z.object({ type: z.literal(\"null\"), val: z.string() }),\n z.object({ type: z.null(), val: z.string() }),\n z.object({ type: z.literal(\"undefined\"), val: z.string() }),\n z.object({ type: z.undefined(), val: z.string() }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":107,"symbol":"fail","kind":"constant","lang":"typescript","code":"const fail = schema.safeParse({\n type: \"not_a_key\",\n val: \"val\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":146,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z\n .discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"a\"), a: z.string() }),\n z.object({ type: z.literal(\"b\"), b: z.string() }),\n ])\n .safeParse({ type: \"x\", a: \"abc\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":177,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z\n .discriminatedUnion(\n \"type\",\n [z.object({ type: z.literal(\"a\"), a: z.string() }), z.object({ type: z.literal(\"b\"), b: z.string() })],\n { unionFallback: true }\n )\n .safeParse({ type: \"x\", a: \"abc\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":233,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z\n .discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"a\"), a: z.string() }),\n z.object({ type: z.literal(\"b\"), b: z.string() }),\n ])\n .safeParse({ type: \"a\", b: \"abc\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":276,"symbol":"viaPipe","kind":"constant","lang":"typescript","doc":"An option whose shape cannot be listed without resolving it — a pipe here — is left to the lookup map, and fails on the first object parsed.","code":"const viaPipe = z.discriminatedUnion(\"type\", [\n z.object({ value: z.literal(\"x\") }).pipe(z.object({ value: z.literal(\"x\") })),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":284,"symbol":"mutatedBeforeRead","kind":"constant","lang":"typescript","doc":"`shape` answers from the object the caller passed until the first read, then from a frozen copy. A key list derived at either moment would disagree with it at the other and reject an option that does carry the discriminator.","code":"const mutatedBeforeRead: Record<string, z.ZodType> = { value: z.string() };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":285,"symbol":"A","kind":"constant","lang":"typescript","code":"const A = z.object(mutatedBeforeRead);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":291,"symbol":"mutatedAfterRead","kind":"constant","lang":"typescript","code":"const mutatedAfterRead: Record<string, z.ZodType> = { type: z.literal(\"a\"), value: z.string() };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":292,"symbol":"B","kind":"constant","lang":"typescript","code":"const B = z.object(mutatedAfterRead);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":300,"symbol":"A","kind":"constant","lang":"typescript","doc":"`.describe()` and friends reuse the def by identity, so the source keeps its own check.","code":"const A = z.object({ value: z.literal(\"x\") });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":306,"symbol":"Base","kind":"constant","lang":"typescript","doc":"A def rebuilt by a builder is a different object, so it inherits nothing and is left to the lookup map.","code":"const Base = z.object({ status: z.literal(\"failed\"), message: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":312,"symbol":"variantA","kind":"constant","lang":"typescript","doc":"`Object.keys` lists a shape's keys without invoking them, so the check sees `child` without running the getter that references the union being constructed.","code":"const variantA = z.object({\n kind: z.literal(\"a\"),\n get child() {\n return tree.optional();\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":314,"symbol":"child","kind":"method","lang":"typescript","code":"get child() {\n return tree.optional();\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":318,"symbol":"variantB","kind":"constant","lang":"typescript","code":"const variantB = z.object({\n kind: z.literal(\"b\"),\n get sibling() {\n return tree.optional();\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":320,"symbol":"sibling","kind":"method","lang":"typescript","code":"get sibling() {\n return tree.optional();\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":324,"symbol":"tree","kind":"constant","lang":"typescript","code":"const tree = z.discriminatedUnion(\"kind\", [variantA, variantB]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":343,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = await z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"a\"),\n a: z\n .string()\n .refine(async () => true)\n .transform(async (val) => Number(val)),\n }),\n z.object({\n type: z.literal(\"b\"),\n b: z.string(),\n }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":356,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = { type: \"a\", a: \"1\" };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":357,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await schema.safeParseAsync(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":363,"symbol":"a","kind":"constant","lang":"typescript","doc":"try {","code":"const a = z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"a\"),\n a: z\n .string()\n .refine(async () => true)\n .transform(async (val) => val),\n }),\n z.object({\n type: z.literal(\"b\"),\n b: z.string(),\n }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":376,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await a.safeParseAsync({ type: \"a\", a: 1 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":403,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"foo\").default(\"foo\"),\n a: z.string(),\n }),\n z.object({\n type: z.literal(\"custom\"),\n method: z.string(),\n }),\n z.object({\n type: z.literal(\"bar\").transform((val) => val),\n c: z.string(),\n }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":424,"symbol":"MyEnum","kind":"type","lang":"typescript","code":"enum MyEnum {\n d = 0,\n e = \"e\",\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":429,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\"key\", [\n z.object({\n key: z.literal(\"a\"),\n // Add other properties specific to this option\n }),\n z.object({\n key: z.enum([\"b\", \"c\"]),\n // Add other properties specific to this option\n }),\n z.object({\n key: z.nativeEnum(MyEnum),\n // Add other properties specific to this option\n }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":444,"symbol":"schema","kind":"type","lang":"typescript","code":"type schema = z.infer<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":456,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\"key\", [\n z.object({\n key: z.literal(\"a\"),\n // Add other properties specific to this option\n }),\n z.object({\n key: z.literal(\"b\").brand<\"asdfasdf\">(),\n // Add other properties specific to this option\n }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":467,"symbol":"schema","kind":"type","lang":"typescript","code":"type schema = z.infer<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":478,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\"key\", [\n z.object({\n key: z.literal(\"a\").optional(),\n a: z.literal(true),\n }),\n z.object({\n key: z.literal(\"b\").nullable(),\n b: z.literal(true),\n // Add other properties specific to this option\n }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":490,"symbol":"schema","kind":"type","lang":"typescript","code":"type schema = z.infer<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":504,"symbol":"value","kind":"constant","lang":"typescript","code":"const value = schema.parse({ key: null, b: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":514,"symbol":"FreeConfig","kind":"constant","lang":"typescript","code":"const FreeConfig = z.object({\n type: z.literal(\"free\"),\n min_cents: z.null(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":520,"symbol":"PricedConfig","kind":"constant","lang":"typescript","doc":"console.log(FreeConfig.shape.type);","code":"const PricedConfig = z.object({\n type: z.literal(\"fiat-price\"),\n // min_cents: z.int().nullable(),\n min_cents: z.null(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":526,"symbol":"Config","kind":"constant","lang":"typescript","code":"const Config = z.discriminatedUnion(\"type\", [FreeConfig, PricedConfig]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":544,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n a: z.literal(\"discKey\"),\n b: z.enum([\"apple\", \"banana\"]),\n c: z.object({ id: z.string() }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":550,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = {\n a: \"discKey\",\n b: \"apple\",\n c: {}, // Invalid, as schema requires `id` property\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":558,"symbol":"u","kind":"constant","lang":"typescript","code":"const u = z.discriminatedUnion(\"a\", [schema]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":559,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = u.safeParse(input);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":582,"symbol":"BaseError","kind":"constant","lang":"typescript","code":"const BaseError = z.object({ status: z.literal(\"failed\"), message: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":583,"symbol":"MyErrors","kind":"constant","lang":"typescript","code":"const MyErrors = z.discriminatedUnion(\"code\", [\n BaseError.extend({ code: z.literal(400) }),\n BaseError.extend({ code: z.literal(401) }),\n BaseError.extend({ code: z.literal(500) }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":589,"symbol":"MyResult","kind":"constant","lang":"typescript","code":"const MyResult = z.discriminatedUnion(\"status\", [\n z.object({ status: z.literal(\"success\"), data: z.string() }),\n MyErrors,\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":620,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = MyResult.parse({ status: \"success\", data: \"hello\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":627,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = MyResult.parse({ status: \"failed\", code: 400, message: \"bad request\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":635,"symbol":"result3","kind":"constant","lang":"typescript","code":"const result3 = MyResult.parse({ status: \"failed\", code: 401, message: \"unauthorized\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":643,"symbol":"result4","kind":"constant","lang":"typescript","code":"const result4 = MyResult.parse({ status: \"failed\", code: 500, message: \"internal server error\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":654,"symbol":"discUnion","kind":"constant","lang":"typescript","code":"const discUnion = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"a\").readonly(), a: z.string() }),\n z.object({ type: z.literal(\"b\"), b: z.number() }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":660,"symbol":"propValues","kind":"constant","lang":"typescript","doc":"Test that both discriminator values are correctly included in propValues","code":"const propValues = discUnion._zod.propValues;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":665,"symbol":"result1","kind":"constant","lang":"typescript","doc":"Test that the discriminated union works correctly","code":"const result1 = discUnion.parse({ type: \"a\", a: \"hello\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":668,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = discUnion.parse({ type: \"b\", b: 42 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":678,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n type: z.literal(\"foo\"),\n })\n .transform((s) => ({ ...s, v: 2 }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":692,"symbol":"schema2","kind":"constant","lang":"typescript","code":"const schema2 = z.object({\n type: z.literal(\"bar\"),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":696,"symbol":"combinedSchema","kind":"constant","lang":"typescript","code":"const combinedSchema = z.discriminatedUnion(\"type\", [schema, schema2], {\n unionFallback: false,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":707,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\n \"type\",\n [z.object({ type: z.literal(\"play\") }), z.object({ type: z.literal(\"pause\") })],\n { unionFallback: true }\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":719,"symbol":"codec1","kind":"constant","lang":"typescript","code":"const codec1 = z.codec(z.literal(1), z.literal(\"one\"), {\n decode: () => \"one\" as const,\n encode: () => 1 as const,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":724,"symbol":"codec2","kind":"constant","lang":"typescript","code":"const codec2 = z.codec(z.literal(2), z.literal(\"two\"), {\n decode: () => \"two\" as const,\n encode: () => 2 as const,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/discriminated-unions.test.ts","line":729,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\"type\", [\n z.object({ type: codec1, value: z.string() }),\n z.object({ type: codec2, value: z.number() }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":5,"symbol":"MyEnum","kind":"constant","lang":"typescript","code":"const MyEnum = z.enum([\"Red\", \"Green\", \"Blue\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":8,"symbol":"MyEnum","kind":"type","lang":"typescript","code":"type MyEnum = z.infer<typeof MyEnum>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":13,"symbol":"Fruits","kind":"constant","lang":"typescript","code":"const Fruits: { Apple: \"apple\"; Banana: \"banana\" } = {\n Apple: \"apple\",\n Banana: \"banana\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":17,"symbol":"fruitEnum","kind":"constant","lang":"typescript","code":"const fruitEnum = z.nativeEnum(Fruits);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":18,"symbol":"fruitEnum","kind":"type","lang":"typescript","code":"type fruitEnum = z.infer<typeof fruitEnum>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":27,"symbol":"Fruits","kind":"type","lang":"typescript","code":"enum Fruits {\n Apple = \"apple\",\n Banana = \"banana\",\n Orange = 3,\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":33,"symbol":"fruitEnum","kind":"constant","lang":"typescript","doc":"@ts-ignore","code":"const fruitEnum = z.nativeEnum(Fruits);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":34,"symbol":"fruitEnum","kind":"type","lang":"typescript","code":"type fruitEnum = z.infer<typeof fruitEnum>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":48,"symbol":"FruitValues","kind":"constant","lang":"typescript","code":"const FruitValues = {\n Apple: 10,\n Banana: 20,\n // @ts-ignore\n } as const;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":53,"symbol":"fruitEnum","kind":"constant","lang":"typescript","code":"const fruitEnum = z.nativeEnum(FruitValues);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":54,"symbol":"fruitEnum","kind":"type","lang":"typescript","code":"type fruitEnum = z.infer<typeof fruitEnum>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":63,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.enum([\"Red\", \"Green\", \"Blue\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":64,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"Yellow\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":80,"symbol":"foods","kind":"constant","lang":"typescript","code":"const foods = [\"Pasta\", \"Pizza\", \"Tacos\", \"Burgers\", \"Salad\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":81,"symbol":"FoodEnum","kind":"constant","lang":"typescript","code":"const FoodEnum = z.enum(foods);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":91,"symbol":"Fish","kind":"type","lang":"typescript","code":"enum Fish {\n Tuna = 0,\n Trout = 1,\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":102,"symbol":"HTTP_SUCCESS","kind":"constant","lang":"typescript","code":"const HTTP_SUCCESS = [\"200\", \"201\"] as const;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":103,"symbol":"arg","kind":"constant","lang":"typescript","code":"const arg = z.enum(HTTP_SUCCESS);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":104,"symbol":"arg","kind":"type","lang":"typescript","code":"type arg = z.infer<typeof arg>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":112,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z\n .enum([\"test\"], { error: (iss) => (iss.input === undefined ? \"REQUIRED\" : undefined) })\n .safeParse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":122,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.enum([\"a\", \"b\", \"c\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":123,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.enum(a.options);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":126,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.enum({ a: 1, b: 2 } as const);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":132,"symbol":"Fruit","kind":"type","lang":"typescript","code":"enum Fruit {\n Apple = \"apple\",\n Banana = \"banana\",\n Orange = \"orange\",\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":137,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = z.enum(Fruit);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":140,"symbol":"e","kind":"constant","lang":"typescript","code":"const e = z.enum({ a: 1, b: 2 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":148,"symbol":"foods","kind":"constant","lang":"typescript","code":"const foods = [\"Pasta\", \"Pizza\", \"Tacos\", \"Burgers\", \"Salad\"] as const;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":149,"symbol":"FoodEnum","kind":"constant","lang":"typescript","code":"const FoodEnum = z.enum(foods);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":150,"symbol":"ItalianEnum","kind":"constant","lang":"typescript","code":"const ItalianEnum = FoodEnum.extract([\"Pasta\", \"Pizza\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":159,"symbol":"foods","kind":"constant","lang":"typescript","code":"const foods = [\"Pasta\", \"Pizza\", \"Tacos\", \"Burgers\", \"Salad\"] as const;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":160,"symbol":"FoodEnum","kind":"constant","lang":"typescript","code":"const FoodEnum = z.enum(foods);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":161,"symbol":"UnhealthyEnum","kind":"constant","lang":"typescript","code":"const UnhealthyEnum = FoodEnum.exclude([\"Salad\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":167,"symbol":"EmptyFoodEnum","kind":"constant","lang":"typescript","code":"const EmptyFoodEnum = FoodEnum.exclude(foods);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":173,"symbol":"Empty","kind":"constant","lang":"typescript","code":"const Empty = z.enum([]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":184,"symbol":"foods","kind":"constant","lang":"typescript","code":"const foods = [\"Pasta\", \"Pizza\", \"Tacos\", \"Burgers\", \"Salad\"] as const;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":185,"symbol":"FoodEnum","kind":"constant","lang":"typescript","code":"const FoodEnum = z.enum(foods, { error: () => \"This is not food!\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":186,"symbol":"ItalianEnum","kind":"constant","lang":"typescript","code":"const ItalianEnum = FoodEnum.extract([\"Pasta\", \"Pizza\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":188,"symbol":"foodsError","kind":"constant","lang":"typescript","code":"const foodsError = FoodEnum.safeParse(\"Cucumbers\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":189,"symbol":"italianError","kind":"constant","lang":"typescript","code":"const italianError = ItalianEnum.safeParse(\"Tacos\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":193,"symbol":"UnhealthyEnum","kind":"constant","lang":"typescript","code":"const UnhealthyEnum = FoodEnum.exclude([\"Salad\"], {\n error: () => ({ message: \"This is not healthy food!\" }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":196,"symbol":"unhealthyError","kind":"constant","lang":"typescript","code":"const unhealthyError = UnhealthyEnum.safeParse(\"Salad\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":203,"symbol":"_a","kind":"type","lang":"typescript","code":"type _a = z.ZodEnum<{ readonly a: \"a\"; readonly b: \"b\" }>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":204,"symbol":"_b","kind":"type","lang":"typescript","code":"type _b = z.ZodEnum<{ a: \"a\"; b: \"b\" }>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":208,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.enum([\"Tuna\", \"Trout\"]).safeParse(\"Salmon\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":228,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.enum([\"Tuna\", \"Trout\"]).safeParse(12);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":248,"symbol":"Fish","kind":"type","lang":"typescript","code":"enum Fish {\n Tuna = \"Tuna\",\n Trout = \"Trout\",\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":252,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.nativeEnum(Fish).safeParse(\"Salmon\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":272,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.enum([\"apple\", \"banana\"], {\n message: \"the value provided is invalid\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":276,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = schema.safeParse(\"berries\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":282,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = schema.safeParse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":288,"symbol":"result3","kind":"constant","lang":"typescript","code":"const result3 = schema.safeParse(\"banana\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":291,"symbol":"result4","kind":"constant","lang":"typescript","code":"const result4 = schema.safeParse(null);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/enum.test.ts","line":299,"symbol":"schema_02","kind":"constant","lang":"typescript","code":"const schema_02 = z.enum({\n A: 1,\n B: \"A\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":4,"symbol":"iss","kind":"constant","lang":"typescript","code":"const iss: z.core.$ZodIssueCode;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":6,"symbol":"Test","kind":"constant","lang":"typescript","code":"const Test = z.object({\n f1: z.number(),\n f2: z.string().optional(),\n f3: z.string().nullable(),\n f4: z.array(z.object({ t: z.union([z.string(), z.boolean()]) })),\n});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":14,"symbol":"parsed","kind":"constant","lang":"typescript","doc":"type TestFlattenedErrors = core.inferFlattenedErrors<typeof Test, { message: string; code: number }>; type TestFormErrors = core.inferFlattenedErrors<typeof Test>;","code":"const parsed = Test.safeParse({});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":51,"symbol":"flattened","kind":"constant","lang":"typescript","code":"const flattened = parsed.error!.flatten();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":82,"symbol":"ErrorType","kind":"type","lang":"typescript","code":"type ErrorType = { message: string; code: number };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":83,"symbol":"flattened","kind":"constant","lang":"typescript","code":"const flattened = parsed.error!.flatten((iss) => ({\n message: iss.message,\n code: 1234,\n }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":125,"symbol":"formatted","kind":"constant","lang":"typescript","code":"const formatted = parsed.error!.format();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":165,"symbol":"ErrorType","kind":"type","lang":"typescript","code":"type ErrorType = { message: string; code: number };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":166,"symbol":"formatted","kind":"constant","lang":"typescript","code":"const formatted = parsed.error!.format((iss) => ({\n message: iss.message,\n code: 1234,\n }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":218,"symbol":"propertySchema","kind":"constant","lang":"typescript","code":"const propertySchema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":219,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n a: propertySchema,\n b: propertySchema,\n })\n .refine(\n (val) => {\n return val.a === val.b;\n },\n { message: \"Must be equal\" }\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":231,"symbol":"r1","kind":"constant","lang":"typescript","code":"const r1 = schema.safeParse({\n a: \"asdf\",\n b: \"qwer\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":241,"symbol":"r2","kind":"constant","lang":"typescript","code":"const r2 = schema.safeParse({\n a: null,\n b: null,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":305,"symbol":"f1","kind":"constant","lang":"typescript","doc":"Test mapping","code":"const f1 = z.core.flattenError(r2.error!, (i: z.ZodIssue) => i.message.length);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":329,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.strictObject({\n username: z.string().brand<\"username\">(),\n favoriteNumbers: z.array(z.number()),\n nesting: z.object({\n a: z.string(),\n }),\n});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":336,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({\n username: 1234,\n favoriteNumbers: [1234, \"4567\"],\n nesting: {\n a: 123,\n },\n extra: 1234,\n});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":345,"symbol":"tree","kind":"constant","lang":"typescript","code":"const tree = z.treeifyError(result.error!);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":409,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.strictObject({\n name: z.string(),\n logLevel: z.union([z.string(), z.number()]),\n env: z.literal([\"production\", \"development\"]),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":415,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = {\n name: 1000,\n logLevel: false,\n extra: 1000,\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":421,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":422,"symbol":"err","kind":"constant","lang":"typescript","code":"const err = z.treeifyError(result.error!);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":502,"symbol":"e1","kind":"constant","lang":"typescript","code":"const e1 = new z.ZodError([]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":507,"symbol":"e2","kind":"constant","lang":"typescript","code":"const e2 = new z.ZodRealError([]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":514,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\n \"foo\",\n [\n z.object({\n foo: z.literal(\"x\"),\n x: z.string(),\n }),\n z.object({\n foo: z.literal(\"y\"),\n y: z.string(),\n }),\n ],\n {\n error: \"Invalid discriminator\",\n }\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":531,"symbol":"error","kind":"constant","lang":"typescript","code":"const error = schema.safeParse({ foo: \"invalid\" }).error;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":561,"symbol":"e","kind":"constant","lang":"typescript","code":"const e = new z.ZodError([]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":604,"symbol":"syntheticError","kind":"constant","lang":"typescript","code":"const syntheticError = new z.ZodError([\n {\n code: \"invalid_union\",\n path: [\"parent\"],\n message: \"Invalid input\",\n errors: [\n [\n {\n code: \"invalid_type\",\n expected: \"string\",\n path: [],\n message: \"Expected string\",\n input: {},\n },\n ],\n [\n {\n code: \"invalid_union\",\n path: [\"child\"],\n message: \"Invalid input\",\n errors: [\n [\n {\n code: \"invalid_type\",\n expected: \"string\",\n path: [],\n message: \"Expected string\",\n input: true,\n },\n ],\n [\n {\n code: \"invalid_type\",\n expected: \"number\",\n path: [],\n message: \"Expected number\",\n input: true,\n },\n ],\n ],\n },\n ],\n ],\n },\n ] as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":650,"symbol":"formatted","kind":"constant","lang":"typescript","code":"const formatted: any = z.formatError(syntheticError);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":662,"symbol":"syntheticError","kind":"constant","lang":"typescript","doc":"When a nested invalid_union appears inside another invalid_union, the inner errors must stay nested under their parent path, not flatten to root.","code":"const syntheticError = new z.ZodError([\n {\n code: \"invalid_union\",\n path: [\"parent\"],\n message: \"Invalid input\",\n errors: [\n [\n {\n code: \"invalid_type\",\n expected: \"string\",\n path: [],\n message: \"Expected string\",\n input: {},\n },\n ],\n [\n {\n code: \"invalid_union\",\n path: [\"child\"],\n message: \"Invalid input\",\n errors: [\n [\n {\n code: \"invalid_type\",\n expected: \"string\",\n path: [],\n message: \"Expected string\",\n input: true,\n },\n ],\n [\n {\n code: \"invalid_type\",\n expected: \"number\",\n path: [],\n message: \"Expected number\",\n input: true,\n },\n ],\n ],\n },\n ],\n ],\n },\n ] as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":708,"symbol":"tree","kind":"constant","lang":"typescript","code":"const tree: any = z.treeifyError(syntheticError);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":721,"symbol":"syntheticError","kind":"constant","lang":"typescript","doc":"a > b > c > d — each level wrapped in an invalid_union","code":"const syntheticError = new z.ZodError([\n {\n code: \"invalid_union\",\n path: [\"a\"],\n message: \"Invalid input\",\n errors: [\n [\n {\n code: \"invalid_union\",\n path: [\"b\"],\n message: \"Invalid input\",\n errors: [\n [\n {\n code: \"invalid_union\",\n path: [\"c\"],\n message: \"Invalid input\",\n errors: [\n [\n {\n code: \"invalid_type\",\n expected: \"string\",\n path: [\"d\"],\n message: \"Expected string\",\n input: 123,\n },\n ],\n ],\n },\n ],\n ],\n },\n ],\n ],\n },\n ] as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":758,"symbol":"tree","kind":"constant","lang":"typescript","code":"const tree: any = z.treeifyError(syntheticError);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":765,"symbol":"lvlA","kind":"constant","lang":"typescript","code":"const lvlA = tree.properties.a;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":768,"symbol":"lvlB","kind":"constant","lang":"typescript","code":"const lvlB = lvlA.properties.b;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":771,"symbol":"lvlC","kind":"constant","lang":"typescript","code":"const lvlC = lvlB.properties.c;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":777,"symbol":"innerUnion","kind":"constant","lang":"typescript","code":"const innerUnion = z.union([\n z.object({ type: z.literal(\"a\"), value: z.string() }),\n z.object({ type: z.literal(\"b\"), value: z.number() }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":782,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().or(\n z.object({\n settings: z.object({ name: z.string() }).and(innerUnion),\n })\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":788,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({\n settings: { name: 123, type: \"x\", value: true },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":794,"symbol":"tree","kind":"constant","lang":"typescript","code":"const tree: any = z.treeifyError(result.error);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":798,"symbol":"settingsProperties","kind":"constant","lang":"typescript","code":"const settingsProperties = tree.properties.settings.properties ?? {};"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":808,"symbol":"prototypePropertyNames","kind":"constant","lang":"typescript","code":"const prototypePropertyNames = [\"__proto__\", \"constructor\", \"toString\", \"hasOwnProperty\", \"valueOf\"] as const;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":811,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ data: z.string() }).superRefine((_, ctx) => {\n ctx.addIssue({ code: \"custom\", message: \"invalid value\", path: [name] });\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":814,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({ data: \"hello\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":816,"symbol":"formatted","kind":"constant","lang":"typescript","code":"const formatted = z.formatError(result.error!);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":823,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ data: z.string() }).superRefine((_, ctx) => {\n ctx.addIssue({ code: \"custom\", message: \"invalid value\", path: [name] });\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":826,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({ data: \"hello\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":828,"symbol":"tree","kind":"constant","lang":"typescript","code":"const tree = z.treeifyError(result.error!);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":835,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ data: z.string() }).superRefine((_, ctx) => {\n ctx.addIssue({ code: \"custom\", message: \"invalid value\", path: [name] });\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":838,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({ data: \"hello\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":847,"symbol":"protoNode","kind":"constant","lang":"typescript","doc":"The \"__proto__\" node must be a real own data property, not the inherited accessor.","code":"const protoNode = (obj: any) => Object.getOwnPropertyDescriptor(obj, \"__proto__\")!.value;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":850,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().check((ctx) => {\n ctx.issues.push({ code: \"custom\", message: \"a\", path: [\"__proto__\", \"x\"], input: ctx.value });\n ctx.issues.push({ code: \"custom\", message: \"b\", path: [\"__proto__\", \"y\"], input: ctx.value });\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":854,"symbol":"error","kind":"constant","lang":"typescript","code":"const error = schema.safeParse(\"hello\").error!;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":856,"symbol":"formatted","kind":"constant","lang":"typescript","code":"const formatted = protoNode(z.formatError(error));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":860,"symbol":"tree","kind":"constant","lang":"typescript","code":"const tree = protoNode((z.treeifyError(error) as any).properties);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":869,"symbol":"record","kind":"constant","lang":"typescript","code":"const record = z.record(z.string(), z.string()).safeParse(JSON.parse('{\"toString\": 1}'));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":873,"symbol":"entries","kind":"constant","lang":"typescript","code":"const entries = new Map(Object.entries(JSON.parse('{\"__proto__\": {\"pwn\": 1}}')));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":874,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.map(z.string(), z.object({ pwn: z.string() })).safeParse(entries);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":882,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ parent: z.record(z.string(), z.string()) });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":883,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({ parent: { _errors: 1 } });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error-utils.test.ts","line":886,"symbol":"formatted","kind":"constant","lang":"typescript","code":"const formatted = z.formatError(result.error!);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":12,"symbol":"getThrownError","kind":"function","lang":"typescript","code":"function getThrownError(fn: () => unknown): unknown {\n try {\n fn();\n } catch (error) {\n return error;\n }\n throw new Error(\"Expected function to throw\");\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":21,"symbol":"getRejectedError","kind":"function","lang":"typescript","code":"async function getRejectedError(fn: () => Promise<unknown>): Promise<unknown> {\n try {\n await fn();\n } catch (error) {\n return error;\n }\n throw new Error(\"Expected function to reject\");\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":30,"symbol":"expectFirstStackFrameAtCallsite","kind":"function","lang":"typescript","code":"function expectFirstStackFrameAtCallsite(error: unknown): void {\n expect(error).toBeInstanceOf(Error);\n const stack = (error as Error).stack;\n expect(stack).toEqual(expect.any(String));\n\n const firstFrame = stack!.split(\"\\n\").find((line) => line.trim().startsWith(\"at \"));\n expect(firstFrame).toBeDefined();\n expect(firstFrame).toContain(\"error.test.ts\");\n expect(firstFrame).not.toContain(\"core/parse.ts\");\n expect(firstFrame).not.toContain(\"classic/schemas.ts\");\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":32,"symbol":"stack","kind":"constant","lang":"typescript","code":"const stack = (error as Error).stack;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":35,"symbol":"firstFrame","kind":"constant","lang":"typescript","code":"const firstFrame = stack!.split(\"\\n\").find((line) => line.trim().startsWith(\"at \"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":43,"symbol":"err1","kind":"constant","lang":"typescript","code":"const err1 = new z.ZodError([]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":54,"symbol":"err2","kind":"constant","lang":"typescript","code":"const err2 = new z.ZodError(err1.issues);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":55,"symbol":"err3","kind":"constant","lang":"typescript","code":"const err3 = new z.ZodError([]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":72,"symbol":"errorMap","kind":"constant","lang":"typescript","code":"const errorMap: z.ZodErrorMap = (issue) => {\n if (issue.code === \"invalid_type\") {\n if (issue.expected === \"string\") {\n return { message: \"bad type!\" };\n }\n }\n if (issue.code === \"custom\") {\n return { message: `less-than-${issue.params?.minimum}` };\n }\n return undefined;\n};"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":85,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.string().safeParse(234, { error: errorMap });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":100,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z\n .number()\n .refine((val) => val >= 3, {\n params: { minimum: 3 },\n })\n .safeParse(2, { error: errorMap });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":122,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z\n .string()\n .refine((val) => val.length > 12, {\n params: { minimum: 13 },\n message: \"override\",\n })\n .safeParse(\"asdf\", { error: () => \"contextual\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":146,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z\n .number()\n .refine((x) => x > 3)\n .safeParse(2);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":164,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z\n .number()\n .refine((x) => x > 3, \"override\")\n .safeParse(2);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":182,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z\n .number()\n .refine((x) => x > 3, {\n message: \"override\",\n })\n .safeParse(2);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":225,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.literal(BigInt(12)).safeParse(BigInt(13));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":243,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n items: z.array(z.string()).refine((data) => data.length > 3, {\n path: [\"items-too-few\"],\n }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":249,"symbol":"errorMap","kind":"constant","lang":"typescript","code":"const errorMap: z.ZodErrorMap = (issue) => {\n expect((issue.path ?? []).length).toBe(2);\n return { message: \"doesnt matter\" };\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":253,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({ items: [\"first\"] }, { error: errorMap });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":300,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().email();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":301,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"asdfsdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":314,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n password: z.string(),\n confirm: z.string(),\n })\n .refine((val) => val.confirm === val.password, { path: [\"confirm\"] });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":321,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({\n password: \"peanuts\",\n confirm: \"qeanuts\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":327,"symbol":"error","kind":"constant","lang":"typescript","code":"const error = result.error!.format();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":334,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n password: z.string().min(6),\n confirm: z.string().min(6),\n })\n .refine((val) => val.confirm === val.password);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":341,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({\n password: \"qwer\",\n confirm: \"asdf\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":350,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n inner: z.object({\n name: z\n .string()\n .refine((val) => val.length > 5)\n .array()\n .refine((val) => val.length <= 1),\n }),\n});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":361,"symbol":"invalidItem","kind":"constant","lang":"typescript","code":"const invalidItem = {\n inner: { name: [\"aasd\", \"asdfasdfasfd\"] },\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":365,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = schema.safeParse(invalidItem);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":371,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .string()\n .transform((val) => val.length)\n .refine(() => false, { message: \"always fails\" })\n .refine(\n (val) => {\n if (typeof val !== \"number\") throw new Error();\n return (val ^ 2) > 10;\n } // should be number but it's a string\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":385,"symbol":"invalidItem","kind":"constant","lang":"typescript","code":"const invalidItem = {\n inner: { name: [\"aasd\", \"asdfasdfasfd\"] },\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":388,"symbol":"invalidArray","kind":"constant","lang":"typescript","code":"const invalidArray = {\n inner: { name: [\"asdfasdf\", \"asdfasdfasfd\"] },\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":391,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = schema.safeParse(invalidItem);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":392,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = schema.safeParse(invalidArray);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":396,"symbol":"error1","kind":"constant","lang":"typescript","code":"const error1 = result1.error!.format();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":401,"symbol":"FormattedError","kind":"type","lang":"typescript","code":"type FormattedError = z.inferFormattedError<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":402,"symbol":"error2","kind":"constant","lang":"typescript","code":"const error2: FormattedError = result2.error!.format();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":411,"symbol":"FormattedErrorWithNumber","kind":"type","lang":"typescript","doc":"test custom mapper","code":"type FormattedErrorWithNumber = z.inferFormattedError<typeof schema, number>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":412,"symbol":"errorWithNumber","kind":"constant","lang":"typescript","code":"const errorWithNumber: FormattedErrorWithNumber = result2.error!.format(() => 5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":419,"symbol":"nameSchema","kind":"constant","lang":"typescript","code":"const nameSchema = z.string().refine((val) => val.length > 5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":420,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n nullableObject: z.object({ name: nameSchema }).nullable(),\n nullableArray: z.array(nameSchema).nullable(),\n nullableTuple: z.tuple([nameSchema, nameSchema, z.number()]).nullable(),\n optionalObject: z.object({ name: nameSchema }).optional(),\n optionalArray: z.array(nameSchema).optional(),\n optionalTuple: z.tuple([nameSchema, nameSchema, z.number()]).optional(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":428,"symbol":"invalidItem","kind":"constant","lang":"typescript","code":"const invalidItem = {\n nullableObject: { name: \"abcd\" },\n nullableArray: [\"abcd\"],\n nullableTuple: [\"abcd\", \"abcd\", 1],\n optionalObject: { name: \"abcd\" },\n optionalArray: [\"abcd\"],\n optionalTuple: [\"abcd\", \"abcd\", 1],\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":436,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(invalidItem);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":438,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: z.inferFormattedError<typeof schema> = result.error!.format();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":521,"symbol":"schemaWithTransform","kind":"constant","lang":"typescript","code":"const schemaWithTransform = z.object({ foo: z.string() }).transform((o) => ({ bar: o.foo }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":523,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schemaWithTransform.safeParse({});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":526,"symbol":"ValidationErrors","kind":"type","lang":"typescript","code":"type ValidationErrors = z.inferFlattenedErrors<typeof schemaWithTransform>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":527,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: ValidationErrors = result.error!.flatten();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":540,"symbol":"stringWithCustomError","kind":"constant","lang":"typescript","code":"const stringWithCustomError = z.string({\n error: () => \"bound\",\n});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":545,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringWithCustomError.safeParse(1234);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":552,"symbol":"result","kind":"constant","lang":"typescript","doc":"support contextual override","code":"const result = stringWithCustomError.safeParse(undefined, {\n error: () => ({ message: \"override\" }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":563,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.string().min(10).safeParse(\"tooshort\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":581,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringWithCustomError.min(10).safeParse(\"tooshort\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":587,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringWithCustomError.min(10, { error: () => \"check\" }).safeParse(\"tooshort\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":594,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringWithCustomError.min(10).safeParse(\"tooshort\", { error: () => \"contextual\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":601,"symbol":"deferring","kind":"constant","lang":"typescript","code":"const deferring = z.string({\n error: () => {\n calls++;\n return undefined;\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":608,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = deferring.min(10).safeParse(\"tooshort\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":665,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().max(1, { message: \"\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":666,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/error.test.ts","line":672,"symbol":"user","kind":"constant","lang":"typescript","code":"const user = z\n .object({\n password: z.string().min(6),\n confirm: z.string(),\n })\n .refine((data) => data.password === data.confirm, {\n message: \"Passwords don't match\",\n path: [\"confirm\"],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/file.test.ts","line":7,"symbol":"minCheck","kind":"constant","lang":"typescript","code":"const minCheck = z.file().min(5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/file.test.ts","line":8,"symbol":"maxCheck","kind":"constant","lang":"typescript","code":"const maxCheck = z.file().max(8);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/file.test.ts","line":9,"symbol":"mimeCheck","kind":"constant","lang":"typescript","code":"const mimeCheck = z.file().mime([\"text/plain\", \"application/json\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/file.test.ts","line":11,"symbol":"originalFile","kind":"constant","lang":"typescript","code":"const originalFile = global.File;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/firstparty.test.ts","line":6,"symbol":"myType","kind":"constant","lang":"typescript","code":"const myType = z.string() as core.$ZodTypes;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/firstparty.test.ts","line":7,"symbol":"def","kind":"constant","lang":"typescript","code":"const def = myType._zod.def;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/firstparty.test.ts","line":93,"symbol":"type","kind":"constant","lang":"typescript","code":"const type = \"string\" as core.$ZodTypeDef[\"type\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/fix-json-issue.test.ts","line":6,"symbol":"DataType","kind":"constant","lang":"typescript","code":"const DataType = object({\n data: json(),\n});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/fix-json-issue.test.ts","line":9,"symbol":"DataType","kind":"type","lang":"typescript","code":"type DataType = _infer<typeof DataType>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/fix-json-issue.test.ts","line":12,"symbol":"Container","kind":"constant","lang":"typescript","doc":"biome-ignore lint/suspicious/noExportsInTest: This export is required to reproduce TS4023","code":"const Container = object({\n contained: pipe(\n nullable(DataType),\n transform<DataType | null>(\n (v) =>\n v ?? {\n data: \"\",\n }\n )\n ),\n});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":6,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({ type: \"string\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":12,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n type: \"string\",\n minLength: 3,\n maxLength: 10,\n pattern: \"^[a-z]+$\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":27,"symbol":"schema","kind":"constant","lang":"typescript","doc":"JSON Schema patterns match anywhere in the string, not just the full string","code":"const schema = fromJSONSchema({\n type: \"string\",\n pattern: \"foo\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":39,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({ type: \"number\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":45,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n type: \"number\",\n minimum: 0,\n maximum: 100,\n multipleOf: 5,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":58,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n type: \"number\",\n minimum: 5,\n maximum: 10,\n exclusiveMinimum: true,\n exclusiveMaximum: true,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":73,"symbol":"checks","kind":"constant","lang":"typescript","doc":"the inclusive .min()/.max() must be skipped so only the exclusive checks remain","code":"const checks = (schema as any)._zod.def.checks.map((c: any) => [\n c._zod.def.check,\n c._zod.def.value,\n c._zod.def.inclusive,\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":85,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({ type: \"integer\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":91,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({ type: \"boolean\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":98,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({ type: \"null\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":104,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n age: { type: \"number\" },\n },\n required: [\"name\"],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":118,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n },\n additionalProperties: false,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":130,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n type: \"array\",\n items: { type: \"string\" },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":139,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n type: \"array\",\n items: { type: \"number\" },\n minItems: 2,\n maxItems: 4,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":152,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n $schema: \"https://json-schema.org/draft/2020-12/schema\",\n type: \"array\",\n prefixItems: [{ type: \"string\" }, { type: \"number\" }],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":167,"symbol":"partialItems","kind":"constant","lang":"typescript","code":"const partialItems = fromJSONSchema({\n $schema: \"https://json-schema.org/draft/2020-12/schema\",\n type: \"array\",\n prefixItems: [{ type: \"string\" }, { type: \"number\" }],\n minItems: 1,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":176,"symbol":"allRequired","kind":"constant","lang":"typescript","code":"const allRequired = fromJSONSchema({\n $schema: \"https://json-schema.org/draft/2020-12/schema\",\n type: \"array\",\n prefixItems: [{ type: \"string\" }, { type: \"number\" }],\n minItems: 2,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":187,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n $schema: \"https://json-schema.org/draft/2020-12/schema\",\n type: \"array\",\n prefixItems: [{ type: \"string\" }],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":196,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n $schema: \"https://json-schema.org/draft/2020-12/schema\",\n type: \"array\",\n prefixItems: [{ type: \"string\" }],\n items: { type: \"number\" },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":207,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n $schema: \"https://json-schema.org/draft/2020-12/schema\",\n type: \"array\",\n prefixItems: [{ type: \"string\" }, { type: \"number\" }],\n items: true,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":217,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n $schema: \"https://json-schema.org/draft/2020-12/schema\",\n type: \"array\",\n prefixItems: [{ type: \"string\" }],\n items: false,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":228,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n $schema: \"http://json-schema.org/draft-07/schema#\",\n type: \"array\",\n items: [{ type: \"string\" }, { type: \"number\" }],\n additionalItems: false,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":243,"symbol":"partialItems","kind":"constant","lang":"typescript","code":"const partialItems = fromJSONSchema({\n $schema: \"http://json-schema.org/draft-07/schema#\",\n type: \"array\",\n items: [{ type: \"string\" }, { type: \"number\" }],\n additionalItems: false,\n minItems: 1,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":253,"symbol":"allRequired","kind":"constant","lang":"typescript","code":"const allRequired = fromJSONSchema({\n $schema: \"http://json-schema.org/draft-07/schema#\",\n type: \"array\",\n items: [{ type: \"string\" }, { type: \"number\" }],\n additionalItems: false,\n minItems: 2,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":265,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n $schema: \"http://json-schema.org/draft-07/schema#\",\n type: \"array\",\n items: [{ type: \"string\" }],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":274,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n $schema: \"http://json-schema.org/draft-07/schema#\",\n type: \"array\",\n items: [{ type: \"string\" }, { type: \"number\" }],\n additionalItems: true,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":284,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n $schema: \"http://json-schema.org/draft-07/schema#\",\n type: \"array\",\n items: [{ type: \"string\" }],\n additionalItems: { type: \"number\" },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":295,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n enum: [\"red\", \"green\", \"blue\"],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":303,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n const: \"hello\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":311,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n anyOf: [{ type: \"string\" }, { type: \"number\" }],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":320,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n allOf: [\n { type: \"object\", properties: { name: { type: \"string\" } }, required: [\"name\"] },\n { type: \"object\", properties: { age: { type: \"number\" } }, required: [\"age\"] },\n ],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":326,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.parse({ name: \"John\", age: 30 }) as { name: string; age: number };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":333,"symbol":"schema1","kind":"constant","lang":"typescript","doc":"Empty allOf without explicit type returns any","code":"const schema1 = fromJSONSchema({\n allOf: [],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":341,"symbol":"schema2","kind":"constant","lang":"typescript","doc":"Empty allOf with explicit type returns base schema","code":"const schema2 = fromJSONSchema({\n type: \"string\",\n allOf: [],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":350,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n oneOf: [{ type: \"string\" }, { type: \"number\" }],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":360,"symbol":"schema","kind":"constant","lang":"typescript","doc":"type: string AND (type:string,minLength:5 OR type:string,pattern:^a)","code":"const schema = fromJSONSchema({\n type: \"string\",\n anyOf: [\n { type: \"string\", minLength: 5 },\n { type: \"string\", pattern: \"^a\" },\n ],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":379,"symbol":"schema","kind":"constant","lang":"typescript","doc":"type: string AND (exactly one of: type:string,minLength:5 OR type:string,pattern:^a)","code":"const schema = fromJSONSchema({\n type: \"string\",\n oneOf: [\n { type: \"string\", minLength: 5 },\n { type: \"string\", pattern: \"^a\" },\n ],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":434,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n $defs: {\n User: {\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n },\n required: [\"name\"],\n },\n },\n $ref: \"#/$defs/User\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":453,"symbol":"inner","kind":"constant","lang":"typescript","code":"const inner = z.object({ name: z.string() }).meta({ id });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":454,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema(z.toJSONSchema(z.object({ inner })));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":460,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n $defs: {\n Node: {\n type: \"object\",\n properties: {\n value: { type: \"string\" },\n children: {\n type: \"array\",\n items: { $ref: \"#/$defs/Node\" },\n },\n },\n },\n },\n $ref: \"#/$defs/Node\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":475,"symbol":"Node","kind":"type","lang":"typescript","code":"type Node = { value: string; children: Node[] };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":476,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.parse({\n value: \"root\",\n children: [{ value: \"child\", children: [] }],\n }) as Node;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":485,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n type: \"object\",\n patternProperties: {\n \"^S_\": { type: \"string\" },\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":491,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.parse({ S_name: \"John\", S_age: \"30\" }) as Record<string, string>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":497,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n type: \"object\",\n propertyNames: { enum: [\"a\", \"b\"] },\n additionalProperties: { type: \"string\" },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":509,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n type: \"object\",\n properties: { a: { type: \"string\" } },\n propertyNames: { enum: [\"a\", \"b\"] },\n additionalProperties: { type: \"string\" },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":522,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n type: \"object\",\n properties: { a: { type: \"string\" }, b: { type: \"string\" } },\n required: [\"a\"],\n propertyNames: { enum: [\"a\", \"b\"] },\n additionalProperties: { type: \"string\" },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":536,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n type: \"object\",\n properties: { a: { type: \"number\" } },\n propertyNames: { enum: [\"a\", \"b\"] },\n additionalProperties: { type: \"string\" },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":548,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n type: \"object\",\n properties: { a: { type: \"string\" } },\n propertyNames: { enum: [\"a\", \"b\"] },\n additionalProperties: false,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":560,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n type: \"object\",\n patternProperties: { \"^S_\": { type: \"string\" } },\n propertyNames: { type: \"string\", pattern: \"^S_\" },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":571,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({ type: \"object\", propertyNames: { enum: [\"a\"] } });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":576,"symbol":"withDefault","kind":"constant","lang":"typescript","doc":"A property `default` adds a key that was never in the instance.","code":"const withDefault = fromJSONSchema({\n type: \"object\",\n properties: { AB: { type: \"string\", default: \"x\" } },\n propertyNames: { type: \"string\", pattern: \"^[a-z]+$\" },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":585,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n type: \"object\",\n propertyNames: { pattern: \"^[A-Za-z_][A-Za-z0-9_]*$\" },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":606,"symbol":"shared","kind":"constant","lang":"typescript","doc":"A $ref target is shared by every reference to it; metadata must not leak onto it.","code":"const shared = z.toJSONSchema(\n fromJSONSchema({\n $defs: { N: { type: \"object\", properties: { v: { type: \"string\" } } } },\n type: \"object\",\n properties: { a: { $ref: \"#/$defs/N\", propertyNames: { enum: [\"v\"] } }, b: { $ref: \"#/$defs/N\" } },\n })\n ) as any;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":617,"symbol":"roundTripped","kind":"constant","lang":"typescript","code":"const roundTripped = z.toJSONSchema(\n fromJSONSchema({\n type: \"object\",\n propertyNames: { enum: [\"a\", \"b\"] },\n additionalProperties: { type: \"string\" },\n })\n ) as Record<string, unknown>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":629,"symbol":"out","kind":"constant","lang":"typescript","code":"const out = z.toJSONSchema(\n fromJSONSchema({\n type: \"object\",\n properties: { a: { type: \"string\" } },\n propertyNames: { enum: [\"a\", \"b\"] },\n additionalProperties: { type: \"string\" },\n }),\n { io }\n ) as Record<string, unknown>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":646,"symbol":"schema","kind":"constant","lang":"typescript","doc":"Note: When patternProperties is combined with properties, the intersection validates all keys against the pattern. This test uses a pattern that matches the regular property name as well.","code":"const schema = fromJSONSchema({\n type: \"object\",\n properties: {\n S_name: { type: \"string\" },\n },\n patternProperties: {\n \"^S_\": { type: \"string\" },\n },\n required: [\"S_name\"],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":656,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.parse({ S_name: \"John\", S_extra: \"value\" }) as Record<string, string>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/from-json-schema.test.ts","line":662,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = fromJSONSchema({\n type: \"object\",\n patternProperties: {\n \"^S_\": { type: \"string\" },\n \"^N_\": { type: \"number\" },\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":4,"symbol":"args1","kind":"constant","lang":"typescript","code":"const args1 = z.tuple([z.string()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":5,"symbol":"returns1","kind":"constant","lang":"typescript","code":"const returns1 = z.number();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":6,"symbol":"func1","kind":"constant","lang":"typescript","code":"const func1 = z.function({\n input: args1,\n\n output: returns1,\n});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":13,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = func1.implement((arg: any) => arg.length);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":14,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = parsed(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":20,"symbol":"parsed","kind":"constant","lang":"typescript","doc":"@ts-expect-error","code":"const parsed = func1.implement((x: string) => x);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":26,"symbol":"parsed","kind":"constant","lang":"typescript","doc":"@ts-expect-error","code":"const parsed = func1.implement((x: string) => x);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":31,"symbol":"func1","kind":"type","lang":"typescript","code":"type func1 = (typeof func1)[\"_input\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":36,"symbol":"methodObject","kind":"constant","lang":"typescript","code":"const methodObject = z.object({\n property: z.number(),\n method: z\n .function()\n .input(z.tuple([z.string()]))\n .output(z.number()),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":43,"symbol":"methodInstance","kind":"constant","lang":"typescript","code":"const methodInstance = {\n property: 3,\n method: function (s: string) {\n return s.length + this.property;\n },\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":49,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = methodObject.parse(methodInstance);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":54,"symbol":"methodObject","kind":"constant","lang":"typescript","code":"const methodObject = z.object({\n property: z.number(),\n method: z.function().input([z.string()]).output(z.promise(z.number())),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":58,"symbol":"methodInstance","kind":"constant","lang":"typescript","code":"const methodInstance = {\n property: 3,\n method: async function (s: string) {\n return s.length + this.property;\n },\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":64,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = methodObject.parse(methodInstance);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":69,"symbol":"t1","kind":"constant","lang":"typescript","code":"const t1 = z.function();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":70,"symbol":"t1","kind":"type","lang":"typescript","code":"type t1 = (typeof t1)[\"_input\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":74,"symbol":"t2args","kind":"constant","lang":"typescript","code":"const t2args = z.tuple([z.string()], z.unknown());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":76,"symbol":"t2","kind":"constant","lang":"typescript","code":"const t2 = t1.input(t2args);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":77,"symbol":"t2","kind":"type","lang":"typescript","code":"type t2 = (typeof t2)[\"_input\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":80,"symbol":"t3","kind":"constant","lang":"typescript","code":"const t3 = t2.output(z.boolean());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":81,"symbol":"t3","kind":"type","lang":"typescript","code":"type t3 = (typeof t3)[\"_input\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":93,"symbol":"args2","kind":"constant","lang":"typescript","code":"const args2 = z.tuple([\n z.object({\n f1: z.number(),\n f2: z.string().nullable(),\n f3: z.array(z.boolean().optional()).optional(),\n }),\n]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":100,"symbol":"returns2","kind":"constant","lang":"typescript","code":"const returns2 = z.union([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":102,"symbol":"func2","kind":"constant","lang":"typescript","code":"const func2 = z.function({\n input: args2,\n output: returns2,\n});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":108,"symbol":"func2","kind":"type","lang":"typescript","code":"type func2 = (typeof func2)[\"_input\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":120,"symbol":"validFunc2Instance","kind":"constant","lang":"typescript","code":"const validFunc2Instance = func2.implement((_x) => {\n _x.f2;\n _x.f3![0];\n return \"adf\" as any;\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":133,"symbol":"args3","kind":"constant","lang":"typescript","code":"const args3 = [\n z.object({\n f1: z.number(),\n f2: z.string().nullable(),\n f3: z.array(z.boolean().optional()).optional(),\n }),\n] as const;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":140,"symbol":"returns3","kind":"constant","lang":"typescript","code":"const returns3 = z.union([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":142,"symbol":"func3","kind":"constant","lang":"typescript","code":"const func3 = z.function({\n input: args3,\n output: returns3,\n});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":148,"symbol":"func3","kind":"type","lang":"typescript","code":"type func3 = (typeof func3)[\"_input\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":160,"symbol":"validFunc3Instance","kind":"constant","lang":"typescript","code":"const validFunc3Instance = func3.implement((_x) => {\n _x.f2;\n _x.f3![0];\n return \"adf\" as any;\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":174,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.function({\n input: z.tuple([z.string()]),\n output: z.void(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":178,"symbol":"fn","kind":"constant","lang":"typescript","code":"const fn = schema.implement(() => 1234 as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":181,"symbol":"checker","kind":"constant","lang":"typescript","doc":"@ts-expect-error","code":"const checker = () => fn();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":202,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.function({\n input: [\n z.object({\n name: z.string(),\n age: z.number().int(),\n }),\n ],\n output: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":216,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.function({\n input: [\n z.object({\n name: z.string(),\n age: z.number().int(),\n }),\n ],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":230,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.function({\n input: z.tuple([]),\n output: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":234,"symbol":"fn","kind":"constant","lang":"typescript","code":"const fn = schema.implement(() => 1234 as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":252,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .function()\n .input([z.string().refine(async (val) => val.length > 10)])\n .output(z.promise(z.number().refine(async (val) => val > 10)));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":257,"symbol":"func","kind":"constant","lang":"typescript","code":"const func = schema.implementAsync(async (val) => {\n return val.length;\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":260,"symbol":"results","kind":"constant","lang":"typescript","code":"const results = [];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":278,"symbol":"typeGuard","kind":"constant","lang":"typescript","code":"const typeGuard = (data: string): data is \"1234\" => data === \"1234\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":279,"symbol":"codeSchema","kind":"constant","lang":"typescript","code":"const codeSchema = z.string().transform((data, ctx) => {\n if (typeGuard(data)) {\n return data;\n } else {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: \"Invalid code\",\n });\n return z.NEVER;\n }\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":290,"symbol":"inputSchema","kind":"constant","lang":"typescript","code":"const inputSchema = z.object({\n code: codeSchema,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":293,"symbol":"outputSchema","kind":"constant","lang":"typescript","code":"const outputSchema = z.object({\n data: z.array(z.string()).default([]),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":296,"symbol":"fnImplementation","kind":"constant","lang":"typescript","code":"const fnImplementation = async (data: z.infer<typeof inputSchema>): Promise<z.infer<typeof outputSchema>> => {\n return {\n data: [data.code],\n };\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":301,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.function().input([inputSchema]).output(outputSchema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":303,"symbol":"func","kind":"constant","lang":"typescript","code":"const func = schema.implementAsync(fnImplementation);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":304,"symbol":"TheInterface","kind":"type","lang":"typescript","code":"type TheInterface = {\n myFunction: (data: z.infer<typeof inputSchema>) => Promise<z.infer<typeof outputSchema>>;\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":307,"symbol":"theImplementation","kind":"constant","lang":"typescript","code":"const theImplementation: TheInterface = {\n myFunction: func,\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":310,"symbol":"results","kind":"constant","lang":"typescript","code":"const results = [];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":330,"symbol":"func","kind":"constant","lang":"typescript","code":"const func = z\n .function()\n .input([z.string().refine(async (val) => val.length > 10)])\n .output(z.number().refine(async (val) => val > 10))\n .implement((val) => {\n return val.length;\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":338,"symbol":"results","kind":"constant","lang":"typescript","code":"const results = [];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":350,"symbol":"maxLength5","kind":"constant","lang":"typescript","code":"const maxLength5 = z\n .function()\n .input([z.string()], z.unknown())\n .output(z.boolean())\n .implement((str, _arg, _qewr) => {\n return str.length <= 5;\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":358,"symbol":"filteredList","kind":"constant","lang":"typescript","code":"const filteredList = [\"apple\", \"orange\", \"pear\", \"banana\", \"strawberry\"].filter(maxLength5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":363,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.function({ input: [z.string()], output: z.number() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":364,"symbol":"fn","kind":"constant","lang":"typescript","code":"const fn = schema.implement((s) => s.length);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":367,"symbol":"HasZod","kind":"type","lang":"typescript","doc":"Deliberately absent from implement()'s return type: reaching `_zod` takes a cast, so an implemented function never reads as a schema to TypeScript even though it does at runtime.","code":"type HasZod = \"_zod\" extends keyof typeof fn ? true : false;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":379,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.function({ input: [z.string()], output: z.promise(z.number()) });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/function.test.ts","line":380,"symbol":"fn","kind":"constant","lang":"typescript","code":"const fn = schema.implementAsync(async (s) => s.length);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/generics.test.ts","line":4,"symbol":"nest","kind":"function","lang":"typescript","code":"function nest<TData extends z.ZodType>(schema: TData) {\n return z.object({\n nested: schema,\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/generics.test.ts","line":11,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = nest(z.object({ a: z.string() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/generics.test.ts","line":12,"symbol":"a","kind":"type","lang":"typescript","code":"type a = z.infer<typeof a>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/generics.test.ts","line":15,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = nest(z.object({ a: z.string().optional() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/generics.test.ts","line":16,"symbol":"b","kind":"type","lang":"typescript","code":"type b = z.infer<typeof b>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/generics.test.ts","line":21,"symbol":"stripOuter","kind":"function","lang":"typescript","code":"async function stripOuter<TData extends z.ZodType>(schema: TData, data: unknown) {\n return z\n .object({\n nested: schema.optional(),\n })\n .transform((data) => {\n return data.nested;\n })\n .parse({ nested: data });\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/generics.test.ts","line":32,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stripOuter(z.object({ a: z.string() }), { a: \"asdf\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/generics.test.ts","line":52,"symbol":"inner","kind":"constant","lang":"typescript","code":"const inner = z.string().or(z.array(z.string()));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/generics.test.ts","line":53,"symbol":"outer","kind":"constant","lang":"typescript","code":"const outer = z.object({ inner });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/generics.test.ts","line":54,"symbol":"outerSchema","kind":"type","lang":"typescript","code":"type outerSchema = z.infer<typeof outer>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/generics.test.ts","line":61,"symbol":"createV4Schema","kind":"constant","lang":"typescript","code":"const createV4Schema = <Output>(opts: {\n schema: z.ZodType<Output>;\n }) => {\n return opts.schema;\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/global-config.test.ts","line":28,"symbol":"direct","kind":"constant","lang":"typescript","doc":"Object identity is preserved across reloads of the module: anyone who pre-populates `globalThis.__zod_globalConfig` before Zod loads (e.g. an inline script before the bundle) keeps that exact object as the source of truth. Mutating it directly is equivalent to z.config().","code":"const direct = (globalThis as any).__zod_globalConfig;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/hash.test.ts","line":7,"symbol":"Alg","kind":"type","lang":"typescript","code":"type Alg = \"md5\" | \"sha1\" | \"sha256\" | \"sha384\" | \"sha512\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/hash.test.ts","line":10,"symbol":"toB64Url","kind":"constant","lang":"typescript","code":"const toB64Url = (b64: string) => b64.replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/g, \"\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/hash.test.ts","line":12,"symbol":"makeDigests","kind":"constant","lang":"typescript","code":"const makeDigests = (alg: Alg, input: string) => {\n const buf = createHash(alg).update(input).digest();\n const hex = buf.toString(\"hex\");\n const base64 = buf.toString(\"base64\");\n const base64url = toB64Url(base64);\n return { hex, base64, base64url };\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/hash.test.ts","line":13,"symbol":"buf","kind":"constant","lang":"typescript","code":"const buf = createHash(alg).update(input).digest();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/hash.test.ts","line":14,"symbol":"hex","kind":"constant","lang":"typescript","code":"const hex = buf.toString(\"hex\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/hash.test.ts","line":15,"symbol":"base64","kind":"constant","lang":"typescript","code":"const base64 = buf.toString(\"base64\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/hash.test.ts","line":16,"symbol":"base64url","kind":"constant","lang":"typescript","code":"const base64url = toB64Url(base64);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/hash.test.ts","line":20,"symbol":"algs","kind":"constant","lang":"typescript","code":"const algs: ReadonlyArray<Alg> = [\"md5\", \"sha1\", \"sha256\", \"sha384\", \"sha512\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/hash.test.ts","line":21,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = \"zodasklfjaasdf\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/hash.test.ts","line":55,"symbol":"base64NoPad","kind":"constant","lang":"typescript","code":"const base64NoPad = base64.replace(/=+$/g, \"\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/hash.test.ts","line":64,"symbol":"schemaWithEmptyParams","kind":"constant","lang":"typescript","doc":"Param object present but enc omitted should still default to hex at runtime","code":"const schemaWithEmptyParams = hash(alg, {} as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/iban.test.ts","line":5,"symbol":"valid","kind":"constant","lang":"typescript","code":"const valid: [string, string][] = [\n [\"Norway (15, minimum)\", \"NO9386011117947\"],\n [\"Belgium (16)\", \"BE68539007547034\"],\n [\"Netherlands (18)\", \"NL91ABNA0417164300\"],\n [\"Germany (22)\", \"DE89370400440532013000\"],\n [\"Great Britain (22)\", \"GB29NWBK60161331926819\"],\n [\"Turkey (26)\", \"TR610000100000000000000001\"],\n [\"France (27)\", \"FR1420041010050500013M02606\"],\n [\"Cyprus (28)\", \"CY17002001280000001200527600\"],\n [\"Malta (31)\", \"MT84MALT011000012345MTLCAST001S\"],\n [\"Maximum length (34)\", \"AA73AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"],\n [\"Maximum length mixed (34)\", \"ZZ560123456789ABCDEFGHIJKLMNOPQRST\"],\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/iban.test.ts","line":69,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.fromJSONSchema(z.toJSONSchema(z.iban()));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/iban.test.ts","line":75,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.iban().safeParse(\"not-an-iban\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":6,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.codec(z.string(), z.bigint(), {\n decode: (s) => BigInt(s),\n encode: (n) => n.toString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":15,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.codec(z.string(), z.bigint(), {\n decode: (s) => BigInt(s),\n encode: (n) => n.toString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":19,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = z.object({ b: c });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":21,"symbol":"decoded","kind":"constant","lang":"typescript","code":"const decoded = z.output(obj);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":24,"symbol":"encoded","kind":"constant","lang":"typescript","code":"const encoded = z.input(obj);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":29,"symbol":"keyCodec","kind":"constant","lang":"typescript","code":"const keyCodec = z.codec(z.string(), z.enum([\"a\", \"b\"]), {\n decode: (s) => (s === \"a\" || s === \"b\" ? s : z.NEVER),\n encode: (s) => s,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":33,"symbol":"valueObject","kind":"constant","lang":"typescript","code":"const valueObject = z.object({\n n: z.codec(z.string(), z.bigint(), { decode: (s) => BigInt(s), encode: (n) => n.toString() }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":37,"symbol":"fullCodec","kind":"constant","lang":"typescript","code":"const fullCodec = z.codec(\n z.record(z.input(keyCodec), z.input(valueObject)),\n z.map(z.output(keyCodec), z.output(valueObject)),\n {\n decode: (input) => {\n const m = new Map<\"a\" | \"b\", { n: bigint }>();\n for (const [k, v] of Object.entries(input)) {\n m.set(keyCodec.decode(k), valueObject.decode(v));\n }\n return m;\n },\n encode: (input) => {\n const out: Record<string, { n: string }> = {};\n for (const [k, v] of input.entries()) {\n out[keyCodec.encode(k)] = valueObject.encode(v);\n }\n return out;\n },\n }\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":42,"symbol":"m","kind":"constant","lang":"typescript","code":"const m = new Map<\"a\" | \"b\", { n: bigint }>();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":49,"symbol":"out","kind":"constant","lang":"typescript","code":"const out: Record<string, { n: string }> = {};"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":63,"symbol":"s","kind":"constant","lang":"typescript","code":"const s = z.object({ a: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":69,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z\n .codec(z.string(), z.number().int(), { decode: Number, encode: String })\n .refine((n) => n > 10, { error: \"gt10\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":72,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = z.object({ list: z.array(c) });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":73,"symbol":"decoded","kind":"constant","lang":"typescript","code":"const decoded = z.output(obj);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":86,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.codec(z.string(), z.number(), { decode: Number, encode: String }).refine((n) => n > 10);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":94,"symbol":"p","kind":"constant","lang":"typescript","code":"const p = z.preprocess((v) => String(v), z.string().min(5));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":95,"symbol":"encoded","kind":"constant","lang":"typescript","code":"const encoded = z.input(p);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":105,"symbol":"checked","kind":"constant","lang":"typescript","doc":"A check on the pipe itself travels with whichever side wins.","code":"const checked = z.preprocess((v) => String(v), z.string()).refine((s) => s.startsWith(\"ok\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":110,"symbol":"c","kind":"constant","lang":"typescript","doc":"Control: a codec has two real sides, so its input side is still `in`, by identity.","code":"const c = z.codec(z.string(), z.number(), { decode: Number, encode: String });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":115,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.codec(z.string(), z.number(), { decode: Number, encode: String });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":132,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = z.string().default(\"x\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":133,"symbol":"k","kind":"constant","lang":"typescript","code":"const k = z.string().catch(\"y\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":134,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = z.string().prefault(\"z\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":141,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = z.object({ a: z.string().default(\"q\") });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":147,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.codec(z.string(), z.bigint(), {\n decode: (s) => BigInt(s),\n encode: (n) => n.toString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":151,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = z.object({ b: c });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":154,"symbol":"parsed","kind":"constant","lang":"typescript","doc":"Runtime: parse the input shape.","code":"const parsed = z.input(obj).parse({ b: \"1\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/in-out.test.ts","line":156,"symbol":"asType","kind":"constant","lang":"typescript","doc":"Type: matches the declared input type.","code":"const asType: z.input<typeof obj> = parsed;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":6,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.boolean();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":11,"symbol":"a","kind":"type","lang":"typescript","code":"type a = z.output<typeof a>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":16,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.bigint();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":23,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.symbol();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":24,"symbol":"sym","kind":"constant","lang":"typescript","code":"const sym = Symbol();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":30,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.date();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":31,"symbol":"date","kind":"constant","lang":"typescript","code":"const date = new Date();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":37,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.coerce.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":45,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.coerce.number();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":54,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.coerce.boolean();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":70,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.coerce.bigint();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":77,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.coerce.date();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":78,"symbol":"date","kind":"constant","lang":"typescript","code":"const date = new Date();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":85,"symbol":"d1","kind":"constant","lang":"typescript","code":"const d1 = \"2021-01-01T00:00:00Z\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":86,"symbol":"d2","kind":"constant","lang":"typescript","code":"const d2 = \"2021-01-01T00:00:00.123Z\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":87,"symbol":"d3","kind":"constant","lang":"typescript","code":"const d3 = \"2021-01-01T00:00:00\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":88,"symbol":"d4","kind":"constant","lang":"typescript","code":"const d4 = \"2021-01-01T00:00:00+07:00\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":89,"symbol":"d5","kind":"constant","lang":"typescript","code":"const d5 = \"bad data\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":92,"symbol":"a","kind":"constant","lang":"typescript","doc":"local: false, offset: false, precision: null","code":"const a = z.iso.datetime();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":99,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.iso.datetime({ local: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":106,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.iso.datetime({ offset: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":113,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = z.iso.datetime({ precision: 3 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":122,"symbol":"d1","kind":"constant","lang":"typescript","code":"const d1 = \"2021-01-01\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":123,"symbol":"d2","kind":"constant","lang":"typescript","code":"const d2 = \"bad data\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":125,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.iso.date();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":129,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.string().check(z.iso.date());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":135,"symbol":"d1","kind":"constant","lang":"typescript","code":"const d1 = \"00:00:00\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":136,"symbol":"d2","kind":"constant","lang":"typescript","code":"const d2 = \"00:00:00.123\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":137,"symbol":"d3","kind":"constant","lang":"typescript","code":"const d3 = \"bad data\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":139,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.iso.time();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":144,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.iso.time({ precision: 3 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":149,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.string().check(z.iso.time());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":156,"symbol":"d1","kind":"constant","lang":"typescript","code":"const d1 = \"P3Y6M4DT12H30M5S\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":157,"symbol":"d2","kind":"constant","lang":"typescript","code":"const d2 = \"bad data\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":159,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.iso.duration();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":163,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.string().check(z.iso.duration());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":169,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.undefined();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":175,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.null();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":181,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.any();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":194,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.unknown();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":207,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.never();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":212,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.void();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":218,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.array(z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":225,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.union([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":232,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.intersection(z.object({ a: z.string() }), z.object({ b: z.number() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":240,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.tuple([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":247,"symbol":"b","kind":"constant","lang":"typescript","doc":"tuple with rest","code":"const b = z.tuple([z.string(), z.number(), z.optional(z.string())], z.boolean());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":248,"symbol":"b","kind":"type","lang":"typescript","code":"type b = z.output<typeof b>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":251,"symbol":"datas","kind":"constant","lang":"typescript","code":"const datas = [\n [\"hello\", 123],\n [\"hello\", 123, \"world\"],\n [\"hello\", 123, \"world\", true],\n [\"hello\", 123, \"world\", true, false, true],\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":265,"symbol":"cArgs","kind":"constant","lang":"typescript","doc":"tuple with readonly args","code":"const cArgs = [z.string(), z.number(), z.optional(z.string())] as const;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":266,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.tuple(cArgs, z.boolean());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":267,"symbol":"c","kind":"type","lang":"typescript","code":"type c = z.output<typeof c>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":274,"symbol":"a","kind":"constant","lang":"typescript","doc":"record schema with enum keys","code":"const a = z.record(z.string(), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":275,"symbol":"a","kind":"type","lang":"typescript","code":"type a = z.output<typeof a>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":278,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.record(z.union([z.string(), z.number(), z.symbol()]), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":279,"symbol":"b","kind":"type","lang":"typescript","code":"type b = z.output<typeof b>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":288,"symbol":"c","kind":"constant","lang":"typescript","doc":"enum keys","code":"const c = z.record(z.enum([\"a\", \"b\", \"c\"]), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":289,"symbol":"c","kind":"type","lang":"typescript","code":"type c = z.output<typeof c>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":302,"symbol":"d","kind":"constant","lang":"typescript","doc":"partial enum","code":"const d = z.record(z.enum([\"a\", \"b\"]).or(z.never()), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/index.test.ts","line":303,"symbol":"d","kind":"type","lang":"typescript","code":"type d = z.output<typeof d>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":8,"symbol":"MAX_OWN_PROPS","kind":"constant","lang":"typescript","doc":"V8 sizes an instance's property backing store in steps, and schema instances get no in-object slots (their constructor assigns nothing itself): 12 own properties cost 128 bytes, 13 cost 848, 21 cost 1616. Methods therefore live on the prototype and materialize per instance on first read. These bounds are what keeps a schema graph small; crossing one silently multiplies its memory by 6x.","code":"const MAX_OWN_PROPS = 12;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":11,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases: Array<[string, object]> = [\n [\"string\", z.string()],\n [\"number\", z.number()],\n [\"bigint\", z.bigint()],\n [\"boolean\", z.boolean()],\n [\"date\", z.date()],\n [\"enum\", z.enum([\"a\", \"b\"])],\n [\"array\", z.array(z.string())],\n [\"object\", z.object({ a: z.string() })],\n [\"record\", z.record(z.string(), z.string())],\n [\"map\", z.map(z.string(), z.string())],\n [\"set\", z.set(z.string())],\n [\"union\", z.union([z.string(), z.number()])],\n [\"optional\", z.string().optional()],\n [\"pipe\", z.string().pipe(z.string())],\n [\"email\", z.email()],\n [\"mini string\", zm.string()],\n [\"mini object\", zm.object({ a: zm.string() })],\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":31,"symbol":"over","kind":"constant","lang":"typescript","code":"const over = cases\n .map(([name, schema]) => [name, Reflect.ownKeys(schema).length] as const)\n .filter(([, count]) => count > MAX_OWN_PROPS);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":39,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":47,"symbol":"email","kind":"constant","lang":"typescript","code":"const email = schema.email;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":52,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema: any = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":60,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":72,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":86,"symbol":"other","kind":"constant","lang":"typescript","doc":"An explicit assignment behaves like one, as before.","code":"const other: any = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":98,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":109,"symbol":"calls","kind":"constant","lang":"typescript","code":"const calls: string[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":110,"symbol":"Base","kind":"constant","lang":"typescript","code":"const Base: core.$constructor<any> = core.$constructor<any>(\"CountedBase\", () => calls.push(\"base\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":111,"symbol":"Child","kind":"constant","lang":"typescript","code":"const Child: core.$constructor<any> = core.$constructor<any>(\"CountedChild\", (inst, def) => {\n calls.push(\"child\");\n Base.init(inst, def);\n Base.init(inst, def);\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":116,"symbol":"constructed","kind":"constant","lang":"typescript","code":"const constructed = new Child({});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":118,"symbol":"direct","kind":"constant","lang":"typescript","code":"const direct = Object.create({});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":134,"symbol":"proto","kind":"constant","lang":"typescript","code":"const proto = {};"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":135,"symbol":"inst","kind":"constant","lang":"typescript","code":"const inst = Object.create(proto) as z.ZodString;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":145,"symbol":"seen","kind":"constant","lang":"typescript","doc":"the install used to read a module-level flag the outer construction set, so a nested `init` on an unrelated receiver inherited an answer that was not about it","code":"const seen: string[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":148,"symbol":"Nested","kind":"constant","lang":"typescript","doc":"an assertion signature needs the call target explicitly annotated","code":"const Nested: core.$constructor<any> = core.$constructor<any>(\"Nested\", () => {}, {\n tag() {\n return \"nested\";\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":149,"symbol":"tag","kind":"method","lang":"typescript","code":"tag() {\n return \"nested\";\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":153,"symbol":"Outer","kind":"constant","lang":"typescript","code":"const Outer = core.$constructor<any>(\"Outer\", (_inst, def) => {\n if (!def.nest) return;\n // not a plain `{}`: the install target would resolve to `Object.prototype` and leak `tag` into every object the worker touches\n const plain: any = Object.create({});\n Nested.init(plain, {});\n seen.push(typeof plain.tag);\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":156,"symbol":"plain","kind":"constant","lang":"typescript","doc":"not a plain `{}`: the install target would resolve to `Object.prototype` and leak `tag` into every object the worker touches","code":"const plain: any = Object.create({});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":174,"symbol":"proto","kind":"constant","lang":"typescript","doc":"An object literal's getter is enumerable; the `defineProperty` it replaced was not. `for..in` over a schema is public surface, and the construction path walks the prototype with it.","code":"const proto = Object.getPrototypeOf(z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":181,"symbol":"schema","kind":"constant","lang":"typescript","doc":"the derived metadata members live on the prototype and shadow as own data on first read","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":182,"symbol":"keys","kind":"constant","lang":"typescript","code":"const keys: string[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":190,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":200,"symbol":"MyString","kind":"constant","lang":"typescript","doc":"`super(def)` gives `this` a prototype of `new.target.prototype`, so a constructor can complete a construction without having built its own prototype.","code":"const MyString: new (def: { type: \"string\" }) => z.ZodString = class extends (z.ZodString as any) {} as any;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":203,"symbol":"plain","kind":"constant","lang":"typescript","code":"const plain = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":212,"symbol":"First","kind":"constant","lang":"typescript","code":"const First = class extends (z.ZodSymbol as any) {\n parse() {\n return \"PARSE\";\n }\n optional() {\n return \"OPTIONAL\";\n }\n } as any;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":213,"symbol":"parse","kind":"method","lang":"typescript","code":"parse() {\n return \"PARSE\";\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":216,"symbol":"optional","kind":"method","lang":"typescript","code":"optional() {\n return \"OPTIONAL\";\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":220,"symbol":"first","kind":"constant","lang":"typescript","code":"const first = new First({ type: \"symbol\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":223,"symbol":"sym","kind":"constant","lang":"typescript","code":"const sym = Symbol();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":228,"symbol":"Second","kind":"constant","lang":"typescript","code":"const Second = class extends (z.ZodNumber as any) {\n parse() {\n return \"SECOND\";\n }\n } as any;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":229,"symbol":"parse","kind":"method","lang":"typescript","code":"parse() {\n return \"SECOND\";\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":236,"symbol":"Third","kind":"constant","lang":"typescript","doc":"two levels deep: neither prototype takes a copy, so the inherited member is one function","code":"const Third = class extends (Second as any) {} as any;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":243,"symbol":"schema","kind":"constant","lang":"typescript","doc":"Every member was an accessor with a setter before they moved onto `proto`, so a getter written by hand needs one too.","code":"const schema: any = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":249,"symbol":"mini","kind":"constant","lang":"typescript","code":"const mini: any = zm.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":254,"symbol":"derived","kind":"constant","lang":"typescript","doc":"a derived metadata member accepts assignment before its first read, as it did as an own property","code":"const derived = z.number().min(2);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":265,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":283,"symbol":"mini","kind":"constant","lang":"typescript","code":"const mini = zm.object({ a: zm.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":290,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema: any = z.object({ a: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":304,"symbol":"Self","kind":"constant","lang":"typescript","code":"const Self: any = z.object({\n a: z.string(),\n get b() {\n return z.array(z.object(Self.shape));\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":306,"symbol":"b","kind":"method","lang":"typescript","code":"get b() {\n return z.array(z.object(Self.shape));\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":312,"symbol":"Mini","kind":"constant","lang":"typescript","code":"const Mini: any = zm.object({\n a: zm.string(),\n get b() {\n return zm.array(zm.object(Mini.shape));\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instance-footprint.test.ts","line":314,"symbol":"b","kind":"method","lang":"typescript","code":"get b() {\n return zm.array(zm.object(Mini.shape));\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":5,"symbol":"Test","kind":"class","lang":"typescript","code":"class Test {}"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":6,"symbol":"Subtest","kind":"class","lang":"typescript","code":"class Subtest extends Test {}"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":8,"symbol":"constructor","kind":"method","lang":"typescript","code":"constructor(public val: string) {}"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":10,"symbol":"Bar","kind":"class","lang":"typescript","code":"class Bar extends AbstractBar {}"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":12,"symbol":"TestSchema","kind":"constant","lang":"typescript","code":"const TestSchema = z.instanceof(Test);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":13,"symbol":"SubtestSchema","kind":"constant","lang":"typescript","code":"const SubtestSchema = z.instanceof(Subtest);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":14,"symbol":"AbstractSchema","kind":"constant","lang":"typescript","code":"const AbstractSchema = z.instanceof(AbstractBar);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":15,"symbol":"BarSchema","kind":"constant","lang":"typescript","code":"const BarSchema = z.instanceof(Bar);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":21,"symbol":"bar","kind":"constant","lang":"typescript","code":"const bar = BarSchema.parse(new Bar(\"asdf\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":31,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.instanceof(Date).refine((d) => d.toString());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":32,"symbol":"res","kind":"constant","lang":"typescript","code":"const res = schema.safeParse(null);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":37,"symbol":"Test","kind":"class","lang":"typescript","code":"class Test {\n name!: string;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":47,"symbol":"TestSchema","kind":"constant","lang":"typescript","code":"const TestSchema = z.instanceof(Test);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":48,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = TestSchema.safeParse(\"whatever\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":51,"symbol":"issue","kind":"constant","lang":"typescript","code":"const issue = result.error.issues[0];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":63,"symbol":"httpsUrl","kind":"constant","lang":"typescript","code":"const httpsUrl = z.instanceof(URL).check(\n ...z.properties({\n protocol: z.literal(\"https:\"),\n hostname: z.string().regex(z.regexes.domain),\n })\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":74,"symbol":"both","kind":"constant","lang":"typescript","doc":"One check iterates the whole shape, so every failing property reports — unlike the equivalent chain of z.property() calls, which aborts on the first.","code":"const both = httpsUrl.safeParse(new URL(\"http://localhost\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":79,"symbol":"issues","kind":"constant","lang":"typescript","code":"const issues = httpsUrl.safeParse(input).error!.issues;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":84,"symbol":"obj","kind":"constant","lang":"typescript","doc":"Not specific to z.instanceof(). A base whose type mismatch aborts implicitly rather than explicitly must still not run the property checks against the rejected value.","code":"const obj = z\n .object({ a: z.string(), b: z.string() })\n .check(...z.properties({ a: z.literal(\"x\"), b: z.literal(\"y\") }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":112,"symbol":"stringToLength","kind":"constant","lang":"typescript","doc":"the check feeds the property value into its schema, so it is typed over the input side rather than the output","code":"const stringToLength = z.property(\n \"a\",\n z.string().transform((s) => s.length)\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/instanceof.test.ts","line":121,"symbol":"compiled","kind":"constant","lang":"typescript","doc":"The properties check carries no `when`, so the schema stays on the compiled fast path.","code":"const compiled = z.compile(httpsUrl);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":7,"symbol":"A","kind":"constant","lang":"typescript","code":"const A = z.object({ a: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":8,"symbol":"B","kind":"constant","lang":"typescript","code":"const B = z.object({ b: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":10,"symbol":"C","kind":"constant","lang":"typescript","code":"const C = z.intersection(A, B);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":11,"symbol":"C","kind":"type","lang":"typescript","code":"type C = z.infer<typeof C>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":13,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = { a: \"foo\", b: \"foo\" };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":19,"symbol":"A","kind":"constant","lang":"typescript","code":"const A = z.looseObject({ a: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":20,"symbol":"B","kind":"constant","lang":"typescript","code":"const B = z.object({ b: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":22,"symbol":"C","kind":"constant","lang":"typescript","code":"const C = z.intersection(A, B);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":23,"symbol":"C","kind":"type","lang":"typescript","code":"type C = z.infer<typeof C>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":25,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = { a: \"foo\", b: \"foo\", c: \"extra\" };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":31,"symbol":"A","kind":"constant","lang":"typescript","code":"const A = z.strictObject({ a: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":32,"symbol":"B","kind":"constant","lang":"typescript","code":"const B = z.object({ b: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":34,"symbol":"C","kind":"constant","lang":"typescript","code":"const C = z.intersection(A, B);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":35,"symbol":"C","kind":"type","lang":"typescript","code":"type C = z.infer<typeof C>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":46,"symbol":"A","kind":"constant","lang":"typescript","code":"const A = z.strictObject({ a: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":47,"symbol":"B","kind":"constant","lang":"typescript","code":"const B = z.strictObject({ b: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":49,"symbol":"C","kind":"constant","lang":"typescript","code":"const C = z.intersection(A, B);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":55,"symbol":"result","kind":"constant","lang":"typescript","doc":"Keys unrecognized by BOTH sides should error","code":"const result = C.safeParse({ a: \"foo\", b: \"bar\", c: \"extra\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":71,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases = [\n [\n z.intersection(z.object({ name: z.string() }), z.unknown()),\n JSON.parse('{\"__proto__\":{\"isAdmin\":true},\"name\":\"alice\"}'),\n { name: \"alice\" },\n ],\n [z.intersection(z.record(z.string(), z.unknown()), z.any()), JSON.parse('{\"__proto__\":{},\"a\":1}'), { a: 1 }],\n ] as const;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":81,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = schema.parse(input);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":89,"symbol":"Animal","kind":"constant","lang":"typescript","code":"const Animal = z.object({\n properties: z.object({\n is_animal: z.boolean(),\n }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":94,"symbol":"Cat","kind":"constant","lang":"typescript","code":"const Cat = z.intersection(\n z.object({\n properties: z.object({\n jumped: z.boolean(),\n }),\n }),\n Animal\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":103,"symbol":"Cat","kind":"type","lang":"typescript","code":"type Cat = util.Flatten<z.infer<typeof Cat>>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":105,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = Cat.safeParse({ properties: { is_animal: true, jumped: true } });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":110,"symbol":"Author","kind":"constant","lang":"typescript","code":"const Author = z.object({\n posts: z.array(\n z.object({\n post_id: z.number(),\n })\n ),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":117,"symbol":"Registry","kind":"constant","lang":"typescript","code":"const Registry = z.intersection(\n Author,\n z.object({\n posts: z.array(\n z.object({\n title: z.string(),\n })\n ),\n })\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":128,"symbol":"posts","kind":"constant","lang":"typescript","code":"const posts = [\n { post_id: 1, title: \"Novels\" },\n { post_id: 2, title: \"Fairy tales\" },\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":132,"symbol":"cat","kind":"constant","lang":"typescript","code":"const cat = Registry.parse({ posts });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":134,"symbol":"asyncCat","kind":"constant","lang":"typescript","code":"const asyncCat = await Registry.parseAsync({ posts });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":139,"symbol":"numberIntersection","kind":"constant","lang":"typescript","code":"const numberIntersection = z.intersection(\n z.number(),\n z.number().transform((x) => x + 1)\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":150,"symbol":"stringArrInt","kind":"constant","lang":"typescript","code":"const stringArrInt = z.intersection(\n z.string().array(),\n z\n .string()\n .array()\n .transform((val) => [...val, \"asdf\"])\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":164,"symbol":"stringArrInt","kind":"constant","lang":"typescript","code":"const stringArrInt = z.intersection(\n z.string().array(),\n z\n .string()\n .array()\n .transform((val) => [...val.slice(0, -1), \"asdf\"])\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":178,"symbol":"Cat","kind":"constant","lang":"typescript","code":"const Cat = z.object({\n phrase: z.string().transform((val) => `${val} Meow`),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":181,"symbol":"Dog","kind":"constant","lang":"typescript","code":"const Dog = z.object({\n phrase: z.string().transform((val) => `${val} Woof`),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":184,"symbol":"CatDog","kind":"constant","lang":"typescript","code":"const CatDog = z.intersection(Cat, Dog);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":192,"symbol":"University","kind":"constant","lang":"typescript","code":"const University = z.object({\n students: z.array(\n z.object({\n name: z.string().transform((val) => `Student name: ${val}`),\n })\n ),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":199,"symbol":"Registry","kind":"constant","lang":"typescript","code":"const Registry = z.intersection(\n University,\n z.object({\n students: z.array(\n z.object({\n name: z.string(),\n surname: z.string(),\n })\n ),\n })\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":211,"symbol":"students","kind":"constant","lang":"typescript","code":"const students = [{ name: \"John\", surname: \"Doe\" }];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":224,"symbol":"Obj","kind":"constant","lang":"typescript","code":"const Obj = z.object({ name: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":225,"symbol":"value","kind":"constant","lang":"typescript","code":"const value = { name: \"a\", S_a: \"s\" };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":240,"symbol":"governed","kind":"constant","lang":"typescript","doc":"A key the record DOES govern still has its value validated across the intersection.","code":"const governed = z.intersection(z.object({ S_x: z.number() }), z.record(z.string().regex(/^S_/), z.string()));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":244,"symbol":"strict","kind":"constant","lang":"typescript","doc":"A key NEITHER side governs is still rejected.","code":"const strict = z.intersection(z.strictObject({ name: z.string() }), z.record(z.string().regex(/^S_/), z.string()));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":253,"symbol":"enumKeys","kind":"constant","lang":"typescript","code":"const enumKeys = z.partialRecord(z.enum([\"a\", \"b\"]), z.string()).safeParse({ a: \"x\", zzz: \"q\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":258,"symbol":"regexKeys","kind":"constant","lang":"typescript","doc":"A regex key schema still reports the failure as an invalid key.","code":"const regexKeys = z.record(z.string().regex(/^S_/), z.string()).safeParse({ S_a: \"x\", zzz: \"q\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":265,"symbol":"failing","kind":"constant","lang":"typescript","code":"const failing = z.intersection(\n z.strictObject({ x: z.string() }).check(() => {\n checks++;\n }),\n z.strictObject({ a: z.string() }).superRefine((_data, ctx) => {\n checks++;\n ctx.addIssue({ code: \"custom\", message: \"boom\" });\n })\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":280,"symbol":"transformed","kind":"constant","lang":"typescript","code":"const transformed = z.intersection(\n z.strictObject({ x: z.string() }).transform((v) => ({ ...v, x: v.x.toUpperCase() })),\n z.strictObject({ a: z.string() }).transform((v) => ({ ...v, seen: true }))\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":288,"symbol":"inner","kind":"constant","lang":"typescript","code":"const inner = z.intersection(\n z.strictObject({ x: z.string().default(\"X default\"), y: z.number() }),\n z.strictObject({ z: z.boolean() })\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":292,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.intersection(inner, z.strictObject({ a: z.string() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":300,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .record(z.enum([\"p1\", \"p2\"]), z.string())\n .superRefine((_data, ctx) => {\n calls++;\n ctx.addIssue({ code: \"custom\", message: \"record refined\" });\n })\n .and(z.strictObject({ name: z.string() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":316,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.intersection(\n z.object({ inner: z.strictObject({ a: z.string() }) }),\n z.object({ other: z.string() })\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":329,"symbol":"A","kind":"constant","lang":"typescript","code":"const A = z.object({ key1: z.boolean() }).strict();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/intersection.test.ts","line":330,"symbol":"B","kind":"constant","lang":"typescript","code":"const B = z.object({ key2: z.boolean() }).refine(({ key2 }) => key2, \"key2 must be true\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/issue-schema.test.ts","line":9,"symbol":"fail","kind":"constant","lang":"typescript","doc":"Error maps run on the first read of `error`, so a test that only observes them reads it.","code":"const fail = (r: { error?: unknown }) => r.error;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/issue-schema.test.ts","line":12,"symbol":"captureMeta","kind":"function","lang":"typescript","doc":"Collects the owning schema's registered metadata for every issue an error map sees.","code":"function captureMeta(): { seen: (z.core.GlobalMeta | undefined)[] } {\n const seen: (z.core.GlobalMeta | undefined)[] = [];\n z.config({\n customError: (issue) => {\n seen.push(issue.schema && z.globalRegistry.get(issue.schema));\n return undefined;\n },\n });\n return { seen };\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/issue-schema.test.ts","line":13,"symbol":"seen","kind":"constant","lang":"typescript","code":"const seen: (z.core.GlobalMeta | undefined)[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/issue-schema.test.ts","line":111,"symbol":"shorthand","kind":"constant","lang":"typescript","code":"const shorthand = z\n .string()\n .superRefine((_, ctx) => ctx.addIssue(\"bad stuff\"))\n .meta({ title: \"Shorthand\" })\n .safeParse(\"abc\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/issue-schema.test.ts","line":136,"symbol":"bare","kind":"constant","lang":"typescript","code":"const bare = z.string().min(5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/issue-schema.test.ts","line":137,"symbol":"labeled","kind":"constant","lang":"typescript","code":"const labeled = bare.meta({ title: \"Labeled\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/issue-schema.test.ts","line":138,"symbol":"seen","kind":"constant","lang":"typescript","code":"const seen: unknown[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/issue-schema.test.ts","line":152,"symbol":"insts","kind":"constant","lang":"typescript","code":"const insts: string[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/issue-schema.test.ts","line":160,"symbol":"tooSmall","kind":"constant","lang":"typescript","code":"const tooSmall = z.string().min(5).safeParse(\"ab\").error!;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/issue-schema.test.ts","line":161,"symbol":"wrongType","kind":"constant","lang":"typescript","code":"const wrongType = z.string().safeParse(123).error!;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/issue-schema.test.ts","line":169,"symbol":"seen","kind":"constant","lang":"typescript","code":"const seen: Record<string, z.core.GlobalMeta | undefined> = {};"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/issue-schema.test.ts","line":170,"symbol":"capture","kind":"constant","lang":"typescript","code":"const capture = (key: string) => (issue: { schema?: z.core.$ZodType | undefined }) => {\n seen[key] = issue.schema && z.globalRegistry.get(issue.schema);\n return undefined;\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/issue-schema.test.ts","line":203,"symbol":"localeError","kind":"constant","lang":"typescript","doc":"localeError carries the default English locale, so it is restored rather than cleared.","code":"const localeError = z.config().localeError;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/jitless-allows-eval.test.ts","line":23,"symbol":"origFunction","kind":"constant","lang":"typescript","doc":"Spy: if the probe were still attempted, `new Function(\"\")` would be called. Swap the global `Function` constructor with a throwing stub and verify the stub is NEVER invoked.","code":"const origFunction = globalThis.Function;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":6,"symbol":"object","kind":"constant","lang":"typescript","code":"const object = z.object({\n a: z.lazy(() => z.string()),\n b: z.lazy(() => z.string().optional()),\n c: z.lazy(() => z.string().default(\"default\")),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":12,"symbol":"ObjectTypeIn","kind":"type","lang":"typescript","code":"type ObjectTypeIn = z.input<typeof object>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":19,"symbol":"ObjectTypeOut","kind":"type","lang":"typescript","code":"type ObjectTypeOut = z.output<typeof object>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":26,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = object.parse(\n {\n a: \"hello\",\n b: undefined,\n },\n { jitless: true }\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":56,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.lazy(() => z.string())._zod.innerType.min(6);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":61,"symbol":"Category","kind":"interface","lang":"typescript","code":"interface Category {\n name: string;\n subcategories: Category[];\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":66,"symbol":"testCategory","kind":"constant","lang":"typescript","code":"const testCategory: Category = {\n name: \"I\",\n subcategories: [\n {\n name: \"A\",\n subcategories: [\n {\n name: \"1\",\n subcategories: [\n {\n name: \"a\",\n subcategories: [],\n },\n ],\n },\n ],\n },\n ],\n};"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":87,"symbol":"Category","kind":"constant","lang":"typescript","code":"const Category: z.ZodType<Category> = z.lazy(() =>\n z.object({\n name: z.string(),\n subcategories: z.array(Category),\n })\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":96,"symbol":"LinkedList","kind":"type","lang":"typescript","code":"type LinkedList = null | { value: number; next: LinkedList };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":98,"symbol":"linkedListExample","kind":"constant","lang":"typescript","code":"const linkedListExample = {\n value: 1,\n next: {\n value: 2,\n next: {\n value: 3,\n next: {\n value: 4,\n next: null,\n },\n },\n },\n};"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":113,"symbol":"LinkedListSchema","kind":"constant","lang":"typescript","code":"const LinkedListSchema: z.ZodType<LinkedList> = z.lazy(() =>\n z.union([\n z.null(),\n z.object({\n value: z.number(),\n next: LinkedListSchema,\n }),\n ])\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":125,"symbol":"A","kind":"interface","lang":"typescript","code":"interface A {\n val: number;\n b: B;\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":130,"symbol":"B","kind":"interface","lang":"typescript","code":"interface B {\n val: number;\n a?: A | undefined;\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":136,"symbol":"Alazy","kind":"constant","lang":"typescript","code":"const Alazy: z.ZodType<A> = z.lazy(() =>\n z.object({\n val: z.number(),\n b: Blazy,\n })\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":143,"symbol":"Blazy","kind":"constant","lang":"typescript","code":"const Blazy: z.ZodType<B> = z.lazy(() =>\n z.object({\n val: z.number(),\n a: Alazy.optional(),\n })\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":150,"symbol":"testData","kind":"constant","lang":"typescript","code":"const testData = {\n val: 1,\n b: {\n val: 5,\n a: {\n val: 3,\n b: {\n val: 4,\n a: {\n val: 2,\n b: {\n val: 1,\n },\n },\n },\n },\n },\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":177,"symbol":"a","kind":"constant","lang":"typescript","code":"const a: any = { val: 1 };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":178,"symbol":"b","kind":"constant","lang":"typescript","code":"const b: any = { val: 2 };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":184,"symbol":"Category","kind":"constant","lang":"typescript","code":"const Category = z.object({\n name: z.string(),\n age: z.optional(z.number()),\n get nullself() {\n return Category.nullable();\n },\n get optself() {\n return Category.optional();\n },\n get self() {\n return Category;\n },\n get subcategories() {\n return z.array(Category);\n },\n nested: z.object({\n get sub() {\n return Category;\n },\n }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":187,"symbol":"nullself","kind":"method","lang":"typescript","code":"get nullself() {\n return Category.nullable();\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":190,"symbol":"optself","kind":"method","lang":"typescript","code":"get optself() {\n return Category.optional();\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":193,"symbol":"self","kind":"method","lang":"typescript","code":"get self() {\n return Category;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":196,"symbol":"subcategories","kind":"method","lang":"typescript","code":"get subcategories() {\n return z.array(Category);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":200,"symbol":"sub","kind":"method","lang":"typescript","code":"get sub() {\n return Category;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":206,"symbol":"_Category","kind":"type","lang":"typescript","code":"type _Category = z.output<typeof Category>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":210,"symbol":"a","kind":"constant","lang":"typescript","code":"const a: any = z.lazy(() => a).optional();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":211,"symbol":"b","kind":"constant","lang":"typescript","code":"const b: any = z.lazy(() => b).nullable();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":212,"symbol":"c","kind":"constant","lang":"typescript","code":"const c: any = z.lazy(() => c).default({} as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":213,"symbol":"d","kind":"constant","lang":"typescript","code":"const d: any = z.lazy(() => d).prefault({} as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":214,"symbol":"e","kind":"constant","lang":"typescript","code":"const e: any = z.lazy(() => e).nonoptional();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":215,"symbol":"f","kind":"constant","lang":"typescript","code":"const f: any = z.lazy(() => f).catch({} as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":216,"symbol":"g","kind":"constant","lang":"typescript","code":"const g: any = z.lazy(() => z.object({ g })).readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":218,"symbol":"baseCategorySchema","kind":"constant","lang":"typescript","code":"const baseCategorySchema = z.object({\n name: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":221,"symbol":"Category","kind":"type","lang":"typescript","code":"type Category = z.infer<typeof baseCategorySchema> & {\n subcategories: Category[];\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":224,"symbol":"categorySchema","kind":"constant","lang":"typescript","code":"const categorySchema: z.ZodType<Category> = baseCategorySchema.extend({\n subcategories: z.lazy(() => categorySchema.array()),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":230,"symbol":"optional","kind":"constant","lang":"typescript","code":"const optional: any = z.lazy(() => optional.optional());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":231,"symbol":"pipe","kind":"constant","lang":"typescript","code":"const pipe: any = z.lazy(() => z.pipe(z.string(), pipe));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":240,"symbol":"lazyRef","kind":"constant","lang":"typescript","code":"const lazyRef: any = z.lazy(() => Rec);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":241,"symbol":"Rec","kind":"constant","lang":"typescript","code":"const Rec: any = z.union([z.string().optional(), lazyRef]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":251,"symbol":"union","kind":"constant","lang":"typescript","doc":"`undefined` is the legitimate answer here and still has to cache: these getters are read per parse, so recomputing them is a parse-path cost.","code":"const union = z.union([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/lazy.test.ts","line":258,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\"type\", [z.string() as any]) as any;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/literal.test.ts","line":5,"symbol":"literalTuna","kind":"constant","lang":"typescript","code":"const literalTuna = z.literal(\"tuna\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/literal.test.ts","line":6,"symbol":"literalTunaCustomMessage","kind":"constant","lang":"typescript","code":"const literalTunaCustomMessage = z.literal(\"tuna\", {\n message: \"That's not a tuna\",\n});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/literal.test.ts","line":9,"symbol":"literalFortyTwo","kind":"constant","lang":"typescript","code":"const literalFortyTwo = z.literal(42);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/literal.test.ts","line":10,"symbol":"literalTrue","kind":"constant","lang":"typescript","code":"const literalTrue = z.literal(true);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/literal.test.ts","line":25,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = \"shark\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/literal.test.ts","line":26,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = literalTuna.safeParse(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/literal.test.ts","line":28,"symbol":"issue","kind":"constant","lang":"typescript","code":"const issue = result.error!.issues[0];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/literal.test.ts","line":43,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = \"shark\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/literal.test.ts","line":44,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = literalTuna.safeParse(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/literal.test.ts","line":46,"symbol":"issue","kind":"constant","lang":"typescript","code":"const issue = result.error!.issues[0];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/literal.test.ts","line":51,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = \"shark\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/literal.test.ts","line":52,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = literalTunaCustomMessage.safeParse(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/literal.test.ts","line":54,"symbol":"issue","kind":"constant","lang":"typescript","code":"const issue = result.error!.issues[0];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/literal.test.ts","line":59,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.literal(\"Tuna\").safeParse(\"Trout\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/literal.test.ts","line":77,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.literal(BigInt(12)).safeParse(BigInt(13));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/literal.test.ts","line":90,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = [\"asdf\"] as const;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/literal.test.ts","line":120,"symbol":"empty","kind":"constant","lang":"typescript","code":"const empty = z.literal([]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/locales_ka.test.ts","line":11,"symbol":"stringSchema","kind":"constant","lang":"typescript","doc":"Test 1: Invalid type (Expected string, received number)","code":"const stringSchema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/locales_ka.test.ts","line":12,"symbol":"numberResult","kind":"constant","lang":"typescript","code":"const numberResult = stringSchema.safeParse(123);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/locales_ka.test.ts","line":20,"symbol":"base64Schema","kind":"constant","lang":"typescript","doc":"Test 2: Invalid base64","code":"const base64Schema = z.string().base64();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/locales_ka.test.ts","line":21,"symbol":"base64Result","kind":"constant","lang":"typescript","code":"const base64Result = base64Schema.safeParse(\"not base64!\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/locales_ro.test.ts","line":8,"symbol":"stringSchema","kind":"constant","lang":"typescript","doc":"Test 1: Invalid type (Expected string, received number)","code":"const stringSchema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/locales_ro.test.ts","line":9,"symbol":"numberResult","kind":"constant","lang":"typescript","code":"const numberResult = stringSchema.safeParse(123);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/locales_ro.test.ts","line":17,"symbol":"base64Schema","kind":"constant","lang":"typescript","doc":"Test 2: Invalid base64","code":"const base64Schema = z.string().base64();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/locales_ro.test.ts","line":18,"symbol":"base64Result","kind":"constant","lang":"typescript","code":"const base64Result = base64Schema.safeParse(\"not base64!\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":4,"symbol":"stringMap","kind":"constant","lang":"typescript","code":"const stringMap = z.map(z.string(), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":5,"symbol":"stringMap","kind":"type","lang":"typescript","code":"type stringMap = z.infer<typeof stringMap>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":7,"symbol":"minTwo","kind":"constant","lang":"typescript","code":"const minTwo = stringMap.min(2);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":8,"symbol":"maxTwo","kind":"constant","lang":"typescript","code":"const maxTwo = stringMap.max(2);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":9,"symbol":"justTwo","kind":"constant","lang":"typescript","code":"const justTwo = stringMap.size(2);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":10,"symbol":"nonEmpty","kind":"constant","lang":"typescript","code":"const nonEmpty = stringMap.nonempty();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":11,"symbol":"nonEmptyMax","kind":"constant","lang":"typescript","code":"const nonEmptyMax = stringMap.nonempty().max(2);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":18,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringMap.safeParse(\n new Map([\n [\"first\", \"foo\"],\n [\"second\", \"bar\"],\n ])\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":70,"symbol":"sizeZeroResult","kind":"constant","lang":"typescript","code":"const sizeZeroResult = stringMap.parse(new Map());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":73,"symbol":"sizeTwoResult","kind":"constant","lang":"typescript","code":"const sizeTwoResult = minTwo.parse(\n new Map([\n [\"a\", \"b\"],\n [\"c\", \"d\"],\n ])\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":83,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = nonEmpty.safeParse(new Map());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":90,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = maxTwo.safeParse(\n new Map([\n [\"a\", \"b\"],\n [\"c\", \"d\"],\n [\"e\", \"f\"],\n ])\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":106,"symbol":"tooBig","kind":"constant","lang":"typescript","code":"const tooBig = new Map([\n [\"a\", \"b\"],\n [\"c\", \"d\"],\n [\"e\", \"f\"],\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":115,"symbol":"asyncMap","kind":"constant","lang":"typescript","code":"const asyncMap = z.map(\n z.string().refine(async () => false, \"bad key\"),\n z.string().refine(async () => false, \"bad value\")\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":119,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await asyncMap.safeParseAsync(new Map([[\"first\", \"foo\"]]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":142,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringMap.safeParse(new Set([]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":151,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringMap.safeParse(new Map([[42, Symbol()]]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":181,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringMap.safeParse(\n new Map([\n [1, \"foo\"],\n [\"bar\", 2],\n ] as [any, any][]) as Map<any, any>\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":216,"symbol":"map","kind":"constant","lang":"typescript","code":"const map = z.map(\n z.string().refine((val) => val === val.toUpperCase(), {\n message: \"Keys must be uppercase\",\n }),\n z.string()\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":222,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await map.spa(\n new Map([\n [\"first\", \"foo\"],\n [\"second\", \"bar\"],\n ])\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":253,"symbol":"map","kind":"constant","lang":"typescript","code":"const map = z.map(\n z.object({\n name: z.string(),\n age: z.number(),\n }),\n z.string()\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":260,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = new Map([\n [{ name: \"John\", age: 30 }, \"foo\"],\n [{ name: \"Jane\", age: 25 }, \"bar\"],\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":264,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = map.safeParse(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":268,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = new Map([[\"bad\", \"foo\"]]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":269,"symbol":"badResult","kind":"constant","lang":"typescript","code":"const badResult = map.safeParse(badData);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":286,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = stringMap.min(4).max(5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":288,"symbol":"r1","kind":"constant","lang":"typescript","code":"const r1 = schema.safeParse(\n new Map([\n [\"a\", \"a\"],\n [\"b\", \"b\"],\n [\"c\", \"c\"],\n [\"d\", \"d\"],\n ])\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":298,"symbol":"r2","kind":"constant","lang":"typescript","code":"const r2 = schema.safeParse(\n new Map([\n [\"a\", \"a\"],\n [\"b\", \"b\"],\n [\"c\", \"c\"],\n ])\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/map.test.ts","line":319,"symbol":"r3","kind":"constant","lang":"typescript","code":"const r3 = schema.safeParse(\n new Map([\n [\"a\", \"a\"],\n [\"b\", \"b\"],\n [\"c\", \"c\"],\n [\"d\", \"d\"],\n [\"e\", \"e\"],\n [\"f\", \"f\"],\n ])\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/nan.test.ts","line":5,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.nan();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/nested-refine.test.ts","line":5,"symbol":"zodSchema","kind":"constant","lang":"typescript","code":"const zodSchema = z\n .object({\n password: z.string().min(1),\n nested: z\n .object({\n confirm: z\n .string()\n .min(1)\n .refine((value) => value.length > 2, {\n message: \"Confirm length should be > 2\",\n }),\n })\n .refine(\n (data) => {\n return data.confirm === \"bar\";\n },\n {\n path: [\"confirm\"],\n error: 'Value must be \"bar\"',\n }\n ),\n })\n .refine(\n (data) => {\n return data.nested.confirm === data.password;\n },\n {\n path: [\"nested\", \"confirm\"],\n error: \"Password and confirm must match\",\n }\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/nested-refine.test.ts","line":37,"symbol":"DATA","kind":"constant","lang":"typescript","code":"const DATA = {\n password: \"bar\",\n nested: { confirm: \"\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/nonoptional.test.ts","line":5,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().nonoptional();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/nonoptional.test.ts","line":9,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/nonoptional.test.ts","line":27,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().optional().nonoptional();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/nonoptional.test.ts","line":31,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/nonoptional.test.ts","line":49,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ hi: z.string().optional().nonoptional() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/nonoptional.test.ts","line":53,"symbol":"r1","kind":"constant","lang":"typescript","code":"const r1 = schema.safeParse({ hi: \"asdf\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/nonoptional.test.ts","line":56,"symbol":"r2","kind":"constant","lang":"typescript","code":"const r2 = schema.safeParse({ hi: undefined });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/nonoptional.test.ts","line":72,"symbol":"r3","kind":"constant","lang":"typescript","code":"const r3 = schema.safeParse({});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/nonoptional.test.ts","line":89,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().optional().nonoptional();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/nullable.test.ts","line":6,"symbol":"nullable","kind":"constant","lang":"typescript","code":"const nullable = z.string().nullable();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/nullable.test.ts","line":13,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().nullable();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/nullable.test.ts","line":19,"symbol":"n","kind":"constant","lang":"typescript","code":"const n = z.null();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":6,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number({ checks: [z.gte(1), z.lte(3)] as const });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":7,"symbol":"chained","kind":"constant","lang":"typescript","code":"const chained = z.number().min(1).max(3);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":17,"symbol":"overwritten","kind":"constant","lang":"typescript","code":"const overwritten = z.number({ checks: [z.overwrite<number>((value) => value + 1), z.gte(2)] });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":26,"symbol":"checks","kind":"constant","lang":"typescript","code":"const checks = [z.gte(1)];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":27,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = factory({ checks });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":30,"symbol":"checks","kind":"method","lang":"typescript","code":"get checks() {\n if (++reads > 1) throw new Error(\"checks read twice\");\n return checks;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":36,"symbol":"before","kind":"constant","lang":"typescript","code":"const before = z.toJSONSchema(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":45,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":50,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":55,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":87,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().gt(0).gt(5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":93,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().gt(0).gte(1).gte(5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":99,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().min(0).min(5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":105,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().lte(10).lt(5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":111,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().lte(10).lte(5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":117,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().max(10).max(5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":123,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().int();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":129,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().positive();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":136,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().negative();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":143,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().nonpositive();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":150,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().nonnegative();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":157,"symbol":"numbers","kind":"constant","lang":"typescript","code":"const numbers = {\n number3: 5.123,\n number6: 5.123456,\n number7: 5.1234567,\n number8: 5.12345678,\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":164,"symbol":"schemas","kind":"constant","lang":"typescript","code":"const schemas = {\n schema6: z.number().multipleOf(0.000001),\n schema7: z.number().multipleOf(0.0000001),\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":181,"symbol":"schema","kind":"constant","lang":"typescript","doc":"2.03 === 29 * 0.07, but the quotient lands 2 ULP below 29, so the old tolerance rejected it while the neighbouring multiples 1.96 and 2.10 passed.","code":"const schema = z.number().multipleOf(0.07);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":190,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().multipleOf(5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":198,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().multipleOf(-5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":207,"symbol":"schema","kind":"constant","lang":"typescript","doc":"Regression test for https://github.com/colinhacks/zod/pull/5687 — the regex was using \\d? which only matches single-digit exponents","code":"const schema = z.number().multipleOf(1e-10);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":215,"symbol":"schema15","kind":"constant","lang":"typescript","doc":"Test with 1e-15 (exponent = 15, two digits)","code":"const schema15 = z.number().multipleOf(1e-15);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":221,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().multipleOf(1e-7);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":235,"symbol":"schemaPointOne","kind":"constant","lang":"typescript","code":"const schemaPointOne = z.number().step(0.1);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":236,"symbol":"schemaPointZeroZeroZeroOne","kind":"constant","lang":"typescript","code":"const schemaPointZeroZeroZeroOne = z.number().step(0.0001);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":237,"symbol":"schemaSixPointFour","kind":"constant","lang":"typescript","code":"const schemaSixPointFour = z.number().step(6.4);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":249,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().finite();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":282,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().safe();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":340,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.int32().min(5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":346,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":347,"symbol":"negativeZero","kind":"constant","lang":"typescript","code":"const negativeZero = -0;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":348,"symbol":"positiveZero","kind":"constant","lang":"typescript","code":"const positiveZero = 0;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":358,"symbol":"positiveSchema","kind":"constant","lang":"typescript","doc":"With positive() constraint, both should be invalid (0 is not positive)","code":"const positiveSchema = z.number().positive();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":363,"symbol":"nonnegativeSchema","kind":"constant","lang":"typescript","doc":"With nonnegative(), both should be valid (0 is non-negative)","code":"const nonnegativeSchema = z.number().nonnegative();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/number.test.ts","line":391,"symbol":"Sql","kind":"type","lang":"typescript","doc":"the point of the distinction: dispatching on the schema type in a conditional type","code":"type Sql<T> = T extends z.ZodUInt32\n ? \"BIGINT\"\n : T extends z.ZodInt32\n ? \"INTEGER\"\n : T extends z.ZodFloat32\n ? \"REAL\"\n : never;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":5,"symbol":"Test","kind":"constant","lang":"typescript","code":"const Test = z.object({\n f1: z.number(),\n f2: z.string().optional(),\n f3: z.string().nullable(),\n f4: z.array(z.object({ t: z.union([z.string(), z.boolean()]) })),\n});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":13,"symbol":"TestType","kind":"type","lang":"typescript","code":"type TestType = {\n f1: number;\n f2?: string | undefined;\n f3: string | null;\n f4: { t: string | boolean }[];\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":24,"symbol":"asdf","kind":"constant","lang":"typescript","code":"const asdf: unknown = 35;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":29,"symbol":"f1Schema","kind":"constant","lang":"typescript","code":"const f1Schema = Test.shape.f1;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":30,"symbol":"f2Schema","kind":"constant","lang":"typescript","code":"const f2Schema = Test.shape.f2;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":31,"symbol":"f3Schema","kind":"constant","lang":"typescript","code":"const f3Schema = Test.shape.f3;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":32,"symbol":"f4Schema","kind":"constant","lang":"typescript","code":"const f4Schema = Test.shape.f4;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":71,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n a: z.string().optional(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":78,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":86,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = {\n points: 2314,\n unknown: \"asdf\",\n};"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":92,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = z.object({ points: z.number() }).parse(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":97,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = z.object({ points: z.number() }).strict().passthrough().strip().passthrough().parse(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":103,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = z.object({ points: z.number() }).passthrough().parse(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":109,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = z.object({ points: z.number() }).strip().parse(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":115,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = z.object({ points: z.number() }).strict().safeParse(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":121,"symbol":"o1","kind":"constant","lang":"typescript","code":"const o1 = z\n .object({\n first: z.string(),\n })\n .catchall(z.number());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":127,"symbol":"d1","kind":"constant","lang":"typescript","code":"const d1 = o1.parse({ first: \"asdf\", num: 1243 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":133,"symbol":"o1","kind":"constant","lang":"typescript","code":"const o1 = z.object({ first: z.string().optional() }).strict().catchall(z.number());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":148,"symbol":"o1","kind":"constant","lang":"typescript","code":"const o1 = z\n .object({\n first: z.string(),\n })\n .strict()\n .catchall(z.number());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":163,"symbol":"SNamedEntity","kind":"constant","lang":"typescript","code":"const SNamedEntity = z.object({\n id: z.string(),\n set: z.string().optional(),\n unset: z.string().optional(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":168,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = SNamedEntity.parse({\n id: \"asdf\",\n set: undefined,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":176,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.object({ name: z.string() }).catchall(z.number()).parse({ name: \"Foo\", validExtraKey: 61 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":180,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = z\n .object({ name: z.string() })\n .catchall(z.number())\n .safeParse({ name: \"Foo\", validExtraKey: 61, invalid: \"asdf\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":189,"symbol":"Schema","kind":"constant","lang":"typescript","code":"const Schema = z.union([z.object({ a: z.string() }), z.object({ b: z.number() })]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":190,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = { a: \"A\" };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":191,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await Schema.spa(obj);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":196,"symbol":"Schema2","kind":"constant","lang":"typescript","code":"const Schema2 = z.union([\n z.object({\n ty: z.string(),\n }),\n z.object({\n ty: z.number(),\n }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":205,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = { ty: \"A\" };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":206,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await Schema2.spa(obj);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":211,"symbol":"asdf","kind":"constant","lang":"typescript","code":"const asdf = z.object({ a: z.string() }).merge(z.object({ a: z.number() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":212,"symbol":"asdf","kind":"type","lang":"typescript","code":"type asdf = z.infer<typeof asdf>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":218,"symbol":"A","kind":"type","lang":"typescript","code":"type A = z.ZodObject<Record<string, z.ZodType<string, number>>>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":222,"symbol":"B","kind":"type","lang":"typescript","code":"type B = z.ZodObject;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":228,"symbol":"Merged","kind":"constant","lang":"typescript","code":"const Merged = z\n .object({ a: z.string(), b: z.string().optional() })\n .merge(z.object({ a: z.string().optional(), b: z.string() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":231,"symbol":"Merged","kind":"type","lang":"typescript","code":"type Merged = z.infer<typeof Merged>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":236,"symbol":"Unioned","kind":"constant","lang":"typescript","code":"const Unioned = z.union([\n z.object({ a: z.string(), b: z.string().optional() }),\n z.object({ a: z.string().optional(), b: z.string() }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":240,"symbol":"Unioned","kind":"type","lang":"typescript","code":"type Unioned = z.infer<typeof Unioned>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":247,"symbol":"Enum","kind":"constant","lang":"typescript","code":"const Enum = z.object({ a: z.string(), b: z.string().optional() }).keyof();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":258,"symbol":"Enum","kind":"type","lang":"typescript","code":"type Enum = z.infer<typeof Enum>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":263,"symbol":"User","kind":"constant","lang":"typescript","code":"const User = z.object({ name: z.string(), age: z.number() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":264,"symbol":"keysSchema","kind":"constant","lang":"typescript","code":"const keysSchema = z.keyof(User);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":273,"symbol":"Keys","kind":"type","lang":"typescript","code":"type Keys = z.infer<typeof keysSchema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":278,"symbol":"Partial","kind":"constant","lang":"typescript","code":"const Partial = z.object({ a: z.string(), b: z.string().optional() }).partial();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":279,"symbol":"Partial","kind":"type","lang":"typescript","code":"type Partial = z.infer<typeof Partial>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":284,"symbol":"Picked","kind":"constant","lang":"typescript","code":"const Picked = z.object({ a: z.string(), b: z.string().optional() }).pick({ b: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":285,"symbol":"Picked","kind":"type","lang":"typescript","code":"type Picked = z.infer<typeof Picked>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":290,"symbol":"myType","kind":"constant","lang":"typescript","code":"const myType = z.object({\n anyOptional: z.any().optional(),\n anyRequired: z.any(),\n unknownOptional: z.unknown().optional(),\n unknownRequired: z.unknown(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":296,"symbol":"myType","kind":"type","lang":"typescript","code":"type myType = z.infer<typeof myType>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":306,"symbol":"strictObj","kind":"constant","lang":"typescript","code":"const strictObj = z.strictObject({\n name: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":310,"symbol":"syncResult","kind":"constant","lang":"typescript","code":"const syncResult = strictObj.safeParse({ name: \"asdf\", unexpected: 13 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":313,"symbol":"asyncResult","kind":"constant","lang":"typescript","code":"const asyncResult = await strictObj.spa({ name: \"asdf\", unexpected: 13 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":318,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n a: z.string().default(\"foo\"),\n b: z.number(),\n })\n .refine(() => true);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":325,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await schema.parseAsync({ b: 5 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":330,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n a: z.date(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":336,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await schema.parseAsync({ a: new Date(1637353595983) });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":341,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n a: z.date(),\n })\n .refine(() => true);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":349,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await schema.parseAsync({ a: new Date(1637353595983) });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":354,"symbol":"person","kind":"constant","lang":"typescript","code":"const person = z\n .object({\n name: z.string(),\n })\n .strict();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":369,"symbol":"Example","kind":"constant","lang":"typescript","code":"const Example = z.object({\n prop: z.string(),\n opt: z.number().optional(),\n arr: z.string().array(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/object.test.ts","line":375,"symbol":"Example","kind":"type","lang":"typescript","code":"type Example = z.infer<typeof Example>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optin-ladder.test.ts","line":9,"symbol":"objDefault","kind":"constant","lang":"typescript","code":"const objDefault = z.object({ a: z.string().default(\"D\"), b: z.number() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optin-ladder.test.ts","line":13,"symbol":"objPrefault","kind":"constant","lang":"typescript","code":"const objPrefault = z.object({ a: z.string().prefault(\"P\"), b: z.number() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optin-ladder.test.ts","line":17,"symbol":"objOptional","kind":"constant","lang":"typescript","code":"const objOptional = z.object({ a: z.string().optional() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optin-ladder.test.ts","line":20,"symbol":"objTransform","kind":"constant","lang":"typescript","code":"const objTransform = z.object({\n a: z\n .string()\n .default(\"\")\n .transform((v) => v.length),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optin-ladder.test.ts","line":29,"symbol":"standalone","kind":"constant","lang":"typescript","code":"const standalone = z.string().default(\"D\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optin-ladder.test.ts","line":34,"symbol":"tup","kind":"constant","lang":"typescript","doc":"a trailing defaulted tuple slot stays optional in the input tuple","code":"const tup = z.tuple([z.string(), z.number().default(1)]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optin-ladder.test.ts","line":37,"symbol":"partialed","kind":"constant","lang":"typescript","code":"const partialed = objDefault.partial();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optin-ladder.test.ts","line":45,"symbol":"arr","kind":"constant","lang":"typescript","code":"const arr = z\n .string()\n .default(\"\")\n .transform((v) => (v ? v.split(\",\") : []));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optin-ladder.test.ts","line":79,"symbol":"opts","kind":"constant","lang":"typescript","code":"const opts = { jitless };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optin-ladder.test.ts","line":101,"symbol":"objects","kind":"constant","lang":"typescript","code":"const objects = [\n [z.object({ a: z.coerce.string().exactOptional() }), {}],\n [z.object({ a: z.string().catch(\"C\").exactOptional() }), {}],\n [z.object({ a: z.string().default(\"D\").exactOptional() }), { a: \"D\" }],\n [z.object({ a: z.string().catch(\"C\") }), { a: \"C\" }],\n ] as const;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optin-ladder.test.ts","line":113,"symbol":"tuples","kind":"constant","lang":"typescript","code":"const tuples = [\n [z.tuple([z.string(), z.coerce.string().exactOptional()]), [\"x\"]],\n [z.tuple([z.string(), z.string().default(\"D\").exactOptional()]), [\"x\", \"D\"]],\n ] as const;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optin-ladder.test.ts","line":189,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z\n .string()\n .default(\"\")\n .transform(async (v) => (v ? v.split(\",\") : []));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":7,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().optional();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":16,"symbol":"unwrapped","kind":"constant","lang":"typescript","code":"const unwrapped = z.string().optional().unwrap();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":21,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":25,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.string().optional();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":29,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.string().default(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":33,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = z.string().optional().nullable();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":37,"symbol":"e","kind":"constant","lang":"typescript","code":"const e = z.string().default(\"asdf\").nullable();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":42,"symbol":"f","kind":"constant","lang":"typescript","doc":"z.undefined should NOT be optional","code":"const f = z.undefined();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":49,"symbol":"g","kind":"constant","lang":"typescript","doc":"z.union should be optional if any of the types are optional","code":"const g = z.union([z.string(), z.undefined()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":55,"symbol":"h","kind":"constant","lang":"typescript","code":"const h = z.union([z.string(), z.optional(z.string())]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":64,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string().optional().pipe(z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":70,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z\n .string()\n .transform((val) => (Math.random() ? val : undefined))\n .pipe(z.string().optional());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":79,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.string().default(\"asdf\").pipe(z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":83,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = z\n .string()\n .transform((val) => (Math.random() ? val : undefined))\n .pipe(z.string().default(\"asdf\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":92,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n a: z.string().optional(),\n b: z.string().optional().pipe(z.string()),\n c: z.string().default(\"asdf\").pipe(z.string()),\n d: z\n .string()\n .transform((val) => (Math.random() ? val : undefined))\n .pipe(z.string().optional()),\n e: z\n .string()\n .transform((val) => (Math.random() ? val : undefined))\n .pipe(z.string().default(\"asdf\")),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":106,"symbol":"SchemaIn","kind":"type","lang":"typescript","code":"type SchemaIn = z.input<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":115,"symbol":"SchemaOut","kind":"type","lang":"typescript","code":"type SchemaOut = z.output<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":126,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n id: z\n .union([z.number(), z.string().nullish()])\n .transform((val) => (val === null || val === undefined ? val : Number(val)))\n .pipe(z.number())\n .optional(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":139,"symbol":"valueUndefined","kind":"constant","lang":"typescript","code":"const valueUndefined = z.object({\n value: z.undefined(),\n union: z.union([z.string(), z.undefined()]),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":170,"symbol":"optionalOutOnly","kind":"constant","lang":"typescript","code":"const optionalOutOnly = z.object({\n value: z\n .string()\n .transform((val) => (Math.random() ? val : undefined))\n .pipe(z.string().optional()),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":179,"symbol":"defaulted","kind":"constant","lang":"typescript","code":"const defaulted = z.object({ value: z.string().default(\"fallback\") });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":186,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().exactOptional();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":197,"symbol":"unwrapped","kind":"constant","lang":"typescript","code":"const unwrapped = z.string().exactOptional().unwrap();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":202,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string().exactOptional();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":210,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n a: z.string().exactOptional(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":224,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n a: z.string().exactOptional(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":234,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n a: z.string().exactOptional(),\n b: z.string().optional(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":239,"symbol":"SchemaIn","kind":"type","lang":"typescript","code":"type SchemaIn = z.input<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":245,"symbol":"SchemaOut","kind":"type","lang":"typescript","code":"type SchemaOut = z.output<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":253,"symbol":"optionalSchema","kind":"constant","lang":"typescript","code":"const optionalSchema = z.object({ a: z.string().optional() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":254,"symbol":"exactOptionalSchema","kind":"constant","lang":"typescript","code":"const exactOptionalSchema = z.object({ a: z.string().exactOptional() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":273,"symbol":"direct","kind":"constant","lang":"typescript","code":"const direct = z.object({ k: z.string().optional() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":276,"symbol":"exact","kind":"constant","lang":"typescript","code":"const exact = z.object({ k: z.string().exactOptional() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":280,"symbol":"nullableOpt","kind":"constant","lang":"typescript","doc":"nullable() preserves the inner type's optout","code":"const nullableOpt = z.object({ k: z.string().optional().nullable() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":284,"symbol":"optNullable","kind":"constant","lang":"typescript","doc":"optional() wrapping nullable() — still optional out","code":"const optNullable = z.object({ k: z.string().nullable().optional() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":288,"symbol":"unionWithOpt","kind":"constant","lang":"typescript","doc":"union containing an optional member must mark the key as optional","code":"const unionWithOpt = z.object({ k: z.union([z.string(), z.string().optional()]) });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":292,"symbol":"pipedToOpt","kind":"constant","lang":"typescript","doc":"pipe ending in optional()","code":"const pipedToOpt = z.object({\n k: z\n .string()\n .transform((v) => (Math.random() ? v : undefined))\n .pipe(z.string().optional()),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":301,"symbol":"mixed","kind":"constant","lang":"typescript","doc":"mixed shape pinning required vs optional keys end-to-end","code":"const mixed = z.object({\n req: z.string(),\n opt: z.string().optional(),\n exact: z.string().exactOptional(),\n def: z.string().default(\"x\"),\n nullableOpt: z.string().optional().nullable(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":319,"symbol":"trailingOptional","kind":"constant","lang":"typescript","code":"const trailingOptional = z.tuple([z.string(), z.number().optional()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":322,"symbol":"trailingExact","kind":"constant","lang":"typescript","code":"const trailingExact = z.tuple([z.string(), z.number().exactOptional()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":326,"symbol":"interiorOptional","kind":"constant","lang":"typescript","doc":"Interior optional must NOT make the tail optional","code":"const interiorOptional = z.tuple([z.string(), z.number().optional(), z.string()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":332,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n a: z\n .string()\n .optional()\n .superRefine((_v, ctx) => {\n ctx.addIssue({ code: \"custom\", message: \"bad\" });\n ctx.value = \"leaked\";\n }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/optional.test.ts","line":358,"symbol":"result","kind":"constant","lang":"typescript","doc":"A pipe hands its `out` schema the caller's issues array so an unrecognized key can survive to an enclosing intersection. A defaulted inner substituting for absence must not read that as its own failing and drop it.","code":"const result = z\n .strictObject({ a: z.string() })\n .transform((): number | undefined => undefined)\n .pipe(z.number().default(5).optional())\n .safeParse({ a: \"x\", extra: 1 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":4,"symbol":"nested","kind":"constant","lang":"typescript","code":"const nested = z.object({\n name: z.string(),\n age: z.number(),\n outer: z.object({\n inner: z.string(),\n }),\n array: z.array(z.object({ asdf: z.string() })),\n});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":14,"symbol":"shallow","kind":"constant","lang":"typescript","code":"const shallow = nested.partial();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":15,"symbol":"shallow","kind":"type","lang":"typescript","code":"type shallow = z.infer<typeof shallow>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":26,"symbol":"shallow","kind":"constant","lang":"typescript","code":"const shallow = nested.partial();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":35,"symbol":"object","kind":"constant","lang":"typescript","code":"const object = z.object({\n name: z.string(),\n age: z.number().optional(),\n field: z.string().optional().default(\"asdf\"),\n nullableField: z.number().nullable(),\n nullishField: z.string().nullish(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":43,"symbol":"requiredObject","kind":"constant","lang":"typescript","code":"const requiredObject = object.required();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":58,"symbol":"object","kind":"constant","lang":"typescript","code":"const object = z.object({\n name: z.string(),\n age: z.number().optional(),\n field: z.string().optional().default(\"asdf\"),\n nullableField: z.number().nullable(),\n nullishField: z.string().nullish(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":66,"symbol":"requiredObject","kind":"constant","lang":"typescript","code":"const requiredObject = object.required();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":68,"symbol":"required","kind":"type","lang":"typescript","code":"type required = z.infer<typeof requiredObject>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":69,"symbol":"expected","kind":"type","lang":"typescript","code":"type expected = {\n name: string;\n age: number;\n field: string;\n nullableField: number | null;\n nullishField: string | null;\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":80,"symbol":"object","kind":"constant","lang":"typescript","code":"const object = z.object({\n name: z.string(),\n age: z.number().optional(),\n field: z.string().optional().default(\"asdf\"),\n country: z.string().optional(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":87,"symbol":"requiredObject","kind":"constant","lang":"typescript","code":"const requiredObject = object.required({ age: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":95,"symbol":"object","kind":"constant","lang":"typescript","code":"const object = z.object({\n name: z.string(),\n age: z.number().optional(),\n field: z.string().optional().default(\"asdf\"),\n country: z.string().optional(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":103,"symbol":"requiredObject","kind":"constant","lang":"typescript","doc":"@ts-expect-error","code":"const requiredObject = object.required({ age: true, country: false });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":111,"symbol":"object","kind":"constant","lang":"typescript","code":"const object = z.object({\n name: z.string(),\n age: z.number().optional(),\n field: z.string().optional().default(\"asdf\"),\n country: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":118,"symbol":"masked","kind":"constant","lang":"typescript","code":"const masked = object.partial({ age: true, field: true, name: true }).strict();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":130,"symbol":"object","kind":"constant","lang":"typescript","code":"const object = z.object({\n name: z.string(),\n age: z.number().optional(),\n field: z.string().optional().default(\"asdf\"),\n country: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":138,"symbol":"masked","kind":"constant","lang":"typescript","doc":"@ts-expect-error","code":"const masked = object.partial({ name: true, country: false }).strict();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":150,"symbol":"mySchema","kind":"constant","lang":"typescript","code":"const mySchema = z.object({\n a: z.string().catch(\"catch value\").optional(),\n b: z.string().default(\"default value\").optional(),\n c: z.string().prefault(\"prefault value\").optional(),\n d: z.string().catch(\"catch value\"),\n e: z.string().default(\"default value\"),\n f: z.string().prefault(\"prefault value\"),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":201,"symbol":"mySchema","kind":"constant","lang":"typescript","code":"const mySchema = z.object({\n // Branch: input[key] === undefined, key not in input, caught error\n caughtMissing: z.string().catch(\"caught\").optional(),\n // Branch: input[key] === undefined, key in input, caught error\n caughtUndefined: z.string().catch(\"caught\").optional(),\n // Branch: input[key] === undefined, key not in input, validation issues\n issueMissing: z.string().min(5).optional(),\n // Branch: input[key] === undefined, key in input, validation issues\n issueUndefined: z.string().min(5).optional(),\n // Branch: input[key] === undefined, validation returns undefined\n validUndefined: z.string().optional(),\n // Branch: input[key] === undefined, non-undefined result (default/transform)\n defaultValue: z.string().default(\"default\").optional(),\n // Branch: input[key] defined, caught error\n caughtDefined: z.string().catch(\"caught\").optional(),\n // Branch: input[key] defined, validation issues\n issueDefined: z.string().min(5).optional(),\n // Branch: input[key] defined, validation returns undefined\n validDefinedUndefined: z\n .string()\n .transform(() => undefined)\n .optional(),\n // Branch: input[key] defined, non-und"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":228,"symbol":"result1","kind":"constant","lang":"typescript","doc":"Test input[key] === undefined cases","code":"const result1 = mySchema.parse(\n {\n // caughtMissing: not present (key not in input)\n caughtUndefined: undefined, // key in input\n // issueMissing: not present (key not in input)\n issueUndefined: undefined, // key in input\n validUndefined: undefined,\n // defaultValue: not present, will get default\n },\n { jitless: true }\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":248,"symbol":"result2","kind":"constant","lang":"typescript","doc":"Test input[key] defined cases (successful)","code":"const result2 = mySchema.parse(\n {\n caughtDefined: 123, // invalid type, should catch\n validDefinedUndefined: \"test\", // transforms to undefined\n validDefined: \"valid\", // valid value\n },\n { jitless: true }\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":276,"symbol":"mySchema","kind":"constant","lang":"typescript","code":"const mySchema = z.object({\n caughtMissing: z.string().catch(\"caught\").optional(),\n caughtUndefined: z.string().catch(\"caught\").optional(),\n issueMissing: z.string().min(5).optional(),\n issueUndefined: z.string().min(5).optional(),\n validUndefined: z.string().optional(),\n defaultValue: z.string().default(\"default\").optional(),\n caughtDefined: z.string().catch(\"caught\").optional(),\n validDefinedUndefined: z\n .string()\n .transform(() => undefined)\n .optional(),\n validDefined: z.string().optional(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":291,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = {\n caughtUndefined: undefined,\n issueUndefined: undefined,\n validUndefined: undefined,\n caughtDefined: 123,\n validDefinedUndefined: \"test\",\n validDefined: \"valid\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":301,"symbol":"jitlessResult","kind":"constant","lang":"typescript","doc":"Test both paths produce identical results","code":"const jitlessResult = mySchema.parse(input, { jitless: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":302,"symbol":"fastpassResult","kind":"constant","lang":"typescript","code":"const fastpassResult = mySchema.parse(input);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":317,"symbol":"baseSchema","kind":"constant","lang":"typescript","code":"const baseSchema = z\n .string()\n .optional()\n .check(({ value, ...ctx }) => {\n ctx.issues.push({\n code: \"custom\",\n input: value,\n message: \"message\",\n });\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":342,"symbol":"schemaObject","kind":"constant","lang":"typescript","code":"const schemaObject = z.object({\n date: baseSchema,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":363,"symbol":"baseSchema","kind":"constant","lang":"typescript","code":"const baseSchema = z.object({\n id: z.string(),\n name: z.string(),\n items: z.string().array(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":369,"symbol":"refinedSchema","kind":"constant","lang":"typescript","code":"const refinedSchema = baseSchema.superRefine((val, ctx) => {\n if (val.items.length === 0) {\n ctx.addIssue({\n message: \"Must have at least one item\",\n code: \"custom\",\n path: [\"items\"],\n });\n }\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":383,"symbol":"baseSchema","kind":"constant","lang":"typescript","code":"const baseSchema = z.object({\n password: z.string(),\n confirmPassword: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":388,"symbol":"refinedSchema","kind":"constant","lang":"typescript","code":"const refinedSchema = baseSchema.refine((data) => data.password === data.confirmPassword, {\n message: \"Passwords must match\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":396,"symbol":"baseSchema","kind":"constant","lang":"typescript","code":"const baseSchema = z.object({\n name: z.string().optional(),\n age: z.number().optional(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":401,"symbol":"refinedSchema","kind":"constant","lang":"typescript","code":"const refinedSchema = baseSchema.superRefine((val, ctx) => {\n if (val.name === \"admin\") {\n ctx.addIssue({\n message: \"Name cannot be admin\",\n code: \"custom\",\n path: [\"name\"],\n });\n }\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":411,"symbol":"requiredSchema","kind":"constant","lang":"typescript","code":"const requiredSchema = refinedSchema.required();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":414,"symbol":"result","kind":"constant","lang":"typescript","doc":"The refinement should still be applied","code":"const result = requiredSchema.safeParse({ name: \"admin\", age: 25 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":421,"symbol":"validResult","kind":"constant","lang":"typescript","doc":"Valid data should pass","code":"const validResult = requiredSchema.safeParse({ name: \"user\", age: 25 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":426,"symbol":"baseSchema","kind":"constant","lang":"typescript","code":"const baseSchema = z.object({\n password: z.string().optional(),\n confirmPassword: z.string().optional(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":431,"symbol":"refinedSchema","kind":"constant","lang":"typescript","code":"const refinedSchema = baseSchema.refine((data) => data.password === data.confirmPassword, {\n message: \"Passwords must match\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":435,"symbol":"requiredSchema","kind":"constant","lang":"typescript","code":"const requiredSchema = refinedSchema.required();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":438,"symbol":"result","kind":"constant","lang":"typescript","doc":"Mismatched passwords should fail refinement","code":"const result = requiredSchema.safeParse({ password: \"abc\", confirmPassword: \"xyz\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":445,"symbol":"validResult","kind":"constant","lang":"typescript","doc":"Matching passwords should pass","code":"const validResult = requiredSchema.safeParse({ password: \"abc\", confirmPassword: \"abc\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":450,"symbol":"shallow","kind":"constant","lang":"typescript","code":"const shallow = nested.exactPartial();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":451,"symbol":"shallow","kind":"type","lang":"typescript","code":"type shallow = z.infer<typeof shallow>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":464,"symbol":"object","kind":"constant","lang":"typescript","code":"const object = z.object({ name: z.string(), age: z.number() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":465,"symbol":"exact","kind":"constant","lang":"typescript","code":"const exact = object.exactPartial();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":472,"symbol":"exact","kind":"constant","lang":"typescript","code":"const exact = z.object({ name: z.string(), age: z.number() }).exactPartial();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":479,"symbol":"object","kind":"constant","lang":"typescript","code":"const object = z.object({ name: z.string(), age: z.number(), country: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":480,"symbol":"masked","kind":"constant","lang":"typescript","code":"const masked = object.exactPartial({ name: true, age: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":485,"symbol":"masked","kind":"type","lang":"typescript","code":"type masked = z.infer<typeof masked>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/partial.test.ts","line":493,"symbol":"refined","kind":"constant","lang":"typescript","code":"const refined = z.object({ name: z.string() }).refine(() => true);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":4,"symbol":"fish","kind":"constant","lang":"typescript","code":"const fish = z.object({\n name: z.string(),\n age: z.number(),\n nested: z.object({}),\n});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":11,"symbol":"nameonlyFish","kind":"constant","lang":"typescript","code":"const nameonlyFish = fish.pick({ name: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":12,"symbol":"nameonlyFish","kind":"type","lang":"typescript","code":"type nameonlyFish = z.infer<typeof nameonlyFish>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":17,"symbol":"nameonlyFish","kind":"constant","lang":"typescript","code":"const nameonlyFish = fish.pick({ name: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":21,"symbol":"anotherNameonlyFish","kind":"constant","lang":"typescript","doc":"@ts-expect-error checking runtime picks `name` only.","code":"const anotherNameonlyFish = fish.pick({ name: true, age: false });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":30,"symbol":"nameonlyFish","kind":"constant","lang":"typescript","code":"const nameonlyFish = fish.pick({ name: true }).strict();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":31,"symbol":"bad1","kind":"constant","lang":"typescript","code":"const bad1 = () => nameonlyFish.parse({ name: 12 } as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":32,"symbol":"bad2","kind":"constant","lang":"typescript","code":"const bad2 = () => nameonlyFish.parse({ name: \"bob\", age: 12 } as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":33,"symbol":"bad3","kind":"constant","lang":"typescript","code":"const bad3 = () => nameonlyFish.parse({ age: 12 } as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":36,"symbol":"anotherNameonlyFish","kind":"constant","lang":"typescript","doc":"@ts-expect-error checking runtime picks `name` only.","code":"const anotherNameonlyFish = fish.pick({ name: true, age: false }).strict();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":37,"symbol":"bad4","kind":"constant","lang":"typescript","code":"const bad4 = () => anotherNameonlyFish.parse({ name: \"bob\", age: 12 } as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":46,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string(), b: z.string().optional() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":49,"symbol":"picked","kind":"constant","lang":"typescript","code":"const picked = schema.pick({ a: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":55,"symbol":"nonameFish","kind":"constant","lang":"typescript","code":"const nonameFish = fish.omit({ name: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":56,"symbol":"nonameFish","kind":"type","lang":"typescript","code":"type nonameFish = z.infer<typeof nonameFish>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":62,"symbol":"nonameFish","kind":"constant","lang":"typescript","code":"const nonameFish = fish.omit({ name: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":66,"symbol":"anotherNonameFish","kind":"constant","lang":"typescript","doc":"@ts-expect-error checking runtime omits `name` only.","code":"const anotherNonameFish = fish.omit({ name: true, age: false });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":71,"symbol":"nonameFish","kind":"constant","lang":"typescript","code":"const nonameFish = fish.omit({ name: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":72,"symbol":"bad1","kind":"constant","lang":"typescript","code":"const bad1 = () => nonameFish.parse({ name: 12 } as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":73,"symbol":"bad2","kind":"constant","lang":"typescript","code":"const bad2 = () => nonameFish.parse({ age: 12 } as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":74,"symbol":"bad3","kind":"constant","lang":"typescript","code":"const bad3 = () => nonameFish.parse({} as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":77,"symbol":"anotherNonameFish","kind":"constant","lang":"typescript","doc":"@ts-expect-error checking runtime omits `name` only.","code":"const anotherNonameFish = fish.omit({ name: true, age: false });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":78,"symbol":"bad4","kind":"constant","lang":"typescript","code":"const bad4 = () => anotherNonameFish.parse({ nested: {} } as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":87,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string(), b: z.string().optional() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":89,"symbol":"omitted","kind":"constant","lang":"typescript","code":"const omitted = schema.omit({ a: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":94,"symbol":"laxfish","kind":"constant","lang":"typescript","code":"const laxfish = fish.pick({ name: true }).catchall(z.any());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":95,"symbol":"laxfish","kind":"type","lang":"typescript","code":"type laxfish = z.infer<typeof laxfish>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":100,"symbol":"laxfish","kind":"constant","lang":"typescript","code":"const laxfish = fish.passthrough().pick({ name: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":106,"symbol":"laxfish","kind":"constant","lang":"typescript","code":"const laxfish = fish.passthrough().pick({ name: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":107,"symbol":"bad","kind":"constant","lang":"typescript","code":"const bad = () => laxfish.parse({ whatever: \"asdf\" } as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":112,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n name: z.string(),\n age: z.number(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":139,"symbol":"baseSchema","kind":"constant","lang":"typescript","code":"const baseSchema = z.object({\n id: z.string(),\n name: z.string(),\n items: z.string().array(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":145,"symbol":"refinedSchema","kind":"constant","lang":"typescript","code":"const refinedSchema = baseSchema.superRefine((val, ctx) => {\n if (val.items.length === 0) {\n ctx.addIssue({\n message: \"Must have at least one item\",\n code: \"custom\",\n path: [\"items\"],\n });\n }\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":161,"symbol":"baseSchema","kind":"constant","lang":"typescript","code":"const baseSchema = z.object({\n id: z.string(),\n name: z.string(),\n items: z.string().array(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":167,"symbol":"refinedSchema","kind":"constant","lang":"typescript","code":"const refinedSchema = baseSchema.superRefine((val, ctx) => {\n if (val.items.length === 0) {\n ctx.addIssue({\n message: \"Must have at least one item\",\n code: \"custom\",\n path: [\"items\"],\n });\n }\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":183,"symbol":"baseSchema","kind":"constant","lang":"typescript","code":"const baseSchema = z.object({\n password: z.string(),\n confirmPassword: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":188,"symbol":"refinedSchema","kind":"constant","lang":"typescript","code":"const refinedSchema = baseSchema.refine((data) => data.password === data.confirmPassword, {\n message: \"Passwords must match\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":198,"symbol":"baseSchema","kind":"constant","lang":"typescript","code":"const baseSchema = z.object({\n password: z.string(),\n confirmPassword: z.string(),\n email: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pickomit.test.ts","line":204,"symbol":"refinedSchema","kind":"constant","lang":"typescript","code":"const refinedSchema = baseSchema.refine((data) => data.password === data.confirmPassword, {\n message: \"Passwords must match\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pipe.test.ts","line":6,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().transform(Number).pipe(z.number());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pipe.test.ts","line":11,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .string()\n .transform(async (val) => Number(val))\n .pipe(z.number());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pipe.test.ts","line":19,"symbol":"stringWithDefault","kind":"constant","lang":"typescript","code":"const stringWithDefault = z\n .pipe(\n z.transform((v) => (v === \"none\" ? undefined : v)),\n z.string()\n )\n .catch(\"default\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pipe.test.ts","line":33,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .string()\n .refine((c) => c === \"1234\", \"A\")\n .transform((val) => Number(val))\n .refine((c) => c === 1234, \"B\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pipe.test.ts","line":56,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .string()\n .refine((c) => c === \"1234\", { message: \"A\", abort: true })\n .transform((val) => Number(val))\n .refine((c) => c === 1234, \"B\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pipe.test.ts","line":79,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().pipe(z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/pipe.test.ts","line":97,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().transform((val) => val.length);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/prefault.test.ts","line":5,"symbol":"previous","kind":"constant","lang":"typescript","code":"const previous = z.config().jitless;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/prefault.test.ts","line":9,"symbol":"field","kind":"constant","lang":"typescript","code":"const field = z.union([z.string(), z.undefined()]).prefault(() => {\n calls++;\n return undefined;\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/prefault.test.ts","line":13,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: field });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/prefault.test.ts","line":27,"symbol":"literal","kind":"constant","lang":"typescript","code":"const literal = z.prefault(z.string().optional(), undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/prefault.test.ts","line":41,"symbol":"field","kind":"constant","lang":"typescript","code":"const field = z\n .string()\n .transform(() => undefined)\n .prefault(\"fallback\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/prefault.test.ts","line":47,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: field, optional: z.string().optional() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/prefault.test.ts","line":75,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.prefault(z.string().trim(), \" default \");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/prefault.test.ts","line":80,"symbol":"inp","kind":"type","lang":"typescript","code":"type inp = z.input<typeof a>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/prefault.test.ts","line":82,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof a>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/prefault.test.ts","line":88,"symbol":"a","kind":"constant","lang":"typescript","doc":"test optinality","code":"const a = z.object({\n name: z.string().optional(),\n age: z.number().default(1234),\n email: z.string().prefault(\"1234\"),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/prefault.test.ts","line":94,"symbol":"inp","kind":"type","lang":"typescript","code":"type inp = z.input<typeof a>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/prefault.test.ts","line":101,"symbol":"out","kind":"type","lang":"typescript","code":"type out = z.output<typeof a>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/prefault.test.ts","line":110,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n a: z.string(),\n })\n .prefault({ a: \"x\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/prefault.test.ts","line":115,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = schema.parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/prefault.test.ts","line":116,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = schema.parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/prefault.test.ts","line":122,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().prefault(\"hello\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess-types.test.ts","line":5,"symbol":"pre","kind":"constant","lang":"typescript","code":"const pre = z.preprocess((v) => v, z.string().optional());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess-types.test.ts","line":6,"symbol":"_asPipe","kind":"constant","lang":"typescript","code":"const _asPipe: z.ZodPipe<z.core.$ZodTransform, z.ZodOptional<z.ZodString>> = pre;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess-types.test.ts","line":7,"symbol":"_asCorePipe","kind":"constant","lang":"typescript","code":"const _asCorePipe: z.core.$ZodPipe<z.core.$ZodTransform, z.ZodOptional<z.ZodString>> = pre;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess-types.test.ts","line":13,"symbol":"optionalInside","kind":"constant","lang":"typescript","code":"const optionalInside = z.preprocess((v) => v, z.string().optional());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess-types.test.ts","line":17,"symbol":"required","kind":"constant","lang":"typescript","code":"const required = z.preprocess((v) => v, z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess-types.test.ts","line":23,"symbol":"pre","kind":"constant","lang":"typescript","code":"const pre = z.preprocess((v) => v, z.number().optional());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess-types.test.ts","line":29,"symbol":"trimmed","kind":"constant","lang":"typescript","code":"const trimmed = z.preprocess((val: string | null | undefined) => val?.trim() ?? \"\", z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess-types.test.ts","line":33,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = z.object({ a: z.preprocess((v: string | number) => String(v), z.string()) });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess-types.test.ts","line":40,"symbol":"pre","kind":"constant","lang":"typescript","code":"const pre = z.preprocess((v: string) => v.length, z.number());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess-types.test.ts","line":41,"symbol":"_bare","kind":"constant","lang":"typescript","code":"const _bare: z.ZodPreprocess<z.ZodNumber> = pre;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess-types.test.ts","line":42,"symbol":"_bareCore","kind":"constant","lang":"typescript","code":"const _bareCore: z.core.$ZodPreprocess = pre;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":5,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.preprocess((data) => [data], z.string().array());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":6,"symbol":"value","kind":"constant","lang":"typescript","code":"const value = schema.parse(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":12,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.preprocess(async (data) => {\n return [data];\n }, z.string().array());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":15,"symbol":"value","kind":"constant","lang":"typescript","code":"const value = await schema.safeParseAsync(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":28,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.preprocess((_, ctx) => {\n ctx.addIssue(\"bad stuff\");\n }, z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":31,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":48,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.preprocess((data, ctx) => {\n ctx.addIssue({\n input: data,\n code: \"custom\",\n message: `${data} is not one of our allowed strings`,\n });\n return data;\n }, z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":57,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = a.safeParse(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":77,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.preprocess((data, ctx) => {\n ctx.addIssue({\n code: \"custom\",\n message: `custom error`,\n });\n\n return data;\n }, z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":85,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(1234);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":103,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.preprocess((data, ctx) => {\n ctx.addIssue({\n input: data,\n code: \"custom\",\n origin: \"custom\",\n message: `custom error`,\n fatal: true,\n });\n return data;\n }, z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":114,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(1234);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":134,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.preprocess(async (data, ctx) => {\n ctx.addIssue({\n input: data,\n code: \"custom\",\n message: `${data} is not one of our allowed strings`,\n });\n return data;\n }, z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":143,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await schema.safeParseAsync(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":161,"symbol":"foo","kind":"constant","lang":"typescript","code":"const foo = z.preprocess((val, ctx) => {\n if (!val) {\n ctx.addIssue({ input: val, code: \"custom\", message: \"bad\" });\n return z.NEVER;\n }\n return val;\n }, z.number());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":169,"symbol":"foo","kind":"type","lang":"typescript","code":"type foo = z.infer<typeof foo>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":171,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = foo.safeParse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":189,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n nonEmptyStr: z.string().min(1),\n positiveNum: z.preprocess((v) => Number(v), z.number().positive()),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":193,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({\n nonEmptyStr: \"\",\n positiveNum: \"\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":229,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n missing: z.string().refine(() => false),\n preprocess: z.preprocess((data: any) => data?.trim(), z.string().regex(/ asdf/)),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":234,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({ preprocess: \" asdf\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":265,"symbol":"A","kind":"constant","lang":"typescript","code":"const A = z\n .string()\n .refine((_) => false)\n .min(4)\n .transform((val) => val.length)\n .pipe(z.number())\n .refine((_) => false);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":285,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.preprocess((v) => v ?? \"X\", z.string()) });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":311,"symbol":"outer","kind":"constant","lang":"typescript","code":"const outer = z.object({ x: z.preprocess((v) => v, z.number()).optional() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":312,"symbol":"inner","kind":"constant","lang":"typescript","code":"const inner = z.object({ x: z.preprocess((v) => v, z.number().optional()) });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":325,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.preprocess((v) => v, z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":332,"symbol":"inner","kind":"constant","lang":"typescript","code":"const inner = z.preprocess((v) => v, z.literal(\"test\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":338,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\"kind\", [\n z.object({ kind: z.preprocess((v: any) => String(v).toUpperCase(), z.literal(\"A\")), a: z.string() }),\n z.object({ kind: z.preprocess((v: any) => String(v).toUpperCase(), z.literal(\"B\")), b: z.number() }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/preprocess.test.ts","line":346,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(\n z.preprocess((v: any) => String(v).toLowerCase(), z.enum([\"a\", \"b\"])),\n z.string()\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":4,"symbol":"literalStringSchema","kind":"constant","lang":"typescript","code":"const literalStringSchema = z.literal(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":5,"symbol":"literalNumberSchema","kind":"constant","lang":"typescript","code":"const literalNumberSchema = z.literal(12);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":6,"symbol":"literalBooleanSchema","kind":"constant","lang":"typescript","code":"const literalBooleanSchema = z.literal(true);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":7,"symbol":"literalBigIntSchema","kind":"constant","lang":"typescript","code":"const literalBigIntSchema = z.literal(BigInt(42));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":9,"symbol":"stringSchema","kind":"constant","lang":"typescript","code":"const stringSchema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":10,"symbol":"numberSchema","kind":"constant","lang":"typescript","code":"const numberSchema = z.number();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":11,"symbol":"bigintSchema","kind":"constant","lang":"typescript","code":"const bigintSchema = z.bigint();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":12,"symbol":"booleanSchema","kind":"constant","lang":"typescript","code":"const booleanSchema = z.boolean();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":13,"symbol":"dateSchema","kind":"constant","lang":"typescript","code":"const dateSchema = z.date();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":14,"symbol":"symbolSchema","kind":"constant","lang":"typescript","code":"const symbolSchema = z.symbol();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":15,"symbol":"nullSchema","kind":"constant","lang":"typescript","code":"const nullSchema = z.null();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":16,"symbol":"undefinedSchema","kind":"constant","lang":"typescript","code":"const undefinedSchema = z.undefined();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":17,"symbol":"stringSchemaOptional","kind":"constant","lang":"typescript","code":"const stringSchemaOptional = z.string().optional();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":18,"symbol":"stringSchemaNullable","kind":"constant","lang":"typescript","code":"const stringSchemaNullable = z.string().nullable();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":19,"symbol":"numberSchemaOptional","kind":"constant","lang":"typescript","code":"const numberSchemaOptional = z.number().optional();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":20,"symbol":"numberSchemaNullable","kind":"constant","lang":"typescript","code":"const numberSchemaNullable = z.number().nullable();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":21,"symbol":"bigintSchemaOptional","kind":"constant","lang":"typescript","code":"const bigintSchemaOptional = z.bigint().optional();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":22,"symbol":"bigintSchemaNullable","kind":"constant","lang":"typescript","code":"const bigintSchemaNullable = z.bigint().nullable();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":23,"symbol":"booleanSchemaOptional","kind":"constant","lang":"typescript","code":"const booleanSchemaOptional = z.boolean().optional();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":24,"symbol":"booleanSchemaNullable","kind":"constant","lang":"typescript","code":"const booleanSchemaNullable = z.boolean().nullable();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":25,"symbol":"dateSchemaOptional","kind":"constant","lang":"typescript","code":"const dateSchemaOptional = z.date().optional();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":26,"symbol":"dateSchemaNullable","kind":"constant","lang":"typescript","code":"const dateSchemaNullable = z.date().nullable();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":27,"symbol":"symbolSchemaOptional","kind":"constant","lang":"typescript","code":"const symbolSchemaOptional = z.symbol().optional();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/primitive.test.ts","line":28,"symbol":"symbolSchemaNullable","kind":"constant","lang":"typescript","code":"const symbolSchemaNullable = z.symbol().nullable();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/promise.test.ts","line":4,"symbol":"promSchema","kind":"constant","lang":"typescript","code":"const promSchema = z.promise(\n z.object({\n name: z.string(),\n age: z.number(),\n })\n);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/promise.test.ts","line":12,"symbol":"promSchemaType","kind":"type","lang":"typescript","code":"type promSchemaType = z.infer<typeof promSchema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/promise.test.ts","line":18,"symbol":"pr","kind":"constant","lang":"typescript","doc":"expect(() => promSchema.parse(Promise.resolve({ name: \"Bobby\", age: 10 }))).toThrow();","code":"const pr = promSchema.parseAsync(Promise.resolve({ name: \"Bobby\", age: 10 }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/promise.test.ts","line":20,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await pr;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/promise.test.ts","line":30,"symbol":"bad","kind":"constant","lang":"typescript","code":"const bad = await promSchema.safeParseAsync(Promise.resolve({ name: \"Bobby\", age: \"10\" }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/promise.test.ts","line":36,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await promSchema.safeParseAsync(Promise.resolve({ name: \"Bobby\", age: \"10\" }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/promise.test.ts","line":42,"symbol":"bad","kind":"constant","lang":"typescript","code":"const bad = () => promSchema.parse({ then: () => {}, catch: {} });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/promise.test.ts","line":50,"symbol":"asyncFunction","kind":"constant","lang":"typescript","code":"const asyncFunction = z.function({\n input: z.tuple([]),\n output: promSchema,\n});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/promise.test.ts","line":56,"symbol":"validatedFunction","kind":"constant","lang":"typescript","code":"const validatedFunction = asyncFunction.implementAsync(async () => {\n return { name: \"jimmy\", age: 14 };\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/promise.test.ts","line":66,"symbol":"validatedFunction","kind":"constant","lang":"typescript","code":"const validatedFunction = asyncFunction.implementAsync(() => {\n return Promise.resolve(\"asdf\" as any);\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/promise.test.ts","line":73,"symbol":"res","kind":"constant","lang":"typescript","code":"const res = z.promise(z.number()).parseAsync(Promise.resolve(12));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/promise.test.ts","line":78,"symbol":"foo","kind":"constant","lang":"typescript","code":"const foo = z.literal(\"foo\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/promise.test.ts","line":79,"symbol":"res","kind":"constant","lang":"typescript","code":"const res = z.promise(foo);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":5,"symbol":"s","kind":"constant","lang":"typescript","code":"const s = z.object({ a: z.string(), b: z.string() }).check(z.properties({ a: z.literal(\"x\"), b: z.literal(\"y\") }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":12,"symbol":"long","kind":"constant","lang":"typescript","doc":"the base already typed the value, so the properties are asserted on whatever it produced — a string's length, as z.property() does","code":"const long = z.string().check(z.properties({ length: z.number().min(3) }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":29,"symbol":"s","kind":"constant","lang":"typescript","doc":"asserts and never writes back, exactly as z.property() behaves; a nested object schema rebuilds its output even without transforms, so identity cannot distinguish the two","code":"const s = z.any().check(z.properties({ a: z.string().transform((s) => s.toUpperCase()) }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":30,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = { a: \"hi\" };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":36,"symbol":"httpsUrl","kind":"constant","lang":"typescript","code":"const httpsUrl = z.instanceof(URL).properties({ protocol: z.literal(\"https:\") });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":39,"symbol":"u","kind":"constant","lang":"typescript","code":"const u = new URL(\"https://example.com\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":44,"symbol":"chained","kind":"constant","lang":"typescript","doc":"chains, and each call narrows further","code":"const chained = httpsUrl.properties({ port: z.literal(\"\") });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":50,"symbol":"W","kind":"constant","lang":"typescript","doc":"nothing is written back, so the narrowing is over the shape's input side","code":"const W = z.instanceof(URL).properties({ search: z.string().transform((s) => s.length) });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":55,"symbol":"file","kind":"constant","lang":"typescript","code":"const file = z.instanceof(File).properties({ name: z.string(), size: z.number().max(1024) });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":69,"symbol":"png","kind":"constant","lang":"typescript","doc":"a literal still narrows a wider property","code":"const png = z.instanceof(File).properties({ type: z.literal(\"image/png\") });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":75,"symbol":"p","kind":"constant","lang":"typescript","doc":"the 4.5 array call sites: the check yields itself from Symbol.iterator","code":"const p = z.properties({ a: z.literal(\"x\") });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":78,"symbol":"s","kind":"constant","lang":"typescript","code":"const s = z.object({ a: z.string() }).check(...z.properties({ a: z.literal(\"x\") }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":84,"symbol":"outer","kind":"constant","lang":"typescript","code":"const outer = z.compile(z.object({ url: z.instanceof(URL).properties({ protocol: z.literal(\"https:\") }) }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":91,"symbol":"s","kind":"constant","lang":"typescript","code":"const s = z.any().check(z.properties({ a: z.string().refine(async (s) => s.length > 1) }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":92,"symbol":"ok","kind":"constant","lang":"typescript","code":"const ok = { a: \"hi\" };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":94,"symbol":"bad","kind":"constant","lang":"typescript","code":"const bad = await s.safeParseAsync({ a: \"!\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":99,"symbol":"sym","kind":"constant","lang":"typescript","code":"const sym = Symbol(\"tag\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":100,"symbol":"s","kind":"constant","lang":"typescript","code":"const s = z.any().check(z.properties({ [sym]: z.string() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":113,"symbol":"s","kind":"constant","lang":"typescript","doc":"a base that permits null reaches the check with one; the compiled property read must not throw where the runtime reports an issue","code":"const s = z.any().check(...z.properties({ a: z.string() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":114,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = [[\"invalid_type\", []]];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":126,"symbol":"p","kind":"constant","lang":"typescript","doc":"`when` is not publicly settable, since it gates the assertion inside the run loop. A hand-built def can still carry one, and compiling it must refuse rather than run the shape unconditionally: a union branch compiles to its own IIFE, so a wrong rejection is absorbed as a branch failure with no fallback.","code":"const p = new z.core.$ZodCheckProperties({ check: \"properties\", shape: { a: z.literal(\"x\") }, when: () => false });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":127,"symbol":"s","kind":"constant","lang":"typescript","code":"const s = z.union([z.any().check(p), z.object({ b: z.string() })]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":128,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = { a: \"wrong\", b: \"hello\" };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":134,"symbol":"shape","kind":"constant","lang":"typescript","doc":"key and schema are snapshotted together; caching one and reading the other live paired a stale key with a missing schema","code":"const shape: Record<string, z.ZodType> = { a: z.string() };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/properties.test.ts","line":135,"symbol":"s","kind":"constant","lang":"typescript","code":"const s = z.any().check(z.properties(shape));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/prototypes.test.ts","line":5,"symbol":"ZodType","kind":"interface","lang":"typescript","code":"interface ZodType {\n /** @deprecated */\n _classic(): string;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/prototypes.test.ts","line":17,"symbol":"result","kind":"constant","lang":"typescript","doc":"should pass","code":"const result = z.string()._classic();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":4,"symbol":"testEnum","kind":"type","lang":"typescript","code":"enum testEnum {\n A = 0,\n B = 1,\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":10,"symbol":"readonlyString","kind":"constant","lang":"typescript","code":"const readonlyString = z.string().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":11,"symbol":"readonlyNumber","kind":"constant","lang":"typescript","code":"const readonlyNumber = z.number().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":12,"symbol":"readonlyNaN","kind":"constant","lang":"typescript","code":"const readonlyNaN = z.nan().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":13,"symbol":"readonlyBigInt","kind":"constant","lang":"typescript","code":"const readonlyBigInt = z.bigint().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":14,"symbol":"readonlyBoolean","kind":"constant","lang":"typescript","code":"const readonlyBoolean = z.boolean().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":15,"symbol":"readonlyDate","kind":"constant","lang":"typescript","code":"const readonlyDate = z.date().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":16,"symbol":"readonlyUndefined","kind":"constant","lang":"typescript","code":"const readonlyUndefined = z.undefined().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":17,"symbol":"readonlyNull","kind":"constant","lang":"typescript","code":"const readonlyNull = z.null().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":18,"symbol":"readonlyAny","kind":"constant","lang":"typescript","code":"const readonlyAny = z.any().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":19,"symbol":"readonlyUnknown","kind":"constant","lang":"typescript","code":"const readonlyUnknown = z.unknown().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":20,"symbol":"readonlyVoid","kind":"constant","lang":"typescript","code":"const readonlyVoid = z.void().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":21,"symbol":"readonlyStringArray","kind":"constant","lang":"typescript","code":"const readonlyStringArray = z.array(z.string()).readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":22,"symbol":"readonlyTuple","kind":"constant","lang":"typescript","code":"const readonlyTuple = z.tuple([z.string(), z.number()]).readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":23,"symbol":"readonlyMap","kind":"constant","lang":"typescript","code":"const readonlyMap = z.map(z.string(), z.date()).readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":24,"symbol":"readonlySet","kind":"constant","lang":"typescript","code":"const readonlySet = z.set(z.string()).readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":25,"symbol":"readonlyStringRecord","kind":"constant","lang":"typescript","code":"const readonlyStringRecord = z.record(z.string(), z.string()).readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":26,"symbol":"readonlyNumberRecord","kind":"constant","lang":"typescript","code":"const readonlyNumberRecord = z.record(z.string(), z.number()).readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":27,"symbol":"readonlyObject","kind":"constant","lang":"typescript","code":"const readonlyObject = z.object({ a: z.string(), 1: z.number() }).readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":28,"symbol":"readonlyEnum","kind":"constant","lang":"typescript","code":"const readonlyEnum = z.nativeEnum(testEnum).readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":29,"symbol":"readonlyPromise","kind":"constant","lang":"typescript","code":"const readonlyPromise = z.promise(z.string()).readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":107,"symbol":"readonlyStringArray","kind":"constant","lang":"typescript","code":"const readonlyStringArray = z.string().array().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":108,"symbol":"readonlyStringTuple","kind":"constant","lang":"typescript","code":"const readonlyStringTuple = z.tuple([z.string()]).readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":109,"symbol":"deepReadonly","kind":"constant","lang":"typescript","code":"const deepReadonly = z.object({ a: z.string() }).readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":111,"symbol":"readonlyStringArray","kind":"type","lang":"typescript","code":"type readonlyStringArray = z.infer<typeof readonlyStringArray>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":112,"symbol":"readonlyStringTuple","kind":"type","lang":"typescript","code":"type readonlyStringTuple = z.infer<typeof readonlyStringTuple>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":113,"symbol":"deepReadonly","kind":"type","lang":"typescript","code":"type deepReadonly = z.infer<typeof deepReadonly>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":121,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.array(z.string()).readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":122,"symbol":"readonlyArray","kind":"constant","lang":"typescript","code":"const readonlyArray = [\"a\", \"b\", \"c\"] as const;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":123,"symbol":"mutableArray","kind":"constant","lang":"typescript","code":"const mutableArray = [\"a\", \"b\", \"c\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":124,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = schema.parse(readonlyArray);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":125,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = schema.parse(mutableArray);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":131,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.tuple([z.string(), z.number()]).readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":136,"symbol":"readonlyString","kind":"constant","lang":"typescript","code":"const readonlyString = z.string().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":137,"symbol":"readonlyNumber1","kind":"constant","lang":"typescript","code":"const readonlyNumber1 = z.number().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":138,"symbol":"readonlyNumber2","kind":"constant","lang":"typescript","code":"const readonlyNumber2 = z.number().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":139,"symbol":"readonlyBigInt","kind":"constant","lang":"typescript","code":"const readonlyBigInt = z.bigint().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":140,"symbol":"readonlyBoolean","kind":"constant","lang":"typescript","code":"const readonlyBoolean = z.boolean().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":141,"symbol":"readonlyDate","kind":"constant","lang":"typescript","code":"const readonlyDate = z.date().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":142,"symbol":"readonlyUndefined","kind":"constant","lang":"typescript","code":"const readonlyUndefined = z.undefined().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":143,"symbol":"readonlyNull","kind":"constant","lang":"typescript","code":"const readonlyNull = z.null().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":144,"symbol":"readonlyAny","kind":"constant","lang":"typescript","code":"const readonlyAny = z.any().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":145,"symbol":"readonlyUnknown","kind":"constant","lang":"typescript","code":"const readonlyUnknown = z.unknown().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":146,"symbol":"readonlyVoid","kind":"constant","lang":"typescript","code":"const readonlyVoid = z.void().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":148,"symbol":"readonlyStringArray","kind":"constant","lang":"typescript","doc":"const readonlyFunction = z.function(z.tuple([z.string(), z.number()]), z.unknown()).readonly();","code":"const readonlyStringArray = z.string().array().readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":149,"symbol":"readonlyTuple","kind":"constant","lang":"typescript","code":"const readonlyTuple = z.tuple([z.string(), z.number()]).readonly();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":171,"symbol":"bigIntVal","kind":"constant","lang":"typescript","code":"const bigIntVal = BigInt(1);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/readonly.test.ts","line":174,"symbol":"dateVal","kind":"constant","lang":"typescript","code":"const dateVal = new Date();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":5,"symbol":"booleanRecord","kind":"constant","lang":"typescript","code":"const booleanRecord = z.record(z.string(), z.boolean());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":6,"symbol":"booleanRecord","kind":"type","lang":"typescript","code":"type booleanRecord = typeof booleanRecord._output;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":8,"symbol":"recordWithEnumKeys","kind":"constant","lang":"typescript","code":"const recordWithEnumKeys = z.record(z.enum([\"Tuna\", \"Salmon\"]), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":9,"symbol":"recordWithEnumKeys","kind":"type","lang":"typescript","code":"type recordWithEnumKeys = z.infer<typeof recordWithEnumKeys>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":11,"symbol":"recordWithLiteralKey","kind":"constant","lang":"typescript","code":"const recordWithLiteralKey = z.record(z.literal([\"Tuna\", \"Salmon\", 21]), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":12,"symbol":"recordWithLiteralKey","kind":"type","lang":"typescript","code":"type recordWithLiteralKey = z.infer<typeof recordWithLiteralKey>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":14,"symbol":"recordWithLiteralUnionKeys","kind":"constant","lang":"typescript","code":"const recordWithLiteralUnionKeys = z.record(\n z.union([z.literal(\"Tuna\"), z.literal(\"Salmon\"), z.literal(21)]),\n z.string()\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":18,"symbol":"recordWithLiteralUnionKeys","kind":"type","lang":"typescript","code":"type recordWithLiteralUnionKeys = z.infer<typeof recordWithLiteralUnionKeys>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":20,"symbol":"Enum","kind":"type","lang":"typescript","code":"enum Enum {\n Tuna = 0,\n Salmon = \"Shark\",\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":25,"symbol":"recordWithTypescriptEnum","kind":"constant","lang":"typescript","code":"const recordWithTypescriptEnum = z.record(z.enum(Enum), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":26,"symbol":"recordWithTypescriptEnum","kind":"type","lang":"typescript","code":"type recordWithTypescriptEnum = z.infer<typeof recordWithTypescriptEnum>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":36,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.enum([\"Tuna\", \"Salmon\"]), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":80,"symbol":"defaulted","kind":"constant","lang":"typescript","code":"const defaulted = z.record(z.enum([\"Tuna\", \"Salmon\"]), z.string().default(\"unknown\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":85,"symbol":"prefaulted","kind":"constant","lang":"typescript","code":"const prefaulted = z.record(z.enum([\"Tuna\", \"Salmon\"]), z.string().prefault(\"unknown\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":89,"symbol":"optional","kind":"constant","lang":"typescript","code":"const optional = z.record(z.enum([\"Tuna\", \"Salmon\"]), z.string().optional());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":95,"symbol":"required","kind":"constant","lang":"typescript","doc":"A value that needs a slot keeps the key required, and a non-enumerable key stays an index signature either way.","code":"const required = z.record(z.enum([\"Tuna\", \"Salmon\"]), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":97,"symbol":"indexed","kind":"constant","lang":"typescript","code":"const indexed = z.record(z.string(), z.string().default(\"unknown\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":101,"symbol":"caught","kind":"constant","lang":"typescript","doc":"A catch and a preprocess pipe declare no static optin, so the key stays required even where the parser can fill it. The static predicate and the one the JSON Schema emitter uses resolve these differently, and the two have to keep agreeing.","code":"const caught = z.record(z.enum([\"Tuna\", \"Salmon\"]), z.string().catch(\"unknown\"));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":103,"symbol":"preprocessed","kind":"constant","lang":"typescript","code":"const preprocessed = z.record(\n z.enum([\"Tuna\", \"Salmon\"]),\n z.preprocess((v) => v, z.string())\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":111,"symbol":"BigFish","kind":"type","lang":"typescript","code":"enum BigFish {\n Tuna = 0,\n Salmon = \"Shark\",\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":116,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.enum(BigFish), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":117,"symbol":"value","kind":"constant","lang":"typescript","code":"const value = {\n [BigFish.Tuna]: \"asdf\",\n [BigFish.Salmon]: \"asdf\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":172,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.literal([\"Tuna\", \"Salmon\", 21]), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":220,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.enum([\"Tuna\", \"Salmon\"]).pipe(z.any()), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":259,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.union([z.literal(\"Tuna\"), z.literal(\"Salmon\"), z.literal(21)]), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":307,"symbol":"single","kind":"constant","lang":"typescript","code":"const single = z.record(\n z.literal(\"a\").transform(() => \"b\" as const),\n z.string()\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":313,"symbol":"multi","kind":"constant","lang":"typescript","code":"const multi = z.record(\n z.literal([\"a\", \"b\"]).transform((k) => k.toUpperCase()),\n z.number()\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":322,"symbol":"en","kind":"constant","lang":"typescript","code":"const en = z.record(\n z.enum([\"a\", \"b\"]).transform((k) => k.toUpperCase()),\n z.number()\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":329,"symbol":"part","kind":"constant","lang":"typescript","doc":"matches partialRecord, which already applied transforms","code":"const part = z.partialRecord(\n z.literal(\"a\").transform(() => \"b\" as const),\n z.string()\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":338,"symbol":"schema","kind":"constant","lang":"typescript","doc":"refine rejects \"b\" but it's still in the literal's value set","code":"const schema = z.record(\n z.literal([\"a\", \"b\"]).refine((k) => k === \"a\", { message: \"only 'a' is allowed\" }),\n z.string()\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":368,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.string(), z.boolean());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":392,"symbol":"rec","kind":"constant","lang":"typescript","code":"const rec = z.record(z.string(), z.number());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":399,"symbol":"rec","kind":"constant","lang":"typescript","code":"const rec = z.record(\n z.string(),\n z.object({\n a: z.string(),\n })\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":406,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = JSON.parse(`\n {\n \"__proto__\": {\n \"a\": \"evil\"\n },\n \"b\": {\n \"a\": \"good\"\n }\n }\n `);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":417,"symbol":"obj1","kind":"constant","lang":"typescript","code":"const obj1 = rec.parse(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":420,"symbol":"obj2","kind":"constant","lang":"typescript","code":"const obj2 = rec.safeParse(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":426,"symbol":"obj3","kind":"constant","lang":"typescript","code":"const obj3 = await rec.parseAsync(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":429,"symbol":"obj4","kind":"constant","lang":"typescript","code":"const obj4 = await rec.safeParseAsync(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":437,"symbol":"value","kind":"constant","lang":"typescript","code":"const value = z.object({ a: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":438,"symbol":"payload","kind":"constant","lang":"typescript","code":"const payload = { a: \"evil\" };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":439,"symbol":"wire","kind":"constant","lang":"typescript","code":"const wire = (key: string) => JSON.parse(JSON.stringify({ [key]: payload }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":441,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases = [\n [z.record(z.string().toLowerCase(), value), wire(\"__PROTO__\")],\n [z.record(z.string().trim(), value), wire(\" __proto__ \")],\n [z.record(z.string().normalize(\"NFKC\"), value), wire(\"__proto__\")],\n [\n z.record(\n z.string().transform((s) => s.slice(2)),\n value\n ),\n wire(\"x:__proto__\"),\n ],\n ] as const;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":455,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.parse(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":464,"symbol":"asyncValue","kind":"constant","lang":"typescript","doc":"an async value schema takes the promise write path","code":"const asyncValue = z.record(\n z.string().toLowerCase(),\n value.refine(async () => true)\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":475,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = z.record(z.string(), z.any()).parse({ foo: undefined });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":483,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.string(), z.undefined());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":495,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .record(\n z.string(),\n z\n .string()\n .optional()\n .refine(async () => true)\n )\n .refine(async () => true);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":505,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = {\n foo: \"bar\",\n baz: \"qux\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":509,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await schema.safeParseAsync(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":514,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .record(\n z.string(),\n z\n .string()\n .optional()\n .refine(async () => false)\n )\n .refine(async () => false);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":524,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = {\n foo: \"bar\",\n baz: \"qux\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":528,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await schema.safeParseAsync(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":556,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.partialRecord(z.string(), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":557,"symbol":"schema","kind":"type","lang":"typescript","code":"type schema = z.infer<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":560,"symbol":"Keys","kind":"constant","lang":"typescript","code":"const Keys = z.enum([\"id\", \"name\", \"email\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":561,"symbol":"Person","kind":"constant","lang":"typescript","code":"const Person = z.partialRecord(Keys, z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":580,"symbol":"Keys","kind":"constant","lang":"typescript","code":"const Keys = z.literal([\"id\", \"name\", \"email\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":581,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.partialRecord(Keys, z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":582,"symbol":"Schema","kind":"type","lang":"typescript","code":"type Schema = z.infer<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/record.test.ts","line":609,"symbol":"Keys","kind":"constant","lang":"typescript","code":"const Keys = z.literal([1, 2, 3]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":5,"symbol":"ObjectField","kind":"type","lang":"typescript","code":"type ObjectField = z.ZodObject<{ [k: string]: ObjectField }>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":6,"symbol":"MixedField","kind":"type","lang":"typescript","code":"type MixedField = z.ZodString | z.ZodObject<{ [k: string]: MixedField }>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":10,"symbol":"ObjectValue","kind":"type","lang":"typescript","code":"type ObjectValue = { [k: string]: ObjectValue };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":11,"symbol":"MixedValue","kind":"type","lang":"typescript","code":"type MixedValue = string | { [k: string]: MixedValue };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":17,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema: MixedField = z.object({ name: z.string(), nested: z.object({ name: z.string() }) });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":24,"symbol":"CoreField","kind":"type","lang":"typescript","code":"type CoreField = z.core.$ZodString<string> | z.core.$ZodObject<{ [k: string]: CoreField }>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":30,"symbol":"Field","kind":"type","lang":"typescript","code":"type Field = z.ZodPipe<z.ZodString, z.ZodTransform<number, string>> | z.ZodObject<{ [k: string]: Field }>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":31,"symbol":"Input","kind":"type","lang":"typescript","code":"type Input = string | { [k: string]: Input };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":32,"symbol":"Output","kind":"type","lang":"typescript","code":"type Output = number | { [k: string]: Output };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":35,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema: Field = z.object({ nested: z.object({ length: z.string().transform((s) => s.length) }) });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":41,"symbol":"Indexed","kind":"type","lang":"typescript","code":"type Indexed = z.ZodObject<Record<string, z.ZodString>>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":42,"symbol":"Recursive","kind":"type","lang":"typescript","code":"type Recursive = z.ZodObject<Record<string, Recursive>>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":50,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = {\n name: \"I\",\n subcategories: [\n {\n name: \"A\",\n subcategories: [\n {\n name: \"1\",\n subcategories: [\n {\n name: \"a\",\n subcategories: [],\n },\n ],\n },\n ],\n },\n ],\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":70,"symbol":"Category","kind":"constant","lang":"typescript","code":"const Category = z.object({\n name: z.string(),\n get subcategories() {\n return z.array(Category).optional().nullable();\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":72,"symbol":"subcategories","kind":"method","lang":"typescript","code":"get subcategories() {\n return z.array(Category).optional().nullable();\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":76,"symbol":"Category","kind":"type","lang":"typescript","code":"type Category = z.infer<typeof Category>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":77,"symbol":"_Category","kind":"interface","lang":"typescript","code":"interface _Category {\n name: string;\n subcategories?: _Category[] | undefined | null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":86,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = {\n value: 1,\n next: {\n value: 2,\n next: {\n value: 3,\n next: {\n value: 4,\n next: null,\n },\n },\n },\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":100,"symbol":"LL","kind":"constant","lang":"typescript","code":"const LL = z.object({\n value: z.number(),\n get next() {\n return LL.nullable();\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":102,"symbol":"next","kind":"method","lang":"typescript","code":"get next() {\n return LL.nullable();\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":106,"symbol":"LL","kind":"type","lang":"typescript","code":"type LL = z.infer<typeof LL>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":107,"symbol":"_LL","kind":"type","lang":"typescript","code":"type _LL = {\n value: number;\n next: _LL | null;\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":117,"symbol":"Alazy","kind":"constant","lang":"typescript","code":"const Alazy = z.object({\n val: z.number(),\n get b() {\n return Blazy;\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":119,"symbol":"b","kind":"method","lang":"typescript","code":"get b() {\n return Blazy;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":124,"symbol":"Blazy","kind":"constant","lang":"typescript","code":"const Blazy = z.object({\n val: z.number(),\n get a() {\n return Alazy.optional();\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":126,"symbol":"a","kind":"method","lang":"typescript","code":"get a() {\n return Alazy.optional();\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":130,"symbol":"testData","kind":"constant","lang":"typescript","code":"const testData = {\n val: 1,\n b: {\n val: 5,\n a: {\n val: 3,\n b: {\n val: 4,\n a: {\n val: 2,\n b: {\n val: 1,\n },\n },\n },\n },\n },\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":149,"symbol":"Alazy","kind":"type","lang":"typescript","code":"type Alazy = z.infer<typeof Alazy>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":150,"symbol":"Blazy","kind":"type","lang":"typescript","code":"type Blazy = z.infer<typeof Blazy>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":151,"symbol":"_Alazy","kind":"interface","lang":"typescript","code":"interface _Alazy {\n val: number;\n b: _Blazy;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":155,"symbol":"_Blazy","kind":"interface","lang":"typescript","code":"interface _Blazy {\n val: number;\n a?: _Alazy | undefined;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":168,"symbol":"Category","kind":"constant","lang":"typescript","code":"const Category = z.strictObject({\n name: z.string(),\n get subcategories() {\n return z.array(Category);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":170,"symbol":"subcategories","kind":"method","lang":"typescript","code":"get subcategories() {\n return z.array(Category);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":175,"symbol":"Category","kind":"type","lang":"typescript","code":"type Category = z.infer<typeof Category>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":177,"symbol":"_Category","kind":"interface","lang":"typescript","code":"interface _Category {\n name: string;\n subcategories: _Category[];\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":184,"symbol":"Shape","kind":"type","lang":"typescript","doc":"Shape should not surface `readonly` modifiers from getter-defined keys. object/strictObject/looseObject all pass shape through util.Writeable<T>.","code":"type Shape = (typeof Category)[\"shape\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":187,"symbol":"PickedCategory","kind":"constant","lang":"typescript","code":"const PickedCategory = Category.pick({ name: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":188,"symbol":"OmittedCategory","kind":"constant","lang":"typescript","code":"const OmittedCategory = Category.omit({ subcategories: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":190,"symbol":"picked","kind":"constant","lang":"typescript","code":"const picked = { name: \"test\" };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":191,"symbol":"omitted","kind":"constant","lang":"typescript","code":"const omitted = { name: \"test\" };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":201,"symbol":"Base","kind":"constant","lang":"typescript","code":"const Base = z.object({ name: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":203,"symbol":"Extended","kind":"constant","lang":"typescript","code":"const Extended = Base.extend({\n get sub() {\n return z.array(Extended);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":204,"symbol":"sub","kind":"method","lang":"typescript","code":"get sub() {\n return z.array(Extended);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":208,"symbol":"ExtendedShape","kind":"type","lang":"typescript","code":"type ExtendedShape = (typeof Extended)[\"shape\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":214,"symbol":"SafeExt","kind":"constant","lang":"typescript","code":"const SafeExt = Base.safeExtend({ extra: z.string() } as const);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":215,"symbol":"SafeExtShape","kind":"type","lang":"typescript","code":"type SafeExtShape = (typeof SafeExt)[\"shape\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":221,"symbol":"FromConst","kind":"constant","lang":"typescript","code":"const FromConst = Base.extend({ a: z.string(), b: z.number() } as const);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":222,"symbol":"FromConstShape","kind":"type","lang":"typescript","code":"type FromConstShape = (typeof FromConst)[\"shape\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":229,"symbol":"PartialExtended","kind":"constant","lang":"typescript","code":"const PartialExtended = Extended.partial();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":230,"symbol":"PartialShape","kind":"type","lang":"typescript","code":"type PartialShape = (typeof PartialExtended)[\"shape\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":236,"symbol":"RequiredExtended","kind":"constant","lang":"typescript","code":"const RequiredExtended = Extended.required();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":237,"symbol":"RequiredShape","kind":"type","lang":"typescript","code":"type RequiredShape = (typeof RequiredExtended)[\"shape\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":245,"symbol":"Feature","kind":"constant","lang":"typescript","code":"const Feature = z.object({\n title: z.string(),\n get features(): z.ZodOptional<z.ZodArray<typeof Feature>> {\n return z.optional(z.array(Feature)); //.optional();\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":247,"symbol":"features","kind":"method","lang":"typescript","code":"get features(): z.ZodOptional<z.ZodArray<typeof Feature>> {\n return z.optional(z.array(Feature)); //.optional();\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":253,"symbol":"Output","kind":"constant","lang":"typescript","code":"const Output = z.object({\n id: z.int(), //.nonnegative(),\n name: z.string(),\n get features(): z.ZodArray<typeof Feature> {\n return Feature.array();\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":256,"symbol":"features","kind":"method","lang":"typescript","code":"get features(): z.ZodArray<typeof Feature> {\n return Feature.array();\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":260,"symbol":"Output","kind":"type","lang":"typescript","code":"type Output = z.output<typeof Output>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":262,"symbol":"_Feature","kind":"type","lang":"typescript","code":"type _Feature = {\n title: string;\n features?: _Feature[] | undefined;\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":267,"symbol":"_Output","kind":"type","lang":"typescript","code":"type _Output = {\n id: number;\n name: string;\n features: _Feature[];\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/recursive-types.test.ts","line":278,"symbol":"Slot","kind":"constant","lang":"typescript","code":"const Slot = z.object({\n slotCode: z.string(),\n\n get blocks() {\n return z.array(Block);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/redos.test.ts","line":8,"symbol":"allPatterns","kind":"function","lang":"typescript","doc":"Every pattern `core/regexes.ts` ships, with the parameterized ones materialized across their argument space.","code":"function allPatterns(): [string, RegExp][] {\n const patterns: [string, RegExp][] = [];\n for (const [name, value] of Object.entries(regexes)) {\n if (value instanceof RegExp) patterns.push([name, value]);\n }\n\n patterns.push(\n [\"emoji()\", regexes.emoji()],\n [\"mac()\", regexes.mac()],\n [\"mac('-')\", regexes.mac(\"-\")],\n [\"uuid()\", regexes.uuid()],\n [\"string()\", regexes.string()],\n [\"string({min,max})\", regexes.string({ minimum: 1, maximum: 10 })]\n );\n for (const version of [1, 2, 3, 4, 5, 6, 7, 8]) patterns.push([`uuid(${version})`, regexes.uuid(version)]);\n for (const precision of [null, -1, 0, 3, 6]) {\n patterns.push([`time(${precision})`, regexes.time({ precision })]);\n for (const local of [false, true]) {\n for (const offset of [false, true]) {\n patterns.push([`datetime(${precision},${local},${offset})`, regexes.datetime({ precision, local, offset })]);\n }\n }\n }\n return patterns;\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/redos.test.ts","line":9,"symbol":"patterns","kind":"constant","lang":"typescript","code":"const patterns: [string, RegExp][] = [];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/redos.test.ts","line":35,"symbol":"patterns","kind":"constant","lang":"typescript","code":"const patterns = allPatterns();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/redos.test.ts","line":39,"symbol":"vulnerable","kind":"constant","lang":"typescript","code":"const vulnerable: string[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/redos.test.ts","line":42,"symbol":"result","kind":"constant","lang":"typescript","doc":"Flags are load-bearing. Without \"u\" the checker reads `\\p{...}` as a literal `p{...}` and reports an exponential pattern as safe.","code":"const result = checkSync(pattern.source, pattern.flags);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/redos.test.ts","line":46,"symbol":"confirmed","kind":"constant","lang":"typescript","doc":"The fuzz checker derives \"vulnerable\" from how long an attack string runs, so CPU contention from parallel test files can flip a safe pattern. Confirm with a budget large enough that only real backtracking can exhaust it.","code":"const confirmed = checkSync(pattern.source, pattern.flags, { attackTimeout: 10_000 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/redos.test.ts","line":54,"symbol":"schema","kind":"constant","lang":"typescript","doc":"U+1F9B0-U+1F9B3 are the only code points in both \\p{Extended_Pictographic} and \\p{Emoji_Component}. A failing match over them used to backtrack exponentially: 26 of them took ~1.9s, and each additional character roughly doubled it.","code":"const schema = z.emoji();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/redos.test.ts","line":55,"symbol":"payload","kind":"constant","lang":"typescript","code":"const payload = `${\"🦰\".repeat(26)} `;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/redos.test.ts","line":61,"symbol":"start","kind":"constant","lang":"typescript","code":"const start = performance.now();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":6,"symbol":"obj1","kind":"constant","lang":"typescript","code":"const obj1 = z.object({\n first: z.string(),\n second: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":10,"symbol":"obj2","kind":"constant","lang":"typescript","code":"const obj2 = obj1.partial().strict();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":11,"symbol":"obj3","kind":"constant","lang":"typescript","code":"const obj3 = obj2.refine((data) => data.first || data.second, \"Either first or second should be filled in.\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":18,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n first: z.string(),\n second: z.string(),\n })\n .partial()\n .strict()\n .refine((data) => data.first || data.second, \"Either first or second should be filled in.\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":41,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .object({\n first: z.string(),\n second: z.string(),\n })\n .partial()\n .strict();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":56,"symbol":"validationSchema","kind":"constant","lang":"typescript","code":"const validationSchema = z\n .object({\n email: z.string().email(),\n password: z.string(),\n confirmPassword: z.string(),\n })\n .refine((data) => data.password === data.confirmPassword, \"Both password and confirmation must match\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":64,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = validationSchema.safeParse({\n email: \"aaaa@gmail.com\",\n password: \"aaaaaaaa\",\n confirmPassword: \"bbbbbbbb\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":79,"symbol":"validationSchema","kind":"constant","lang":"typescript","code":"const validationSchema = z\n .object({\n email: z.string().email(),\n password: z.string(),\n confirmPassword: z.string(),\n })\n .refine(\n (data) => Promise.resolve().then(() => data.password === data.confirmPassword),\n \"Both password and confirmation must match\"\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":91,"symbol":"validData","kind":"constant","lang":"typescript","doc":"Should pass with matching passwords","code":"const validData = {\n email: \"aaaa@gmail.com\",\n password: \"password\",\n confirmPassword: \"password\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":112,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .string()\n .superRefine((val, ctx) => {\n if (val.length < 2) {\n ctx.addIssue({\n code: \"custom\",\n message: \"BAD\",\n continue: false,\n });\n }\n })\n .refine((_) => false);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":125,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":134,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .string()\n .superRefine((val, ctx) => {\n if (val.length < 2) {\n ctx.addIssue({\n code: \"custom\",\n fatal: true,\n message: \"BAD\",\n });\n }\n })\n .refine((_) => false);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":147,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":156,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .string()\n .refine((_) => false, { abort: true })\n .refine((_) => false);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":161,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":171,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z\n .object({ password: z.string(), confirm: z.string() })\n .refine((data) => data.confirm === data.password, { path: [\"confirm\"] })\n .safeParse({ password: \"asdf\", confirm: \"qewr\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":185,"symbol":"Strings","kind":"constant","lang":"typescript","code":"const Strings = z.array(z.string()).superRefine((val, ctx) => {\n if (val.length > 3) {\n ctx.addIssue({\n input: val,\n code: \"too_big\",\n origin: \"array\",\n maximum: 3,\n inclusive: true,\n exact: true,\n message: \"Too many items 😡\",\n });\n }\n\n if (val.length !== new Set(val).size) {\n ctx.addIssue({\n input: val,\n code: \"custom\",\n message: `No duplicates allowed.`,\n });\n }\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":208,"symbol":"result","kind":"constant","lang":"typescript","doc":"Should fail with too many items and duplicates","code":"const result = Strings.safeParse([\"asfd\", \"asfd\", \"asfd\", \"asfd\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":217,"symbol":"validArray","kind":"constant","lang":"typescript","doc":"Should pass with valid input","code":"const validArray = [\"asfd\", \"qwer\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":222,"symbol":"Strings","kind":"constant","lang":"typescript","code":"const Strings = z.array(z.string()).superRefine(async (val, ctx) => {\n if (val.length > 3) {\n ctx.addIssue({\n input: val,\n code: \"too_big\",\n origin: \"array\",\n maximum: 3,\n inclusive: true,\n message: \"Too many items 😡\",\n });\n }\n\n if (val.length !== new Set(val).size) {\n ctx.addIssue({\n input: val,\n code: \"custom\",\n message: `No duplicates allowed.`,\n });\n }\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":244,"symbol":"result","kind":"constant","lang":"typescript","doc":"Should fail with too many items and duplicates","code":"const result = await Strings.safeParseAsync([\"asfd\", \"asfd\", \"asfd\", \"asfd\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":251,"symbol":"validArray","kind":"constant","lang":"typescript","doc":"Should pass with valid input","code":"const validArray = [\"asfd\", \"qwer\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":257,"symbol":"defaultContinue","kind":"constant","lang":"typescript","doc":"Default continue behavior - allows subsequent refinements","code":"const defaultContinue = z\n .string()\n .superRefine((_, ctx) => {\n ctx.addIssue({ code: \"custom\", message: \"First issue\" });\n })\n .refine(() => false, \"Second issue\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":283,"symbol":"explicitContinueFalse","kind":"constant","lang":"typescript","doc":"Explicit continue: false - prevents subsequent refinements","code":"const explicitContinueFalse = z\n .string()\n .superRefine((_, ctx) => {\n ctx.addIssue({ code: \"custom\", message: \"First issue\", continue: false });\n })\n .refine(() => false, \"Second issue\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":304,"symbol":"multipleInSame","kind":"constant","lang":"typescript","doc":"Multiple issues in same refinement - both always added regardless of continue","code":"const multipleInSame = z.string().superRefine((_, ctx) => {\n ctx.addIssue({ code: \"custom\", message: \"First\", continue: false });\n ctx.addIssue({ code: \"custom\", message: \"Second\" });\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":329,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().superRefine((_, ctx) => {\n ctx.addIssue(\"bad stuff\");\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":333,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":342,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().superRefine((_, ctx) => {\n ctx.addIssue({ code: \"custom\", message: \"default\" });\n ctx.addIssue({ code: \"custom\", message: \"null\", input: null });\n ctx.addIssue({ code: \"custom\", message: \"undefined\", input: undefined });\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":348,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"sensitive\", { reportInput: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":360,"symbol":"nested","kind":"constant","lang":"typescript","code":"const nested = z.object({ a: z.string().nullable() }).superRefine((val, ctx) => {\n if (val.a === null) ctx.addIssue({ code: \"custom\", path: [\"a\"], input: val.a, message: \"no null\" });\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":364,"symbol":"direct","kind":"constant","lang":"typescript","code":"const direct = nested.safeParse({ a: null }, { reportInput: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":372,"symbol":"inner","kind":"constant","lang":"typescript","doc":"Forwarding a nested parse's issues must not overwrite their input with the outer payload.","code":"const inner = z.object({ x: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":373,"symbol":"forwarding","kind":"constant","lang":"typescript","code":"const forwarding = z.unknown().superRefine((val, ctx) => {\n const result = inner.safeParse(val, { reportInput: true });\n if (!result.success) {\n for (const iss of result.error.issues) {\n ctx.addIssue({ code: \"custom\", path: iss.path, input: iss.input, message: iss.message });\n }\n }\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":374,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = inner.safeParse(val, { reportInput: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":382,"symbol":"forwarded","kind":"constant","lang":"typescript","code":"const forwarded = forwarding.safeParse({}, { reportInput: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":392,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string().optional() }).superRefine((val, ctx) => {\n if (!val.a) ctx.addIssue({ code: \"custom\", path: [\"a\"], input: val.a });\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":396,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({}, { error: (iss) => (iss.input === undefined ? \"Required\" : \"Invalid\") });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":402,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .string()\n .superRefine((val, ctx) => {\n if (val === \"\") {\n ctx.addIssue({\n input: val,\n code: \"custom\",\n message: \"foo\",\n fatal: true,\n });\n }\n })\n .superRefine((val, ctx) => {\n if (val !== \" \") {\n ctx.addIssue({\n input: val,\n code: \"custom\",\n message: \"bar\",\n });\n }\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":424,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":435,"symbol":"objectSchema","kind":"constant","lang":"typescript","code":"const objectSchema = z\n .object({\n length: z.number(),\n size: z.number(),\n })\n .refine(({ length }) => length > 5, {\n path: [\"length\"],\n message: \"length greater than 5\",\n })\n .refine(({ size }) => size > 7, {\n path: [\"size\"],\n message: \"size greater than 7\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":450,"symbol":"r1","kind":"constant","lang":"typescript","doc":"Should fail with one error","code":"const r1 = objectSchema.safeParse({\n length: 4,\n size: 9,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":461,"symbol":"r2","kind":"constant","lang":"typescript","doc":"Should fail with two errors","code":"const r2 = objectSchema.safeParse({\n length: 4,\n size: 3,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":471,"symbol":"validData","kind":"constant","lang":"typescript","doc":"Should pass with valid input","code":"const validData = {\n length: 6,\n size: 8,\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":479,"symbol":"baseSchema","kind":"constant","lang":"typescript","code":"const baseSchema = z.object({\n foo: z.number(),\n bar: z.number(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":484,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = baseSchema.superRefine(\n (data, ctx) => {\n if (data.foo > 10) {\n ctx.addIssue({\n code: \"custom\",\n message: \"foo must be less than 10\",\n });\n }\n },\n {\n when: ({ value }) => baseSchema.pick({ foo: true }).safeParse(value).success,\n }\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":498,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({\n foo: 11,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":511,"symbol":"baseSchema","kind":"constant","lang":"typescript","code":"const baseSchema = z.object({\n foo: z.number(),\n bar: z.number(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":516,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = baseSchema.superRefine(\n (data, ctx) => {\n if (data.foo > 10) {\n ctx.addIssue({\n code: \"custom\",\n message: \"foo must be less than 10\",\n });\n }\n },\n {\n when: ({ value }) => baseSchema.safeParse(value).success,\n }\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":530,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({\n foo: 11,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":544,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().refine((s): s is \"a\" => s === \"a\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":551,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().refine((s) => s.length > 0);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":587,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .strictObject({\n password: z.string().min(8),\n confirmPassword: z.string(),\n other: z.string(),\n })\n .refine(\n (data) => {\n // console.log(\"running check...\");\n // console.log(data);\n // console.log(data.password);\n return data.password === data.confirmPassword;\n },\n {\n message: \"Passwords do not match\",\n path: [\"confirmPassword\"],\n when(payload) {\n if (payload.value === undefined) return false;\n if (payload.value === null) return false;\n // no issues with confirmPassword or password\n return payload.issues.every((iss) => iss.path?.[0] !== \"confirmPassword\" && iss.path?.[0] !== \"password\");\n },\n }\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/refine.test.ts","line":603,"symbol":"when","kind":"method","lang":"typescript","code":"when(payload) {\n if (payload.value === undefined) return false;\n if (payload.value === null) return false;\n // no issues with confirmPassword or password\n return payload.issues.every((iss) => iss.path?.[0] !== \"confirmPassword\" && iss.path?.[0] !== \"password\");\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":5,"symbol":"reg","kind":"constant","lang":"typescript","code":"const reg = z.registry();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":7,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":27,"symbol":"fieldRegistry","kind":"constant","lang":"typescript","code":"const fieldRegistry = z.registry<{ name: string; description: string }>();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":29,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":31,"symbol":"a_meta","kind":"constant","lang":"typescript","code":"const a_meta = fieldRegistry.get(a);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":40,"symbol":"fieldRegistry","kind":"constant","lang":"typescript","code":"const fieldRegistry = z.registry();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":42,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":50,"symbol":"fieldRegistry","kind":"constant","lang":"typescript","code":"const fieldRegistry = z.registry<{ name: string; description: string }, z.ZodString>();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":52,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":94,"symbol":"reg","kind":"constant","lang":"typescript","code":"const reg = z.registry<{ out: z.$output }>();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":95,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":103,"symbol":"reg","kind":"constant","lang":"typescript","code":"const reg = z.registry<{ name: string; examples: z.$output[] }>();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":104,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":113,"symbol":"reg","kind":"constant","lang":"typescript","code":"const reg = z.registry<{ in: z.$input }>();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":114,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.pipe(z.number(), z.transform(String));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":122,"symbol":"reg","kind":"constant","lang":"typescript","code":"const reg = z.registry<{ name: string; examples: z.$input[] }>();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":123,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.pipe(z.number(), z.transform(String));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":132,"symbol":"a1","kind":"constant","lang":"typescript","code":"const a1 = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":133,"symbol":"a2","kind":"constant","lang":"typescript","code":"const a2 = a1.meta({ name: \"hello\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":141,"symbol":"a1","kind":"constant","lang":"typescript","code":"const a1 = z.string().meta({ name: \"hello\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":142,"symbol":"a2","kind":"constant","lang":"typescript","code":"const a2 = a1.optional();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":149,"symbol":"a1","kind":"constant","lang":"typescript","code":"const a1 = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":150,"symbol":"a2","kind":"constant","lang":"typescript","code":"const a2 = a1.describe(\"Hello\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":157,"symbol":"A","kind":"constant","lang":"typescript","code":"const A = z.string().meta({ a: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":159,"symbol":"B","kind":"constant","lang":"typescript","code":"const B = A.meta({ b: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":161,"symbol":"C","kind":"constant","lang":"typescript","code":"const C = B.describe(\"hello\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":172,"symbol":"myReg","kind":"constant","lang":"typescript","code":"const myReg = z.registry<{\n defaulter: (arg: string, test: boolean) => number;\n }>();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":176,"symbol":"mySchema","kind":"constant","lang":"typescript","code":"const mySchema = z.date();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":187,"symbol":"myReg","kind":"constant","lang":"typescript","code":"const myReg = z.registry<{\n defaulter: (arg: z.$input, test: boolean) => z.$output;\n }>();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":191,"symbol":"mySchema","kind":"constant","lang":"typescript","code":"const mySchema = z.string().transform((val) => val.length);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":202,"symbol":"reg","kind":"constant","lang":"typescript","code":"const reg = z.registry();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":203,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":211,"symbol":"reg","kind":"constant","lang":"typescript","code":"const reg = z.registry<z.core.GlobalMeta>();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":212,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":213,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.number();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":223,"symbol":"reg","kind":"constant","lang":"typescript","code":"const reg = z.registry<z.core.GlobalMeta>();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":224,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string().register(reg, { id: \"duplicate-id\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":225,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.number().register(reg, { id: \"duplicate-id\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":227,"symbol":"wrapper","kind":"constant","lang":"typescript","code":"const wrapper = z.object({ a, b });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":235,"symbol":"reg","kind":"constant","lang":"typescript","code":"const reg = z.registry<z.core.GlobalMeta>();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":236,"symbol":"shared","kind":"constant","lang":"typescript","code":"const shared = z.string().register(reg, { id: \"shared-id\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":238,"symbol":"wrapper","kind":"constant","lang":"typescript","code":"const wrapper = z.object({ a: shared, b: shared });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/registries.test.ts","line":241,"symbol":"result","kind":"constant","lang":"typescript","doc":"Should not throw - same schema instance used twice","code":"const result = z.toJSONSchema(wrapper, { metadata: reg });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":4,"symbol":"stringSet","kind":"constant","lang":"typescript","code":"const stringSet = z.set(z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":5,"symbol":"stringSet","kind":"type","lang":"typescript","code":"type stringSet = z.infer<typeof stringSet>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":7,"symbol":"minTwo","kind":"constant","lang":"typescript","code":"const minTwo = z.set(z.string()).min(2);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":8,"symbol":"maxTwo","kind":"constant","lang":"typescript","code":"const maxTwo = z.set(z.string()).max(2);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":9,"symbol":"justTwo","kind":"constant","lang":"typescript","code":"const justTwo = z.set(z.string()).size(2);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":10,"symbol":"nonEmpty","kind":"constant","lang":"typescript","code":"const nonEmpty = z.set(z.string()).nonempty();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":11,"symbol":"nonEmptyMax","kind":"constant","lang":"typescript","code":"const nonEmptyMax = z.set(z.string()).nonempty().max(2);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":18,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringSet.safeParse(new Set([\"first\", \"second\"]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":36,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await stringSet.spa(new Set([\"first\", \"second\"]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":42,"symbol":"asyncResult","kind":"constant","lang":"typescript","code":"const asyncResult = stringSet.safeParse(new Set([\"first\", \"second\"]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":60,"symbol":"sizeZeroResult","kind":"constant","lang":"typescript","code":"const sizeZeroResult = stringSet.parse(new Set());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":63,"symbol":"sizeTwoResult","kind":"constant","lang":"typescript","code":"const sizeTwoResult = minTwo.parse(new Set([\"a\", \"b\"]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":68,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = nonEmpty.safeParse(new Set());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":75,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = minTwo.safeParse(new Set([\"just_one\"]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":82,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = maxTwo.safeParse(new Set([\"one\", \"two\", \"three\"]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":98,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringSet.safeParse(new Set([]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":103,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringSet.safeParse(new Map([]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":118,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringSet.safeParse(new Set([Symbol()]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":134,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = stringSet.safeParse(new Set([1, 2] as any[]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":156,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.set(z.string()).min(4).max(5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":158,"symbol":"r1","kind":"constant","lang":"typescript","code":"const r1 = schema.safeParse(new Set([\"a\", \"b\", \"c\", \"d\"]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":161,"symbol":"r2","kind":"constant","lang":"typescript","code":"const r2 = schema.safeParse(new Set([\"a\", \"b\", \"c\"]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/set.test.ts","line":176,"symbol":"r3","kind":"constant","lang":"typescript","code":"const r3 = schema.safeParse(new Set([\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":6,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":7,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await schema[\"~standard\"].validate(12);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":23,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":24,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await schema[\"~standard\"].validate(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":33,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().refine(async (val) => val.length > 5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":34,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await schema[\"~standard\"].validate(12);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":50,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().refine(async (val) => val.length > 5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":51,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await schema[\"~standard\"].validate(\"234134134\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":60,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.codec(z.string(), z.number(), {\n decode: (str) => Number.parseFloat(str),\n encode: (num) => num.toString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":85,"symbol":"codec","kind":"constant","lang":"typescript","code":"const codec = z.codec(z.string(), z.number(), {\n decode: (str) => Number.parseFloat(str),\n encode: (num) => num.toString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":89,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = codec.toJSONSchema();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":111,"symbol":"codec","kind":"constant","lang":"typescript","code":"const codec = z.codec(z.string(), z.number(), {\n decode: (str) => Number.parseFloat(str),\n encode: (num) => num.toString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":115,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.toJSONSchema(codec);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":137,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ name: z.string().min(3), age: z.number().refine(async (n) => n > 0) });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":138,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = { name: \"ab\", age: -1 };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":139,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = (await schema[\"~standard\"].validate(input)) as { issues: unknown[] };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":142,"symbol":"sync","kind":"constant","lang":"typescript","code":"const sync = z.string().min(3)[\"~standard\"].validate(\"ab\") as { issues: unknown[] };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":147,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().refine(() => {\n throw new Error(\"boom\");\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/standard-schema.test.ts","line":150,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema[\"~standard\"].validate(\"abc\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string-formats.test.ts","line":6,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.email().min(10);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string-formats.test.ts","line":7,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.email().max(10);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string-formats.test.ts","line":8,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.email().length(10);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string-formats.test.ts","line":9,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = z.email().uppercase();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string-formats.test.ts","line":10,"symbol":"e","kind":"constant","lang":"typescript","code":"const e = z.email().lowercase();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string-formats.test.ts","line":34,"symbol":"ccRegex","kind":"constant","lang":"typescript","code":"const ccRegex = /^(?:\\d{14,19}|\\d{4}(?: \\d{3,6}){2,4}|\\d{4}(?:-\\d{3,6}){2,4})$/u;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string-formats.test.ts","line":36,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z\n .stringFormat(\"creditCard\", (val) => ccRegex.test(val), {\n error: `Invalid credit card number`,\n })\n .refine((_) => false, \"Also bad\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string-formats.test.ts","line":74,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z\n .stringFormat(\"creditCard\", ccRegex, {\n abort: true,\n error: `Invalid credit card number`,\n })\n .refine((_) => false, \"Also bad\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string-formats.test.ts","line":112,"symbol":"hexSchema","kind":"constant","lang":"typescript","code":"const hexSchema = z.hex();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":6,"symbol":"minFive","kind":"constant","lang":"typescript","code":"const minFive = z.string().min(5, \"min5\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":7,"symbol":"maxFive","kind":"constant","lang":"typescript","code":"const maxFive = z.string().max(5, \"max5\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":8,"symbol":"justFive","kind":"constant","lang":"typescript","code":"const justFive = z.string().length(5);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":9,"symbol":"nonempty","kind":"constant","lang":"typescript","code":"const nonempty = z.string().min(1, \"nonempty\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":10,"symbol":"includes","kind":"constant","lang":"typescript","code":"const includes = z.string().includes(\"includes\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":11,"symbol":"includesFromIndex2","kind":"constant","lang":"typescript","code":"const includesFromIndex2 = z.string().includes(\"includes\", { position: 2 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":12,"symbol":"startsWith","kind":"constant","lang":"typescript","code":"const startsWith = z.string().startsWith(\"startsWith\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":13,"symbol":"endsWith","kind":"constant","lang":"typescript","code":"const endsWith = z.string().endsWith(\"endsWith\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":16,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string({ checks: [z.minLength(1), z.maxLength(3)] as const });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":17,"symbol":"chained","kind":"constant","lang":"typescript","code":"const chained = z.string().min(1).max(3);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":28,"symbol":"extended","kind":"constant","lang":"typescript","code":"const extended = schema.max(2);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":32,"symbol":"coerce","kind":"constant","lang":"typescript","code":"const coerce = z.coerce.string({ checks: [z.minLength(2)] });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":35,"symbol":"asyncSchema","kind":"constant","lang":"typescript","code":"const asyncSchema = z.string({\n checks: [\n z.check<string>(async (ctx) => {\n if (ctx.value !== \"ok\") ctx.issues.push({ code: \"custom\", input: ctx.value });\n }),\n ],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":51,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = factory({ checks: initial });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":53,"symbol":"getterSchema","kind":"constant","lang":"typescript","code":"const getterSchema = factory({\n get checks() {\n if (++reads > 1) throw new Error(\"checks read twice\");\n return initial;\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":54,"symbol":"checks","kind":"method","lang":"typescript","code":"get checks() {\n if (++reads > 1) throw new Error(\"checks read twice\");\n return initial;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":61,"symbol":"before","kind":"constant","lang":"typescript","code":"const before = z.toJSONSchema(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":96,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().includes(\"test\", \"must contain test\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":125,"symbol":"validEmails","kind":"constant","lang":"typescript","code":"const validEmails = [\n `email@domain.com`,\n `firstname.lastname@domain.com`,\n `email@subdomain.domain.com`,\n `firstname+lastname@domain.com`,\n `1234567890@domain.com`,\n `email@domain-one.com`,\n `_______@domain.com`,\n `email@domain.name`,\n `email@domain.co.jp`,\n `firstname-lastname@domain.com`,\n `very.common@example.com`,\n `disposable.style.email.with+symbol@example.com`,\n `other.email-with-hyphen@example.com`,\n `fully-qualified-domain@example.com`,\n `user.name+tag+sorting@example.com`,\n `x@example.com`,\n `mojojojo@asdf.example.com`,\n `example-indeed@strange-example.com`,\n `example@s.example`,\n `user-@example.org`,\n `user@my-example.com`,\n `a@b.cd`,\n `work+user@mail.com`,\n `tom@test.te-st.com`,\n `something@subdomain.domain-with-hyphens.tld`,\n `common'name@domain.com`,\n `francois@etu.inp-n7.fr`,\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":154,"symbol":"invalidEmails","kind":"constant","lang":"typescript","code":"const invalidEmails = [\n // no \"printable characters\"\n // `user%example.com@example.org`,\n // `mailhost!username@example.org`,\n // `test/test@test.com`,\n\n // double @\n `francois@@etu.inp-n7.fr`,\n // do not support quotes\n `\"email\"@domain.com`,\n `\"e asdf sadf ?<>ail\"@domain.com`,\n `\" \"@example.org`,\n `\"john..doe\"@example.org`,\n `\"very.(),:;<>[]\\\".VERY.\\\"very@\\\\ \\\"very\\\".unusual\"@strange.example.com`,\n // do not support comma\n `a,b@domain.com`,\n\n // do not support IPv4\n `email@123.123.123.123`,\n `email@[123.123.123.123]`,\n `postmaster@123.123.123.123`,\n `user@[68.185.127.196]`,\n `ipv4@[85.129.96.247]`,\n `valid@[79.208.229.53]`,\n `valid@[255.255.255.255]`,\n `valid@[255.0.55.2]`,\n `valid@[255.0.55.2]`,\n\n // do not support ipv6\n `hgrebert0@[IPv6:4dc8:ac7:ce79:8878:1290:6098:5c50:1f25]`,\n `bshapiro4@[IPv6:3669:c709:e981:4884:59a3:75d1:166b:9ae]`,\n `jsmith@[IPv6:2001:db8::1]`,\n `postmaster@[IPv6:2001:0db8:85a3:0000:0000:8a2e:0370:7334]`,\n `postmaster@[IPv6:2001:0db8:85a3:0000:0000:8a2e:0370:192.168.1.1]`,\n\n // microsoft test cases\n `plainaddress`,\n `#@%^%#$@#$@#.com`,\n `@domain.com`,\n "} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":237,"symbol":"emailSchema","kind":"constant","lang":"typescript","code":"const emailSchema = z.string().email();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":252,"symbol":"validBase64Strings","kind":"constant","lang":"typescript","code":"const validBase64Strings = [\n \"SGVsbG8gV29ybGQ=\", // \"Hello World\"\n \"VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==\", // \"This is an encoded string\"\n \"TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcms=\", // \"Many hands make light work\"\n \"UGF0aWVuY2UgaXMgdGhlIGtleSB0byBzdWNjZXNz\", // \"Patience is the key to success\"\n \"QmFzZTY0IGVuY29kaW5nIGlzIGZ1bg==\", // \"Base64 encoding is fun\"\n \"MTIzNDU2Nzg5MA==\", // \"1234567890\"\n \"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo=\", // \"abcdefghijklmnopqrstuvwxyz\"\n \"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo=\", // \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n \"ISIkJSMmJyonKCk=\", // \"!\\\"#$%&'()*\"\n \"\", // Empty string is technically a valid base64\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":269,"symbol":"invalidBase64Strings","kind":"constant","lang":"typescript","code":"const invalidBase64Strings = [\n \"12345\", // Not padded correctly, not a multiple of 4 characters\n \"SGVsbG8gV29ybGQ\", // Missing padding\n \"VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw\", // Missing padding\n \"!UGF0aWVuY2UgaXMgdGhlIGtleSB0byBzdWNjZXNz\", // Invalid character '!'\n \"?QmFzZTY0IGVuY29kaW5nIGlzIGZ1bg==\", // Invalid character '?'\n \".MTIzND2Nzg5MC4=\", // Invalid character '.'\n \"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo\", // Missing padding\n // Whitespace is not part of canonical base64 (RFC 4648 §3.3) — atob() strips whitespace internally before validating, so the length check alone would accept \"123 \" etc.\n \"123 \", // bypasses length-mod-4 via trailing whitespace\n \"SGVsbG8gV29ybGQ= \", // trailing space\n \" SGVsbG8gV29ybGQ=\", // leading space\n \"SGVsbG8gV29ybGQ=\\n\", // trailing newline\n \"SGVs bG8gV29ybGQ=\", // internal space\n \"SGVs\\nbG8gV29ybGQ=\", // internal newline\n \"SGVs\\tbG8gV29ybGQ=\", // internal tab\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":293,"symbol":"base64url","kind":"constant","lang":"typescript","code":"const base64url = z.string().base64url();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":295,"symbol":"validBase64URLStrings","kind":"constant","lang":"typescript","code":"const validBase64URLStrings = [\n \"SGVsbG8gV29ybGQ\", // \"Hello World\"\n\n \"VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw\", // \"This is an encoded string\"\n\n \"TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcms\", // \"Many hands make light work\"\n\n \"UGF0aWVuY2UgaXMgdGhlIGtleSB0byBzdWNjZXNz\", // \"Patience is the key to success\"\n \"QmFzZTY0IGVuY29kaW5nIGlzIGZ1bg\", // \"Base64 encoding is fun\"\n\n \"MTIzNDU2Nzg5MA\", // \"1234567890\"\n\n \"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo\", // \"abcdefghijklmnopqrstuvwxyz\"\n\n \"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo\", // \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n\n \"ISIkJSMmJyonKCk\", // \"!\\\"#$%&'()*\"\n\n \"\", // Empty string is technically valid base64url\n \"w7_Dv8O-w74K\", // ÿÿþþ\n \"123456\",\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":322,"symbol":"invalidBase64URLStrings","kind":"constant","lang":"typescript","code":"const invalidBase64URLStrings = [\n \"w7/Dv8O+w74K\", // Has + and / characters (is base64)\n \"A\", // Invalid length (1 mod 4 carries no whole byte)\n \"12345\", // Invalid length (not a multiple of 4 characters when adding allowed number of padding characters)\n \"12345===\", // Not padded correctly\n \"!UGF0aWVuY2UgaXMgdGhlIGtleSB0byBzdWNjZXNz\", // Invalid character '!'\n \"?QmFzZTY0IGVuY29kaW5nIGlzIGZ1bg==\", // Invalid character '?'\n \".MTIzND2Nzg5MC4=\", // Invalid character '.'\n\n // disallow valid padding\n \"SGVsbG8gV29ybGQ=\", // \"Hello World\" with padding\n \"VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==\", // \"This is an encoded string\" with padding\n \"TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcms=\", // \"Many hands make light work\" with padding\n \"QmFzZTY0IGVuY29kaW5nIGlzIGZ1bg==\", // \"Base64 encoding is fun\" with padding\n \"MTIzNDU2Nzg5MA==\", // \"1234567890\" with padding\n \"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo=\", // \"abcdefghijklmnopqrstuvwxyz with padding\"\n \"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo=\", // \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" with padding\n \"ISIkJSMmJyonKCk=\", // \"!\\\"#$%&'()*\" with padding\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":348,"symbol":"bigbase64","kind":"constant","lang":"typescript","code":"const bigbase64 = randomBytes(1024 * 1024 * 10).toString(\"base64\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":350,"symbol":"bigbase64url","kind":"constant","lang":"typescript","code":"const bigbase64url = randomBytes(1024 * 1024 * 10).toString(\"base64url\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":360,"symbol":"tl","kind":"constant","lang":"typescript","doc":"the ^$| alternation in regexes.base64 used to leak: \"AAAA\" matched with the prefix dropped and \"id-AAAA\" was rejected","code":"const tl = z.templateLiteral([\"id-\", z.base64()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":366,"symbol":"makeJwt","kind":"function","lang":"typescript","code":"function makeJwt(header: object, payload: object) {\n const headerBase64 = Buffer.from(JSON.stringify(header)).toString(\"base64url\");\n const payloadBase64 = Buffer.from(JSON.stringify(payload)).toString(\"base64url\");\n const signature = \"signature\"; // Placeholder for the signature\n return `${headerBase64}.${payloadBase64}.${signature}`;\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":367,"symbol":"headerBase64","kind":"constant","lang":"typescript","code":"const headerBase64 = Buffer.from(JSON.stringify(header)).toString(\"base64url\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":368,"symbol":"payloadBase64","kind":"constant","lang":"typescript","code":"const payloadBase64 = Buffer.from(JSON.stringify(payload)).toString(\"base64url\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":369,"symbol":"signature","kind":"constant","lang":"typescript","code":"const signature = \"signature\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":374,"symbol":"jwt","kind":"constant","lang":"typescript","code":"const jwt = z.string().jwt();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":380,"symbol":"es256jwt","kind":"constant","lang":"typescript","doc":"Valid JWTs","code":"const es256jwt = z.string().jwt({ alg: \"ES256\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":381,"symbol":"d1","kind":"constant","lang":"typescript","code":"const d1 = makeJwt({ typ: \"JWT\", alg: \"ES256\" }, {});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":386,"symbol":"d2","kind":"constant","lang":"typescript","doc":"Invalid header","code":"const d2 = makeJwt({}, {});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":390,"symbol":"d3","kind":"constant","lang":"typescript","doc":"Wrong algorithm","code":"const d3 = makeJwt({ typ: \"JWT\", alg: \"RS256\" }, {});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":394,"symbol":"d4","kind":"constant","lang":"typescript","doc":"missing typ is fine","code":"const d4 = makeJwt({ alg: \"HS256\" }, {});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":398,"symbol":"d5","kind":"constant","lang":"typescript","doc":"type isn't JWT","code":"const d5 = makeJwt({ typ: \"SUP\", alg: \"HS256\" }, { foo: \"bar\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":403,"symbol":"url","kind":"constant","lang":"typescript","code":"const url = z.string().url();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":421,"symbol":"url","kind":"constant","lang":"typescript","code":"const url = z.string().url();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":424,"symbol":"input","kind":"constant","lang":"typescript","doc":"Test the specific case from the user report","code":"const input = \"https://example.com?key=NUXOmHqWNVTapJkJJHw8BfD155AuqhH_qju_5fNmQ4ZHV7u8\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":425,"symbol":"output","kind":"constant","lang":"typescript","code":"const output = url.parse(input);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":444,"symbol":"url","kind":"constant","lang":"typescript","code":"const url = z.string().url();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":485,"symbol":"result","kind":"constant","lang":"typescript","doc":"A rejection has to surface as an issue, not just success: false.","code":"const result = z.ipv6().safeParse(\"::1\\n\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":496,"symbol":"normalizeUrl","kind":"constant","lang":"typescript","code":"const normalizeUrl = z.url({ normalize: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":497,"symbol":"preserveUrl","kind":"constant","lang":"typescript","code":"const preserveUrl = z.url();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":521,"symbol":"constrainedNormalizeUrl","kind":"constant","lang":"typescript","code":"const constrainedNormalizeUrl = z.url({\n normalize: true,\n protocol: /^https$/,\n hostname: /^example\\.com$/,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":536,"symbol":"httpUrl","kind":"constant","lang":"typescript","code":"const httpUrl = z.url({\n protocol: /^https?$/,\n hostname: z.regexes.domain,\n // /^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,63}$/\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":574,"symbol":"longHost","kind":"constant","lang":"typescript","doc":"total host length over the RFC 1035 limit of 253 chars (built from valid-length labels)","code":"const longHost = `${`${\"a\".repeat(50)}.`.repeat(5)}com`;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":580,"symbol":"maxHost","kind":"constant","lang":"typescript","doc":"a host at exactly the 253-char limit is still accepted, one char more is not","code":"const maxHost = `${`${\"a\".repeat(61)}.`.repeat(4)}aaaaa`;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":610,"symbol":"emoji","kind":"constant","lang":"typescript","code":"const emoji = z.string().emoji();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":640,"symbol":"nanoid","kind":"constant","lang":"typescript","code":"const nanoid = z.string().nanoid(\"custom error\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":645,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = nanoid.safeParse(\"Xq90uDyhddC53KsoASYJGX\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":664,"symbol":"nanoid","kind":"constant","lang":"typescript","code":"const nanoid = z.string().nanoid(\"custom error\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":666,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = nanoid.safeParse(\"invalid nanoid\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":685,"symbol":"uuid","kind":"constant","lang":"typescript","code":"const uuid = z.string().uuid(\"custom error\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":686,"symbol":"goodUuids","kind":"constant","lang":"typescript","code":"const goodUuids = [\n \"9491d710-3185-1e06-bea0-6a2f275345e0\",\n \"9491d710-3185-2e06-bea0-6a2f275345e0\",\n \"9491d710-3185-3e06-bea0-6a2f275345e0\",\n \"9491d710-3185-4e06-bea0-6a2f275345e0\",\n \"9491d710-3185-5e06-bea0-6a2f275345e0\",\n \"9491d710-3185-5e06-aea0-6a2f275345e0\",\n \"9491d710-3185-5e06-8ea0-6a2f275345e0\",\n \"9491d710-3185-5e06-9ea0-6a2f275345e0\",\n \"00000000-0000-0000-0000-000000000000\",\n \"ffffffff-ffff-ffff-ffff-ffffffffffff\",\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/string.test.ts","line":700,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = uuid.safeParse(goodUuid);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/stringbool.test.ts","line":5,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.stringbool();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/stringbool.test.ts","line":6,"symbol":"a","kind":"type","lang":"typescript","code":"type a = z.infer<typeof a>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/stringbool.test.ts","line":8,"symbol":"a_in","kind":"type","lang":"typescript","code":"type a_in = z.input<typeof a>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/stringbool.test.ts","line":36,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.stringbool({\n truthy: [\"y\"],\n falsy: [\"N\"],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/stringbool.test.ts","line":49,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.stringbool({\n truthy: [\"y\"],\n falsy: [\"N\"],\n case: \"sensitive\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/stringbool.test.ts","line":63,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.stringbool(\"wrong!\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/stringbool.test.ts","line":69,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.stringbool();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/stringbool.test.ts","line":77,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.stringbool({\n truthy: [\"yes\", \"on\", \"1\"],\n falsy: [\"no\", \"off\", \"0\"],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/stringbool.test.ts","line":88,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.stringbool({\n truthy: [\"enabled\", \"active\"],\n falsy: [\"disabled\", \"inactive\"],\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/stringbool.test.ts","line":94,"symbol":"decoded","kind":"constant","lang":"typescript","doc":"Test round trip: string -> boolean -> string","code":"const decoded = z.decode(schema, \"enabled\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/stringbool.test.ts","line":97,"symbol":"encoded","kind":"constant","lang":"typescript","code":"const encoded = z.encode(schema, decoded);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/stringbool.test.ts","line":101,"symbol":"decodedFalse","kind":"constant","lang":"typescript","doc":"Test with falsy value","code":"const decodedFalse = z.decode(schema, \"inactive\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/stringbool.test.ts","line":104,"symbol":"encodedFalse","kind":"constant","lang":"typescript","code":"const encodedFalse = z.encode(schema, decodedFalse);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/stringbool.test.ts","line":109,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.stringbool();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/stringbool.test.ts","line":115,"symbol":"b","kind":"constant","lang":"typescript","doc":"values are normalized when case-insensitive","code":"const b = z.stringbool({ truthy: [\"Y\", \"yes\"], falsy: [\"N\"] });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/stringbool.test.ts","line":120,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.stringbool({ truthy: [\"Y\"], falsy: [\"N\"], case: \"sensitive\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":4,"symbol":"empty","kind":"constant","lang":"typescript","code":"const empty = z.templateLiteral([]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":5,"symbol":"hello","kind":"constant","lang":"typescript","code":"const hello = z.templateLiteral([\"hello\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":6,"symbol":"world","kind":"constant","lang":"typescript","code":"const world = z.templateLiteral([\"\", z.literal(\"world\")]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":7,"symbol":"one","kind":"constant","lang":"typescript","code":"const one = z.templateLiteral([1]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":8,"symbol":"two","kind":"constant","lang":"typescript","code":"const two = z.templateLiteral([\"\", z.literal(2)]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":9,"symbol":"onePointOne","kind":"constant","lang":"typescript","code":"const onePointOne = z.templateLiteral([z.literal(1.1)]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":10,"symbol":"truee","kind":"constant","lang":"typescript","code":"const truee = z.templateLiteral([true]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":11,"symbol":"anotherTrue","kind":"constant","lang":"typescript","code":"const anotherTrue = z.templateLiteral([\"\", z.literal(true)]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":12,"symbol":"falsee","kind":"constant","lang":"typescript","code":"const falsee = z.templateLiteral([false]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":13,"symbol":"anotherFalse","kind":"constant","lang":"typescript","code":"const anotherFalse = z.templateLiteral([\"\", z.literal(false)]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":14,"symbol":"nulll","kind":"constant","lang":"typescript","code":"const nulll = z.templateLiteral([null]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":15,"symbol":"anotherNull","kind":"constant","lang":"typescript","code":"const anotherNull = z.templateLiteral([\"\", z.null()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":16,"symbol":"undefinedd","kind":"constant","lang":"typescript","code":"const undefinedd = z.templateLiteral([undefined]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":17,"symbol":"anotherUndefined","kind":"constant","lang":"typescript","code":"const anotherUndefined = z.templateLiteral([\"\", z.undefined()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":18,"symbol":"anyString","kind":"constant","lang":"typescript","code":"const anyString = z.templateLiteral([\"\", z.string()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":19,"symbol":"lazyString","kind":"constant","lang":"typescript","code":"const lazyString = z.templateLiteral([\"\", z.lazy(() => z.string())]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":20,"symbol":"anyNumber","kind":"constant","lang":"typescript","code":"const anyNumber = z.templateLiteral([\"\", z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":21,"symbol":"anyInt","kind":"constant","lang":"typescript","code":"const anyInt = z.templateLiteral([\"\", z.number().int()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":27,"symbol":"bool","kind":"constant","lang":"typescript","doc":"const anyFiniteNumber = z.templateLiteral([\"\", z.number().finite()]); const anyNegativeNumber = z.templateLiteral([\"\", z.number().negative()]); const anyPositiveNumber = z.templateLiteral([\"\", z.number().positive()]); const zeroButInADumbWay = z.templateLiteral([\"\", z.number().nonnegative().nonpositive()]); const finiteButInADumbWay = z.templateLiteral([\"\", z.number().min(5).max(10)]);","code":"const bool = z.templateLiteral([\"\", z.boolean()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":28,"symbol":"bigone","kind":"constant","lang":"typescript","code":"const bigone = z.templateLiteral([\"\", z.literal(BigInt(1))]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":29,"symbol":"anyBigint","kind":"constant","lang":"typescript","code":"const anyBigint = z.templateLiteral([\"\", z.bigint()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":30,"symbol":"nullableYo","kind":"constant","lang":"typescript","code":"const nullableYo = z.templateLiteral([\"\", z.nullable(z.literal(\"yo\"))]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":31,"symbol":"nullableString","kind":"constant","lang":"typescript","code":"const nullableString = z.templateLiteral([\"\", z.nullable(z.string())]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":32,"symbol":"optionalYeah","kind":"constant","lang":"typescript","code":"const optionalYeah = z.templateLiteral([\"\", z.literal(\"yeah\").optional()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":34,"symbol":"optionalString","kind":"constant","lang":"typescript","code":"const optionalString = z.templateLiteral([\"\", z.string().optional()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":35,"symbol":"optionalNumber","kind":"constant","lang":"typescript","code":"const optionalNumber = z.templateLiteral([\"\", z.number().optional()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":36,"symbol":"nullishBruh","kind":"constant","lang":"typescript","code":"const nullishBruh = z.templateLiteral([\"\", z.literal(\"bruh\").nullish()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":37,"symbol":"nullishString","kind":"constant","lang":"typescript","code":"const nullishString = z.templateLiteral([\"\", z.string().nullish()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":38,"symbol":"cuid","kind":"constant","lang":"typescript","code":"const cuid = z.templateLiteral([\"\", z.string().cuid()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":39,"symbol":"cuidZZZ","kind":"constant","lang":"typescript","code":"const cuidZZZ = z.templateLiteral([\"\", z.string().cuid(), \"ZZZ\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":40,"symbol":"cuid2","kind":"constant","lang":"typescript","code":"const cuid2 = z.templateLiteral([\"\", z.string().cuid2()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":41,"symbol":"datetime","kind":"constant","lang":"typescript","code":"const datetime = z.templateLiteral([\"\", z.string().datetime()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":42,"symbol":"email","kind":"constant","lang":"typescript","code":"const email = z.templateLiteral([\"\", z.string().email()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":44,"symbol":"ipv4","kind":"constant","lang":"typescript","doc":"const ip = z.templateLiteral([\"\", z.string().ip()]);","code":"const ipv4 = z.templateLiteral([\"\", z.string().ipv4()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":45,"symbol":"ipv6","kind":"constant","lang":"typescript","code":"const ipv6 = z.templateLiteral([\"\", z.string().ipv6()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":46,"symbol":"mac","kind":"constant","lang":"typescript","code":"const mac = z.templateLiteral([\"\", z.mac()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":47,"symbol":"ulid","kind":"constant","lang":"typescript","code":"const ulid = z.templateLiteral([\"\", z.string().ulid()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":48,"symbol":"uuid","kind":"constant","lang":"typescript","code":"const uuid = z.templateLiteral([\"\", z.string().uuid()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":49,"symbol":"stringAToZ","kind":"constant","lang":"typescript","code":"const stringAToZ = z.templateLiteral([\"\", z.string().regex(/^[a-z]+$/)]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":50,"symbol":"stringStartsWith","kind":"constant","lang":"typescript","code":"const stringStartsWith = z.templateLiteral([\"\", z.string().startsWith(\"hello\")]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":51,"symbol":"stringEndsWith","kind":"constant","lang":"typescript","code":"const stringEndsWith = z.templateLiteral([\"\", z.string().endsWith(\"world\")]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":52,"symbol":"stringMax5","kind":"constant","lang":"typescript","code":"const stringMax5 = z.templateLiteral([\"\", z.string().max(5)]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":53,"symbol":"stringMin5","kind":"constant","lang":"typescript","code":"const stringMin5 = z.templateLiteral([\"\", z.string().min(5)]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":54,"symbol":"stringLen5","kind":"constant","lang":"typescript","code":"const stringLen5 = z.templateLiteral([\"\", z.string().length(5)]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":55,"symbol":"stringMin5Max10","kind":"constant","lang":"typescript","code":"const stringMin5Max10 = z.templateLiteral([\"\", z.string().min(5).max(10)]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":56,"symbol":"stringStartsWithMax5","kind":"constant","lang":"typescript","code":"const stringStartsWithMax5 = z.templateLiteral([\"\", z.string().startsWith(\"hello\").max(5)]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":57,"symbol":"brandedString","kind":"constant","lang":"typescript","code":"const brandedString = z.templateLiteral([\"\", z.string().min(1).brand(\"myBrand\")]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":60,"symbol":"url","kind":"constant","lang":"typescript","code":"const url = z.templateLiteral([\"https://\", z.string().regex(/\\w+/), \".\", z.enum([\"com\", \"net\"])]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":62,"symbol":"measurement","kind":"constant","lang":"typescript","code":"const measurement = z.templateLiteral([\n \"\",\n z.number().finite(),\n z.enum([\"px\", \"em\", \"rem\", \"vh\", \"vw\", \"vmin\", \"vmax\"]).optional(),\n]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":67,"symbol":"decimalEnum","kind":"constant","lang":"typescript","code":"const decimalEnum = z.templateLiteral([\"\", z.enum({ A: 1.2 })]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":69,"symbol":"exponentEnum","kind":"constant","lang":"typescript","doc":"String(1e21) is \"1e+21\" — the `+` needs escaping too, or the pattern rejects its own enum value","code":"const exponentEnum = z.templateLiteral([\"\", z.enum({ A: 1e21 })]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":71,"symbol":"connectionString","kind":"constant","lang":"typescript","code":"const connectionString = z.templateLiteral([\n \"mongodb://\",\n z\n .templateLiteral([\n \"\",\n z.string().regex(/\\w+/).describe(\"username\"),\n \":\",\n z.string().regex(/\\w+/).describe(\"password\"),\n \"@\",\n ])\n .optional(),\n z.string().regex(/\\w+/).describe(\"host\"),\n \":\",\n z.number().finite().int().positive().describe(\"port\"),\n z\n .templateLiteral([\n \"/\",\n z.string().regex(/\\w+/).optional().describe(\"defaultauthdb\"),\n z\n .templateLiteral([\n \"?\",\n z\n .string()\n .regex(/^\\w+=\\w+(&\\w+=\\w+)*$/)\n .optional()\n .describe(\"options\"),\n ])\n .optional(),\n ])\n .optional(),\n]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":784,"symbol":"wrapped","kind":"constant","lang":"typescript","doc":"a constrained string keeps its bounds under a wrapper and inside a union","code":"const wrapped = z.templateLiteral([\"a-\", z.string().min(2).max(3).optional()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":790,"symbol":"union","kind":"constant","lang":"typescript","code":"const union = z.templateLiteral([\"\", z.union([z.string().regex(/^[a-c]+$/), z.number().int()])]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":797,"symbol":"empty","kind":"constant","lang":"typescript","doc":"an empty length range matches nothing rather than building an invalid quantifier","code":"const empty = z.templateLiteral([\"\", z.string().min(8).length(5)]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":801,"symbol":"lazy","kind":"constant","lang":"typescript","doc":"lazy resolves its inner schema on the internals, not the def","code":"const lazy = z.templateLiteral([\"\", z.lazy(() => z.string().min(2)).optional()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/template-literal.test.ts","line":807,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.templateLiteral([z.email(), \"|\", z.string()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema-methods.test.ts","line":5,"symbol":"expectMethodMatch","kind":"function","lang":"typescript","doc":"Utility functions","code":"function expectMethodMatch(schema: z.ZodType, params?: z.core.ToJSONSchemaParams): void {\n const staticResult = z.toJSONSchema(schema, params);\n const methodResult = schema.toJSONSchema(params);\n expect(methodResult).toEqual(staticResult);\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema-methods.test.ts","line":6,"symbol":"staticResult","kind":"constant","lang":"typescript","code":"const staticResult = z.toJSONSchema(schema, params);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema-methods.test.ts","line":7,"symbol":"methodResult","kind":"constant","lang":"typescript","code":"const methodResult = schema.toJSONSchema(params);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema-methods.test.ts","line":223,"symbol":"Colors","kind":"type","lang":"typescript","code":"enum Colors {\n Red = \"red\",\n Green = \"green\",\n Blue = \"blue\",\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema-methods.test.ts","line":339,"symbol":"Node","kind":"type","lang":"typescript","code":"type Node = {\n value: string;\n children?: Node[] | undefined;\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema-methods.test.ts","line":343,"symbol":"Node","kind":"constant","lang":"typescript","code":"const Node: z.ZodType<Node> = z.lazy(() =>\n z.object({\n value: z.string(),\n children: z.array(Node).optional(),\n })\n ) as z.ZodType<Node>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema-methods.test.ts","line":399,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n name: z.string(),\n get subcategories() {\n return z.array(schema);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema-methods.test.ts","line":401,"symbol":"subcategories","kind":"method","lang":"typescript","code":"get subcategories() {\n return z.array(schema);\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema-methods.test.ts","line":411,"symbol":"shared","kind":"constant","lang":"typescript","code":"const shared = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema-methods.test.ts","line":412,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n a: shared,\n b: shared,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema-methods.test.ts","line":422,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string().meta({ id: \"hi\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema-methods.test.ts","line":427,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string().meta({ id: \"hi2\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema-methods.test.ts","line":428,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = a.meta({ name: \"asdf\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema-methods.test.ts","line":433,"symbol":"inner","kind":"constant","lang":"typescript","code":"const inner = z.string().meta({ id: \"inner\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema-methods.test.ts","line":434,"symbol":"outer","kind":"constant","lang":"typescript","code":"const outer = z.object({ value: inner });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":6,"symbol":"openAPI30Validator","kind":"constant","lang":"typescript","code":"const openAPI30Validator = new Validator();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":8,"symbol":"validateOpenAPI30Schema","kind":"constant","lang":"typescript","doc":"@see https://github.com/colinhacks/zod/issues/5147","code":"const validateOpenAPI30Schema = async (zodJSONSchema: Record<string, unknown>): Promise<true> => {\n const res = await openAPI30Validator.validate({\n openapi: \"3.0.0\",\n info: {\n title: \"SampleApi\",\n description: \"Sample backend service\",\n version: \"1.0.0\",\n },\n components: { schemas: { test: zodJSONSchema } },\n paths: {},\n });\n\n if (!res.valid) {\n // `console.error` should make `vitest` trow an unhandled error printing the validation messages in consoles\n console.error(\n `OpenAPI schema is not valid against ${openAPI30Validator.version}`,\n JSON.stringify(res.errors, null, 2)\n );\n }\n\n return true;\n};"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":9,"symbol":"res","kind":"constant","lang":"typescript","code":"const res = await openAPI30Validator.validate({\n openapi: \"3.0.0\",\n info: {\n title: \"SampleApi\",\n description: \"Sample backend service\",\n version: \"1.0.0\",\n },\n components: { schemas: { test: zodJSONSchema } },\n paths: {},\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":339,"symbol":"transformSchema","kind":"constant","lang":"typescript","doc":"Transform","code":"const transformSchema = z.string().transform((val) => Number.parseInt(val));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":343,"symbol":"staticCatchSchema","kind":"constant","lang":"typescript","doc":"Static catch values","code":"const staticCatchSchema = z.string().catch(() => \"sup\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":353,"symbol":"dynamicCatchSchema","kind":"constant","lang":"typescript","doc":"Dynamic catch values","code":"const dynamicCatchSchema = z.string().catch((ctx) => `${ctx.issues.length}`);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":495,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.base64url();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":496,"symbol":"pattern","kind":"constant","lang":"typescript","code":"const pattern = new RegExp(z.toJSONSchema(schema).pattern!);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":504,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.base64();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":505,"symbol":"pattern","kind":"constant","lang":"typescript","code":"const pattern = new RegExp(z.toJSONSchema(schema).pattern!);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":514,"symbol":"json","kind":"constant","lang":"typescript","doc":"recordProcessor reads bag.patterns directly; it must apply the same lax-to-exact swap as stringProcessor","code":"const json = z.toJSONSchema(z.looseRecord(z.base64url(), z.number()));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":599,"symbol":"schema","kind":"constant","lang":"typescript","doc":"String.prototype.includes(sub, position) matches `sub` at `position` OR LATER, so the JSON Schema pattern must allow >= position leading chars.","code":"const schema = z.string().includes(\"foo\", { position: 2 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":600,"symbol":"json","kind":"constant","lang":"typescript","code":"const json = z.toJSONSchema(schema) as { pattern?: string };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":603,"symbol":"re","kind":"constant","lang":"typescript","code":"const re = new RegExp(json.pattern!);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":810,"symbol":"after","kind":"constant","lang":"typescript","doc":"runtime rejects 1.5 in both orders, so both must emit type integer","code":"const after = z.number().int().check(z.float32());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":817,"symbol":"file","kind":"constant","lang":"typescript","code":"const file = z.file().mime(\"image/png\").mime(\"text/plain\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":830,"symbol":"check","kind":"constant","lang":"typescript","code":"const check = {\n _zod: {\n def: { check: \"custom_mime\" },\n onattach: [\n (inst: any) => {\n inst._zod.bag.mime = [\"text/plain\"];\n },\n ],\n check: () => {},\n },\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":841,"symbol":"file","kind":"constant","lang":"typescript","code":"const file = z\n .file()\n .mime([\"image/png\", \"text/plain\"])\n .check(check as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":850,"symbol":"check","kind":"constant","lang":"typescript","doc":"third-party checks have no converter handler; their bag writes are merged in as a fallback","code":"const check = {\n _zod: {\n def: { check: \"custom_range\" },\n onattach: [\n (inst: any) => {\n const bag = inst._zod.bag;\n if (bag.minimum === undefined || 5 > bag.minimum) bag.minimum = 5;\n },\n ],\n check: () => {},\n },\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":855,"symbol":"bag","kind":"constant","lang":"typescript","code":"const bag = inst._zod.bag;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":909,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().nullable();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":910,"symbol":"jsonSchema","kind":"constant","lang":"typescript","code":"const jsonSchema = z.toJSONSchema(schema, { target: \"openapi-3.0\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":921,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.union([z.string(), z.null()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":922,"symbol":"jsonSchema","kind":"constant","lang":"typescript","code":"const jsonSchema = z.toJSONSchema(schema, { target: \"openapi-3.0\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":943,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().lt(100).gt(1);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":944,"symbol":"jsonSchema","kind":"constant","lang":"typescript","code":"const jsonSchema = z.toJSONSchema(schema, { target: \"openapi-3.0\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":970,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.union([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1032,"symbol":"refined","kind":"constant","lang":"typescript","doc":"a `type` array must have unique members, so two branches that erase to the same bare type collapse","code":"const refined = z.union([z.string().refine((s) => s.length > 2), z.string().refine((s) => s.length < 9)]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1049,"symbol":"decorated","kind":"constant","lang":"typescript","doc":"an override decorates the string branch, so it is no longer a bare type and must survive in anyOf","code":"const decorated = z.toJSONSchema(z.union([z.string(), z.number()]), {\n override(ctx) {\n if (ctx.zodSchema._zod.def.type === \"string\") ctx.jsonSchema.whatever = \"sup\";\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1050,"symbol":"override","kind":"method","lang":"typescript","code":"override(ctx) {\n if (ctx.zodSchema._zod.def.type === \"string\") ctx.jsonSchema.whatever = \"sup\";\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1070,"symbol":"shared","kind":"constant","lang":"typescript","doc":"a branch extracted into $defs is a $ref, not a bare type, so `reused` is not silently bypassed","code":"const shared = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1117,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.union([z.string().min(1), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1135,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.union([z.literal(\"a\"), z.literal(\"b\")]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1154,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"success\"), data: z.string() }),\n z.object({ type: z.literal(\"error\"), message: z.string() }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1202,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.intersection(z.object({ name: z.string() }), z.object({ age: z.number() }));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1226,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.string(), z.boolean());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1242,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.string(), z.boolean());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1243,"symbol":"jsonSchema","kind":"constant","lang":"typescript","code":"const jsonSchema = z.toJSONSchema(schema, { target: \"openapi-3.0\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1256,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.enum([\"key1\", \"key2\"]), z.number());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1281,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.enum([\"key1\", \"key2\"]), z.number().default(0));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1297,"symbol":"NumberEnum","kind":"type","lang":"typescript","code":"enum NumberEnum {\n Zero = 0,\n One = 1,\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1301,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.enum(NumberEnum), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1346,"symbol":"numericString","kind":"constant","lang":"typescript","code":"const numericString = { type: \"string\", pattern: \"^-?\\\\d+(?:\\\\.\\\\d+)?$\" };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1378,"symbol":"key","kind":"constant","lang":"typescript","doc":"the value position still wants the number form, so the two cannot share one def","code":"const key = z.number().meta({ id: \"Shared\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1397,"symbol":"numeric","kind":"constant","lang":"typescript","code":"const numeric: any = z.lazy(() => z.union([z.number(), numeric]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1402,"symbol":"stringy","kind":"constant","lang":"typescript","doc":"a key with nothing to re-express keeps the reference it had","code":"const stringy: any = z.lazy(() => z.union([z.string(), stringy]));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1423,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.literal([1, 2]), z.boolean());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1430,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.string().regex(/^label:[a-z]{2}$/), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1448,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.looseRecord(z.string().regex(/^label:[a-z]{2}$/), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1464,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.looseRecord(\n z\n .string()\n .regex(/^prefix_/)\n .regex(/_suffix$/),\n z.number()\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1490,"symbol":"schema","kind":"constant","lang":"typescript","doc":"looseRecord with plain string key should still use propertyNames","code":"const schema = z.looseRecord(z.string(), z.boolean());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1507,"symbol":"zLabeled","kind":"constant","lang":"typescript","code":"const zLabeled = z.object({ label: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1508,"symbol":"zLocalizedLabeled","kind":"constant","lang":"typescript","code":"const zLocalizedLabeled = z.looseRecord(z.string().regex(/^label:[a-z]{2}$/), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1509,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = zLabeled.and(zLocalizedLabeled);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1541,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.tuple([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1562,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.tuple([z.string(), z.number()]).rest(z.boolean());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1584,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.tuple([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1585,"symbol":"jsonSchema","kind":"constant","lang":"typescript","code":"const jsonSchema = z.toJSONSchema(schema, { target: \"openapi-3.0\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1607,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.tuple([z.string(), z.number()]).rest(z.boolean());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/to-json-schema.test.ts","line":1608,"symbol":"jsonSchema","kind":"constant","lang":"typescript","code":"const jsonSchema = z.toJSONSchema(schema, { target: \"openapi-3.0\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":5,"symbol":"strs","kind":"constant","lang":"typescript","code":"const strs = [\"foo\", \"bar\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":6,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().transform((data, ctx) => {\n const i = strs.indexOf(data);\n if (i === -1) {\n ctx.addIssue({\n input: data,\n code: \"custom\",\n message: `${data} is not one of our allowed strings`,\n });\n }\n return data.length;\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":7,"symbol":"i","kind":"constant","lang":"typescript","code":"const i = strs.indexOf(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":17,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":31,"symbol":"strs","kind":"constant","lang":"typescript","code":"const strs = [\"foo\", \"bar\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":33,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await z\n .string()\n .transform(async (data, ctx) => {\n const i = strs.indexOf(data);\n if (i === -1) {\n ctx.addIssue({\n input: data,\n code: \"custom\",\n message: `${data} is not one of our allowed strings`,\n });\n }\n return data.length;\n })\n .safeParseAsync(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":36,"symbol":"i","kind":"constant","lang":"typescript","code":"const i = strs.indexOf(data);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":63,"symbol":"foo","kind":"constant","lang":"typescript","code":"const foo = z\n .number()\n .optional()\n .transform((val, ctx) => {\n if (!val) {\n ctx.addIssue({\n input: val,\n code: z.ZodIssueCode.custom,\n message: \"bad\",\n });\n return z.NEVER;\n }\n return val;\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":77,"symbol":"foo","kind":"type","lang":"typescript","code":"type foo = z.infer<typeof foo>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":79,"symbol":"arg","kind":"constant","lang":"typescript","code":"const arg = foo.safeParse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":86,"symbol":"r1","kind":"constant","lang":"typescript","code":"const r1 = z\n .string()\n .transform((data) => data.length)\n .parse(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":94,"symbol":"numToString","kind":"constant","lang":"typescript","code":"const numToString = z.number().transform((n) => String(n));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":95,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = z\n .object({\n id: numToString,\n })\n .parse({ id: 5 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":105,"symbol":"numToString","kind":"constant","lang":"typescript","code":"const numToString = z.number().transform(async (n) => String(n));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":106,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = await z\n .object({\n id: numToString,\n })\n .parseAsync({ id: 5 });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":116,"symbol":"asyncNumberToString","kind":"constant","lang":"typescript","code":"const asyncNumberToString = z.number().transform(async (n) => String(n));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":128,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = z.string().default(\"asdf\").parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":133,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = z\n .string()\n .default(() => \"string\")\n .parse(undefined);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":141,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = z\n .object({\n foo: z.boolean().nullable().default(true),\n bar: z.boolean().default(true),\n })\n .parse({ foo: null });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":152,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n emptyStr: z.string().default(\"def\"),\n zero: z.number().default(5),\n falseBoolean: z.boolean().default(true),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":157,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = { emptyStr: \"\", zero: 0, falseBoolean: true };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":158,"symbol":"output","kind":"constant","lang":"typescript","code":"const output = schema.parse(input);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":164,"symbol":"stringToNumber","kind":"constant","lang":"typescript","code":"const stringToNumber = z.string().transform((arg) => Number.parseFloat(arg));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":166,"symbol":"t1","kind":"constant","lang":"typescript","code":"const t1 = z.object({\n stringToNumber,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":170,"symbol":"t1","kind":"type","lang":"typescript","code":"type t1 = z.input<typeof t1>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":171,"symbol":"t2","kind":"type","lang":"typescript","code":"type t2 = z.output<typeof t1>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":178,"symbol":"t1","kind":"constant","lang":"typescript","code":"const t1 = z.string().transform((val) => val.toUpperCase());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":181,"symbol":"t2","kind":"constant","lang":"typescript","code":"const t2 = z.string().transform((val) => val.length);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":186,"symbol":"stringToNumber","kind":"constant","lang":"typescript","code":"const stringToNumber = z.string().transform((arg) => Number.parseFloat(arg));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":188,"symbol":"doubler","kind":"constant","lang":"typescript","code":"const doubler = stringToNumber.transform((val) => {\n return val * 2;\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":195,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .string()\n .refine(() => false)\n .transform((val) => val.toUpperCase());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":199,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":212,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = schema.safeParse(1234);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":220,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .string()\n .refine(() => false)\n .transform((val) => val.toUpperCase());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":224,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await schema.spa(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":237,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = await schema.spa(1234);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":253,"symbol":"A","kind":"constant","lang":"typescript","code":"const A = z\n .string()\n .transform((val, ctx) => {\n ctx.addIssue({\n code: \"custom\",\n message: `custom error`,\n });\n ctx.addIssue({\n code: \"custom\",\n message: `custom error`,\n });\n return val;\n })\n .pipe(z.number() as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":285,"symbol":"B","kind":"constant","lang":"typescript","code":"const B = z\n .string()\n .transform((val, ctx) => {\n ctx.issues.push({\n code: \"custom\",\n message: `custom error`,\n input: val,\n });\n ctx.issues.push({\n code: \"custom\",\n message: `custom error`,\n input: val,\n });\n return val;\n })\n .pipe(z.number() as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":319,"symbol":"C","kind":"constant","lang":"typescript","code":"const C = z\n .string()\n .transform((val, ctx) => {\n ctx.issues.push({\n code: \"custom\",\n message: `custom error`,\n input: val,\n continue: true,\n });\n ctx.issues.push({\n code: \"custom\",\n message: `custom error`,\n input: val,\n continue: true,\n });\n return val;\n })\n .pipe(z.number() as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":357,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().transform((val) => val.length);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":364,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.transform((val, ctx) => {\n ctx.addIssue({\n code: \"custom\",\n message: \"Not valid\",\n });\n return val;\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/transform.test.ts","line":372,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"test\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":5,"symbol":"testTuple","kind":"constant","lang":"typescript","code":"const testTuple = z.tuple([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":8,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = testTuple.parse([\"asdf\", 1234]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":11,"symbol":"r1","kind":"constant","lang":"typescript","code":"const r1 = testTuple.safeParse([\"asdf\", \"asdf\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":26,"symbol":"r2","kind":"constant","lang":"typescript","code":"const r2 = testTuple.safeParse([\"asdf\", 1234, true]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":41,"symbol":"r3","kind":"constant","lang":"typescript","code":"const r3 = testTuple.safeParse({});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":56,"symbol":"testTuple","kind":"constant","lang":"typescript","code":"const testTuple = z\n .tuple([z.string().refine(async () => true), z.number().refine(async () => true)])\n .refine(async () => true);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":61,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = await testTuple.parseAsync([\"asdf\", 1234]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":64,"symbol":"r1","kind":"constant","lang":"typescript","code":"const r1 = await testTuple.safeParseAsync([\"asdf\", \"asdf\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":79,"symbol":"r2","kind":"constant","lang":"typescript","code":"const r2 = await testTuple.safeParseAsync([\"asdf\", 1234, true]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":94,"symbol":"r3","kind":"constant","lang":"typescript","code":"const r3 = await testTuple.safeParseAsync({});"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":109,"symbol":"myTuple","kind":"constant","lang":"typescript","code":"const myTuple = z.tuple([z.string(), z.number().optional(), z.string().optional()]).rest(z.boolean());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":114,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = [[\"asdf\"], [\"asdf\", 1234], [\"asdf\", 1234, \"asdf\"], [\"asdf\", 1234, \"asdf\", true, false, true]];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":119,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = [\n [\"asdf\", \"asdf\"],\n [\"asdf\", 1234, \"asdf\", \"asdf\"],\n [\"asdf\", 1234, \"asdf\", true, false, \"asdf\"],\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":130,"symbol":"myTuple","kind":"constant","lang":"typescript","code":"const myTuple = z.tuple([z.string(), z.number().optional(), z.string()]).rest(z.boolean());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":133,"symbol":"goodData","kind":"constant","lang":"typescript","code":"const goodData = [\n [\"asdf\", 1234, \"asdf\"],\n [\"asdf\", 1234, \"asdf\", true, false, true],\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":141,"symbol":"badData","kind":"constant","lang":"typescript","code":"const badData = [\n [\"asdf\"],\n [\"asdf\", 1234],\n [\"asdf\", 1234, \"asdf\", \"asdf\"],\n [\"asdf\", 1234, \"asdf\", true, false, \"asdf\"],\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":153,"symbol":"allOptionalTuple","kind":"constant","lang":"typescript","code":"const allOptionalTuple = z.tuple([z.string().optional(), z.number().optional(), z.boolean().optional()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":174,"symbol":"t","kind":"constant","lang":"typescript","doc":"Issue #5229: trailing `.default()`/`.prefault()` elements should be filled in when the input array is shorter than the tuple.","code":"const t = z.tuple([z.string(), z.string().default(\"bravo\")]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":182,"symbol":"multi","kind":"constant","lang":"typescript","doc":"Multiple trailing defaults","code":"const multi = z.tuple([z.string(), z.number().default(42), z.boolean().default(true)]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":198,"symbol":"t","kind":"constant","lang":"typescript","code":"const t = z.tuple([z.string(), z.string().default(\"zulu\")]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":204,"symbol":"t","kind":"constant","lang":"typescript","doc":"Backwards compat: a trailing `.optional()` element that is omitted from the input must NOT be filled with `undefined` — the result stays length-1. Only schemas that produce a defined value get materialized.","code":"const t = z.tuple([z.string(), z.string().optional()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":205,"symbol":"out","kind":"constant","lang":"typescript","code":"const out = t.parse([\"alpha\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":229,"symbol":"many","kind":"constant","lang":"typescript","doc":"Multiple trailing optionals trim the same way — we don't fill the tail with literal `undefined`s.","code":"const many = z.tuple([z.string(), z.string().optional(), z.string().optional(), z.string().optional()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":234,"symbol":"r","kind":"constant","lang":"typescript","doc":"Explicit `undefined` inside `input.length` IS preserved — only slots past the input get trimmed.","code":"const r = many.parse([\"alpha\", undefined]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":248,"symbol":"t","kind":"constant","lang":"typescript","doc":"`.optional()` before a `.default()` must produce an explicit `undefined` (not a sparse hole), otherwise `1 in r`, `JSON.stringify`, `Object.keys`, and iteration all behave wrong.","code":"const t = z.tuple([z.string(), z.string().optional(), z.string().default(\"z\")]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":249,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = t.parse([\"alpha\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":262,"symbol":"interleaved","kind":"constant","lang":"typescript","doc":"Multiple interleaved optional/default — every slot up to the last default must be present and dense.","code":"const interleaved = z.tuple([\n z.string(),\n z.string().optional(),\n z.string().default(\"d\"),\n z.string().optional(),\n z.string().default(\"e\"),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":269,"symbol":"out","kind":"constant","lang":"typescript","code":"const out = interleaved.parse([\"alpha\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":276,"symbol":"refusesUndefined","kind":"constant","lang":"typescript","doc":"An absent optional-output slot can only be swallowed when every later output slot is optional too. If a later default would make the output tail required, truncating would violate the tuple's output type.","code":"const refusesUndefined = z\n .string()\n .optional()\n .refine((s) => s !== undefined, \"must not be undefined\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":281,"symbol":"trailingDefault","kind":"constant","lang":"typescript","code":"const trailingDefault = z.tuple([z.string(), refusesUndefined, z.string().default(\"d\")]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":282,"symbol":"r1","kind":"constant","lang":"typescript","code":"const r1 = trailingDefault.safeParse([\"alpha\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":287,"symbol":"beforeReject","kind":"constant","lang":"typescript","doc":"Optional slots BEFORE the rejected one still cannot hide a later required output slot.","code":"const beforeReject = z.tuple([z.string(), z.string().optional(), refusesUndefined, z.string().default(\"d\")]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":288,"symbol":"r2","kind":"constant","lang":"typescript","code":"const r2 = beforeReject.safeParse([\"alpha\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":293,"symbol":"noTrailingDefault","kind":"constant","lang":"typescript","doc":"No default after — truncate still applies, no spurious issue surfaces.","code":"const noTrailingDefault = z.tuple([z.string(), refusesUndefined]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":294,"symbol":"r3","kind":"constant","lang":"typescript","code":"const r3 = noTrailingDefault.safeParse([\"alpha\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":300,"symbol":"refusesUndefined","kind":"constant","lang":"typescript","code":"const refusesUndefined = z\n .string()\n .optional()\n .refine(async (s) => s !== undefined, \"must not be undefined\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":305,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.tuple([z.string(), refusesUndefined, z.string().default(\"d\")]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":306,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = await schema.safeParseAsync([\"alpha\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":312,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.tuple([z.string(), z.string().exactOptional(), z.string().default(\"fallback\")]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":315,"symbol":"missingExact","kind":"constant","lang":"typescript","code":"const missingExact = schema.safeParse([\"alpha\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":331,"symbol":"orUndefined","kind":"constant","lang":"typescript","doc":"The trim only runs for slots PAST `input.length`. An explicit `undefined` value supplied by the caller at index < input.length must survive, even when the schema produces undefined as a valid output (e.g. `z.string().or(z.undefined())`, `z.string().optional()`, `z.undefined()`).","code":"const orUndefined = z.tuple([z.string(), z.string().or(z.undefined())]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":332,"symbol":"r1","kind":"constant","lang":"typescript","code":"const r1 = orUndefined.parse([\"alpha\", undefined]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":339,"symbol":"opt","kind":"constant","lang":"typescript","doc":"Same for `.optional()`.","code":"const opt = z.tuple([z.string(), z.string().optional()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":340,"symbol":"r2","kind":"constant","lang":"typescript","code":"const r2 = opt.parse([\"alpha\", undefined]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":345,"symbol":"lit","kind":"constant","lang":"typescript","doc":"Same for `z.undefined()` literal.","code":"const lit = z.tuple([z.string(), z.undefined()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":346,"symbol":"r3","kind":"constant","lang":"typescript","code":"const r3 = lit.parse([\"alpha\", undefined]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":351,"symbol":"mid","kind":"constant","lang":"typescript","doc":"Mid-tuple explicit undefined surrounded by defined values is also kept.","code":"const mid = z.tuple([z.string(), z.string().or(z.undefined()), z.string()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":352,"symbol":"r4","kind":"constant","lang":"typescript","code":"const r4 = mid.parse([\"alpha\", undefined, \"gamma\"]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":360,"symbol":"schema","kind":"constant","lang":"typescript","doc":"A required slot (no `.optional()` chain, so optout !== \"optional\") past input length must still surface an issue rather than silently swallowing it. Otherwise we'd accept arbitrarily short tuples for required-tail schemas. The precheck collapses this into a single `too_small`.","code":"const schema = z.tuple([z.string(), z.string()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":376,"symbol":"myTuple","kind":"constant","lang":"typescript","code":"const myTuple = z.tuple([z.string(), z.number()]).rest(z.boolean());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":382,"symbol":"t1","kind":"type","lang":"typescript","code":"type t1 = z.output<typeof myTuple>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":388,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.tuple([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":393,"symbol":"allRequired","kind":"constant","lang":"typescript","code":"const allRequired = z.tuple([z.string(), z.string()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":419,"symbol":"trailingOptional","kind":"constant","lang":"typescript","code":"const trailingOptional = z.tuple([z.string(), z.number().optional()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":433,"symbol":"interiorOptional","kind":"constant","lang":"typescript","code":"const interiorOptional = z.tuple([z.string(), z.number().optional(), z.string()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":449,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.tuple([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":481,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.tuple([z.string(), z.number(), z.boolean()]).partial();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":499,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.tuple([z.string()], z.number()).partial();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/tuple.test.ts","line":509,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.tuple([z.string(), z.number()]).refine(([a]) => a.length > 0);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":6,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.union([z.string().refine(() => false), z.number().refine(() => false)]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":7,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"asdf\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":12,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.union([z.number(), z.string().refine(() => false)]).safeParse(\"a\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":17,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.union([\n z.object({\n email: z.string().email(),\n }),\n z.string(),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":30,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.union([z.number(), z.boolean()]).safeParse(\"a\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":64,"symbol":"union","kind":"constant","lang":"typescript","code":"const union = z.union([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":72,"symbol":"options","kind":"constant","lang":"typescript","code":"const options = [z.string(), z.number()] as const;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":73,"symbol":"union","kind":"constant","lang":"typescript","code":"const union = z.union(options);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":79,"symbol":"test","kind":"constant","lang":"typescript","code":"const test = z.object({}).or(z.array(z.object({})));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":81,"symbol":"Test","kind":"type","lang":"typescript","code":"type Test = z.output<typeof test>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":86,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.union([z.literal(\"a\"), z.literal(\"b\"), z.literal(\"c\")]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":98,"symbol":"zItemTest","kind":"constant","lang":"typescript","code":"const zItemTest = z.union([\n z.object({\n date: z.number(),\n startDate: z.optional(z.null()),\n endDate: z.optional(z.null()),\n }),\n z\n .object({\n date: z.optional(z.null()),\n startDate: z.number(),\n endDate: z.number(),\n })\n .refine((data) => data.startDate !== data.endDate, {\n error: \"startDate and endDate must be different\",\n path: [\"endDate\"],\n }),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":116,"symbol":"res","kind":"constant","lang":"typescript","code":"const res = zItemTest.safeParse({\n date: null,\n startDate: 1,\n endDate: 1,\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":139,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.union([z.boolean(), z.uuid(), z.jwt()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":185,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.xor([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":191,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.xor([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":192,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(true);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":197,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.xor([z.string(), z.any()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":198,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"hello\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":221,"symbol":"name","kind":"constant","lang":"typescript","doc":"non-strict objects strip unknown keys, so both branches accept the extra key","code":"const name = z.object({ name: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":222,"symbol":"version","kind":"constant","lang":"typescript","code":"const version = name.extend({ version: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":223,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.xor([name, version, z.unknown()]).safeParse({ name: \"windows\", version: \"10\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":226,"symbol":"issue","kind":"constant","lang":"typescript","code":"const issue = result.error.issues[0] as z.core.$ZodIssueInvalidUnion;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":234,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.xor([z.string(), z.number()]).safeParse(true);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":237,"symbol":"issue","kind":"constant","lang":"typescript","code":"const issue = result.error.issues[0] as z.core.$ZodIssueInvalidUnion;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":244,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.xor([z.string(), z.number()], \"Expected exactly one of string or number\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":245,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(true);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":253,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.xor([z.string(), z.number(), z.boolean()]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":254,"symbol":"Result","kind":"type","lang":"typescript","code":"type Result = z.infer<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":259,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.union([]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":261,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"anything\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":278,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.xor([]);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":280,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"anything\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":297,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.discriminatedUnion(\"type\", [] as any);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":298,"symbol":"nonObject","kind":"constant","lang":"typescript","code":"const nonObject = schema.safeParse(\"nope\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/union.test.ts","line":303,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = schema.safeParse({ type: \"x\" });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/url.test.ts","line":5,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().array();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":11,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string(), b: z.array(z.number()) });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":18,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z\n .string()\n .transform((s) => s.length)\n .pipe(z.number().max(3));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":28,"symbol":"value","kind":"constant","lang":"typescript","code":"const value: unknown = \"hi\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":32,"symbol":"transforming","kind":"constant","lang":"typescript","code":"const transforming = z.string().transform((s) => s.length);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":39,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().refine(async (s) => s.length > 2);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":45,"symbol":"compiled","kind":"constant","lang":"typescript","doc":"a promise-returning callback that is not declared async compiles, so the compiled schema must stay off the fast path","code":"const compiled = z.compile(z.string().refine((s) => Promise.resolve(s.length > 1)));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":52,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n name: z.string().refine((s) => {\n calls++;\n return s.length > 1;\n }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":58,"symbol":"compiled","kind":"constant","lang":"typescript","code":"const compiled = z.compile(schema);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":75,"symbol":"definite","kind":"constant","lang":"typescript","code":"const definite = (s: z.ZodType) => (z.compile(s, { strict: true }) as any)._zod.bag.validator?.definite;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":107,"symbol":"unmergeable","kind":"constant","lang":"typescript","doc":"an intersection answers INVALID for an unmergeable merge, which the interpreter answers with a throw — a fast false would misreport a schema bug","code":"const unmergeable = z.compile(\n z.intersection(\n z.number(),\n z.number().transform((x) => x + 1)\n ),\n { strict: true }\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":117,"symbol":"gated","kind":"constant","lang":"typescript","doc":"a when-gated check islands at codegen, and an island answers INVALID for an async run too","code":"const gated = z.number().refine(() => Promise.resolve(true));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":119,"symbol":"compiled","kind":"constant","lang":"typescript","code":"const compiled = z.compile(z.object({ n: gated }), { strict: true });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":124,"symbol":"piped","kind":"constant","lang":"typescript","doc":"a plain function handing back a promise answers INVALID for union parity, so a transform is never a decidable rejection","code":"const piped = z.string().transform(() => Promise.resolve(1));"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":129,"symbol":"continuable","kind":"constant","lang":"typescript","doc":"a continuable child issue short-circuits the compiled intersection before its merge, but the interpreter reaches the merge and throws","code":"const continuable = z.intersection(\n z.number().min(10),\n z.number().transform((x) => x + 1)\n );"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":139,"symbol":"thenable","kind":"constant","lang":"typescript","doc":"guards the `definite` flag: a new generator that answers INVALID for something the interpreter throws on must clear it, or this fails","code":"const thenable = () => Promise.resolve(1) as never;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":140,"symbol":"schemas","kind":"constant","lang":"typescript","code":"const schemas: z.ZodType[] = [\n z.object({ a: z.string(), b: z.number().min(1) }),\n z.strictObject({ a: z.string() }),\n z.array(z.string().min(1)),\n z.tuple([z.string()], z.number()),\n z.record(z.string(), z.number()),\n // a record key compiles in its own context, so its definiteness has to be carried out\n z.record(z.string().transform(thenable), z.number()),\n z.record(z.email(), z.number()),\n z.union([z.string(), z.number()]),\n z.intersection(\n z.number(),\n z.number().transform((x) => x + 1)\n ),\n z.intersection(\n z.number().min(10),\n z.number().transform((x) => x + 1)\n ),\n // unmergeable with no user callback in it, so only the intersection itself can clear the flag\n z.intersection(z.string().default(\"a\"), z.string().default(\"b\")),\n z.lazy(() => z.object({ a: z.string() })),\n z.number().catch(0),\n z.nonoptional(z.string().optional()),\n z.map(z.string(), z.number()),\n z.set(z.string().min(2)),\n z.templateLiteral([\"a\", z.number()]),\n z.coerce.number(),\n z.stringbool(),\n z.string().transform(thenable),\n z.union([z.string().transform(thenable), z.number()]),\n z.array(z.string().transform("} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":225,"symbol":"inputs","kind":"constant","lang":"typescript","code":"const inputs = [\n \"x\",\n \"ab\",\n \"\",\n 0,\n 1,\n Number.NaN,\n true,\n null,\n undefined,\n {},\n { a: \"x\" },\n { a: 1 },\n [],\n [\"x\"],\n new Map(),\n new Set([\"a\"]),\n \"true\",\n // the exposing shape: an earlier field the compiled path rejects before it reaches the throwing one\n { first: 1, second: \"s\" },\n { first: \"s\", second: \"s\" },\n { first: 1 },\n [1, \"x\"],\n [\"s\", \"x\"],\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":250,"symbol":"outcome","kind":"constant","lang":"typescript","code":"const outcome = (fn: () => unknown) => {\n try {\n return `ok:${fn()}`;\n } catch (err) {\n return `throw:${(err as Error)?.constructor?.name}`;\n }\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":289,"symbol":"value","kind":"constant","lang":"typescript","code":"const value: unknown = \"hi\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":293,"symbol":"transforming","kind":"constant","lang":"typescript","code":"const transforming = z.string().transform((s) => s.length);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":302,"symbol":"error","kind":"constant","lang":"typescript","code":"const error = () => {\n calls++;\n return \"bad\";\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":316,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().refine(async (s) => s.length > 2);"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":324,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = zm.string();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":331,"symbol":"counted","kind":"function","lang":"typescript","doc":"counts reads of each child slot, so a stopped walk is observable without putting a callback in the schema — a refinement spy would work too, but reading the input says nothing about what ran","code":"function counted(\n slots: Record<string, unknown>,\n bad: Record<string, unknown> = {}\n): [Record<string, unknown>, () => number] {\n let reads = 0;\n const obj: Record<string, unknown> = { ...bad };\n for (const [k, v] of Object.entries(slots)) {\n Object.defineProperty(obj, k, {\n enumerable: true,\n get() {\n reads++;\n return v;\n },\n });\n }\n return [obj, () => reads];\n}"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":336,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj: Record<string, unknown> = { ...bad };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":340,"symbol":"get","kind":"method","lang":"typescript","code":"get() {\n reads++;\n return v;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":350,"symbol":"shape","kind":"constant","lang":"typescript","code":"const shape = { a: z.number(), b: z.string(), c: z.string() };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":353,"symbol":"label","kind":"constant","lang":"typescript","code":"const label = jitless ? \"interpreted\" : \"compiled\";"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":364,"symbol":"arr","kind":"constant","lang":"typescript","doc":"an array stops at the first bad element","code":"const arr: unknown[] = [1];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":369,"symbol":"get","kind":"method","lang":"typescript","code":"get() {\n elementReads++;\n return \"x\";\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":384,"symbol":"tup","kind":"constant","lang":"typescript","doc":"and a tuple's fixed items carry into its rest","code":"const tup: unknown[] = [\"no\"];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":389,"symbol":"get","kind":"method","lang":"typescript","code":"get() {\n restReads++;\n return \"x\";\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":400,"symbol":"boom","kind":"constant","lang":"typescript","code":"const boom = (): never => {\n throw new RangeError(\"boom\");\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":418,"symbol":"spy","kind":"constant","lang":"typescript","code":"const spy = z.string().refine(() => {\n calls++;\n return true;\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":426,"symbol":"skips","kind":"constant","lang":"typescript","doc":"reads of the trailing key say whether the walk stopped, without putting a callback in the schema","code":"const skips = (b: z.ZodType, value: unknown = \"x\") => {\n let reads = 0;\n const input: Record<string, unknown> = { a: \"no\" };\n Object.defineProperty(input, \"b\", {\n enumerable: true,\n get() {\n reads++;\n return value;\n },\n });\n z.validate(z.object({ a: z.number(), b }), input);\n return reads === 0;\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":428,"symbol":"input","kind":"constant","lang":"typescript","code":"const input: Record<string, unknown> = { a: \"no\" };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":431,"symbol":"get","kind":"method","lang":"typescript","code":"get() {\n reads++;\n return value;\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":461,"symbol":"el","kind":"constant","lang":"typescript","code":"const el = z\n .string()\n .min(5)\n .refine(() => {\n calls++;\n return true;\n });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":475,"symbol":"input","kind":"constant","lang":"typescript","code":"const input: Record<string, unknown> = { a: 1 };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":479,"symbol":"get","kind":"method","lang":"typescript","code":"get() {\n reads++;\n return \"x\";\n }"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":490,"symbol":"recA","kind":"constant","lang":"typescript","code":"const recA = z.record(z.string().regex(/^a/), z.any());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":491,"symbol":"recB","kind":"constant","lang":"typescript","code":"const recB = z.record(z.string().regex(/^b/), z.any());"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":492,"symbol":"schemas","kind":"constant","lang":"typescript","code":"const schemas: z.ZodType[] = [\n z.intersection(recA, recB),\n z.intersection(recA.pipe(z.any()), recB.pipe(z.any())),\n z.intersection(z.strictObject({ a: z.string() }), z.strictObject({ b: z.number() })),\n z.intersection(z.array(z.string()), z.array(z.string().min(2))),\n z.strictObject({ a: z.string() }).pipe(z.any()),\n z.union([z.strictObject({ a: z.string() }), z.strictObject({ a: z.string(), b: z.number() })]),\n z.array(z.string()).catch([]),\n z.object({ a: z.string() }).optional(),\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":502,"symbol":"inputs","kind":"constant","lang":"typescript","code":"const inputs: unknown[] = [\n { a1: 1, b1: 2 },\n { a1: 1, b1: 2, zz: 3 },\n { a1: 1, zz: 2, b1: 3, yy: 4 },\n { b1: 1, a1: 2, zz: 3, yy: 4 },\n { a: \"x\", b: 1 },\n { a: \"x\", b: 1, c: 9 },\n { a: \"x\" },\n [\"ab\", \"cd\"],\n [\"a\", \"b\"],\n undefined,\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":515,"symbol":"outcome","kind":"constant","lang":"typescript","code":"const outcome = (fn: () => unknown) => {\n try {\n return `ok:${fn()}`;\n } catch (err) {\n return `throw:${(err as Error)?.constructor?.name}`;\n }\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":522,"symbol":"outcomeAsync","kind":"constant","lang":"typescript","code":"const outcomeAsync = async (fn: () => Promise<unknown>) => {\n try {\n return `ok:${await fn()}`;\n } catch (err) {\n return `throw:${(err as Error)?.constructor?.name}`;\n }\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":532,"symbol":"label","kind":"constant","lang":"typescript","code":"const label = `${schema._zod.def.type} on ${JSON.stringify(input)}`;"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":545,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string(), b: z.string(), c: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":552,"symbol":"boom","kind":"constant","lang":"typescript","code":"const boom = (): never => {\n throw new RangeError(\"boom\");\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":556,"symbol":"lateSym","kind":"constant","lang":"typescript","doc":"the deliberate divergence, in every shape that can carry a callback: an earlier sibling settles the boolean, so the later throw is never reached","code":"const lateSym = Symbol(\"late\");"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":557,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases: [string, z.ZodType, unknown][] = [\n [\"object transform\", z.object({ a: z.number(), b: z.string().transform(boom) }), { a: \"bad\", b: \"ok\" }],\n [\"object refine\", z.object({ a: z.number(), b: z.string().refine(boom) }), { a: \"bad\", b: \"ok\" }],\n [\"object custom\", z.object({ a: z.number(), b: z.custom(boom) }), { a: \"bad\", b: \"ok\" }],\n // these three hang the callback off `_zod.check` rather than the def\n [\"object check\", z.object({ a: z.number(), b: z.string().check(boom) }), { a: \"bad\", b: \"ok\" }],\n [\"object superRefine\", z.object({ a: z.number(), b: z.string().superRefine(boom) }), { a: \"bad\", b: \"ok\" }],\n [\"object overwrite\", z.object({ a: z.number(), b: z.string().overwrite(boom as any) }), { a: \"bad\", b: \"ok\" }],\n // the input must carry the same symbol with a value the field accepts, or the transform never runs and the row asserts nothing\n [\n \"symbol key\",\n z.object({ a: z.number(), [lateSym]: z.string().transform(boom) } as any),\n { a: \"bad\", [lateSym]: \"ok\" },\n ],\n [\"object catch\", z.object({ a: z.number(), b: z.string().catch(boom) }), { a: \"bad\", b: 1 }],\n [\"object lazy\", z.object({ a: z.number(), b: z.lazy(() =>"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":587,"symbol":"outcome","kind":"constant","lang":"typescript","code":"const outcome = (fn: () => unknown) => {\n try {\n return `ok:${fn()}`;\n } catch (err) {\n return `throw:${(err as Error)?.constructor?.name}`;\n }\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":609,"symbol":"boom","kind":"constant","lang":"typescript","code":"const boom = (): never => {\n throw new RangeError(\"boom\");\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":613,"symbol":"pairs","kind":"constant","lang":"typescript","doc":"both parse as a unit, so an abort in one half cannot skip the other; stopping inside either risks a discarded issue turning a false into a true","code":"const pairs: [string, z.ZodType, unknown][] = [\n [\"map entry\", z.map(z.number(), z.string().transform(boom)), new Map([[\"bad\", \"ok\"]])],\n [\"tuple fixed item\", z.tuple([z.number(), z.string().transform(boom)]), [\"bad\", \"ok\"]],\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":628,"symbol":"boom","kind":"constant","lang":"typescript","code":"const boom = (): never => {\n throw new RangeError(\"boom\");\n };"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/validate.test.ts","line":632,"symbol":"cases","kind":"constant","lang":"typescript","doc":"nothing rejects before the callback, so validate reaches it and the throw is the caller's","code":"const cases: [string, z.ZodType, unknown][] = [\n [\"transform\", z.object({ a: z.string().transform(boom), b: z.number() }), { a: \"ok\", b: \"bad\" }],\n [\"refine\", z.object({ a: z.string().refine(boom), b: z.number() }), { a: \"ok\", b: \"bad\" }],\n [\"check\", z.object({ a: z.string().check(boom), b: z.number() }), { a: \"ok\", b: \"bad\" }],\n [\"array element\", z.array(z.string().transform(boom)), [\"ok\", \"ok\"]],\n [\"catchall\", z.object({}).catchall(z.string().transform(boom)), { a: \"ok\" }],\n [\"set\", z.set(z.string().transform(boom)), new Set([\"ok\"])],\n [\"map\", z.map(z.string(), z.string().transform(boom)), new Map([[\"k\", \"ok\"]])],\n [\"tuple rest\", z.tuple([z.string()], z.string().transform(boom)), [\"ok\", \"ok\"]],\n ];"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/void.test.ts","line":4,"symbol":"v","kind":"constant","lang":"typescript","code":"const v = z.void();"} {"repo":"zod","file":"packages/zod/src/v4/classic/tests/void.test.ts","line":10,"symbol":"v","kind":"type","lang":"typescript","code":"type v = z.infer<typeof v>;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":8,"symbol":"Params","kind":"type","lang":"typescript","code":"type Params<\n T extends schemas.$ZodType | checks.$ZodCheck,\n IssueTypes extends errors.$ZodIssueBase,\n OmitKeys extends keyof T[\"_zod\"][\"def\"] = never,\n> = util.Flatten<\n Partial<\n util.EmptyToNever<\n Omit<T[\"_zod\"][\"def\"], OmitKeys> &\n ([IssueTypes] extends [never]\n ? {} // unknown\n : {\n error?: string | errors.$ZodErrorMap<IssueTypes> | undefined;\n /** @deprecated This parameter is deprecated. Use `error` instead. */\n message?: string | undefined; // supported in Zod 3\n })\n >\n >\n>;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":27,"symbol":"TypeParams","kind":"type","lang":"typescript","code":"type TypeParams<\n T extends schemas.$ZodType = schemas.$ZodType & { _isst: never },\n AlsoOmit extends Exclude<keyof T[\"_zod\"][\"def\"], \"type\" | \"checks\" | \"error\"> = never,\n> = Params<T, NonNullable<T[\"_zod\"][\"isst\"]>, \"type\" | \"checks\" | \"error\" | AlsoOmit>;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":34,"symbol":"CheckParams","kind":"type","lang":"typescript","doc":"strips types that are not exposed in the public factory incl. `error`, `check`","code":"type CheckParams<\n T extends checks.$ZodCheck = checks.$ZodCheck, // & { _issc: never },\n AlsoOmit extends Exclude<keyof T[\"_zod\"][\"def\"], \"check\" | \"error\"> = never,\n> = Params<T, NonNullable<T[\"_zod\"][\"issc\"]>, \"check\" | \"error\" | AlsoOmit>;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":41,"symbol":"StringFormatParams","kind":"type","lang":"typescript","doc":"strips types that are not exposed in the public factory incl. `type`, `checks`, `error`, `check`, `format`","code":"type StringFormatParams<\n T extends schemas.$ZodStringFormat = schemas.$ZodStringFormat,\n AlsoOmit extends Exclude<keyof T[\"_zod\"][\"def\"], \"type\" | \"coerce\" | \"checks\" | \"error\" | \"check\" | \"format\"> = never,\n> = Params<\n T,\n NonNullable<T[\"_zod\"][\"isst\"] | T[\"_zod\"][\"issc\"]>,\n \"type\" | \"coerce\" | \"checks\" | \"error\" | \"check\" | \"format\" | AlsoOmit\n>;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":50,"symbol":"CheckStringFormatParams","kind":"type","lang":"typescript","code":"type CheckStringFormatParams<\n T extends schemas.$ZodStringFormat = schemas.$ZodStringFormat,\n AlsoOmit extends Exclude<keyof T[\"_zod\"][\"def\"], \"type\" | \"coerce\" | \"checks\" | \"error\" | \"check\" | \"format\"> = never,\n> = Params<T, NonNullable<T[\"_zod\"][\"issc\"]>, \"type\" | \"coerce\" | \"checks\" | \"error\" | \"check\" | \"format\" | AlsoOmit>;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":55,"symbol":"CheckTypeParams","kind":"type","lang":"typescript","code":"type CheckTypeParams<\n T extends schemas.$ZodType & checks.$ZodCheck = schemas.$ZodType & checks.$ZodCheck,\n AlsoOmit extends Exclude<keyof T[\"_zod\"][\"def\"], \"type\" | \"checks\" | \"error\" | \"check\"> = never,\n> = Params<T, NonNullable<T[\"_zod\"][\"isst\"] | T[\"_zod\"][\"issc\"]>, \"type\" | \"checks\" | \"error\" | \"check\" | AlsoOmit>;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":61,"symbol":"$ZodStringParams","kind":"type","lang":"typescript","doc":"String","code":"type $ZodStringParams = TypeParams<schemas.$ZodString<string>, \"coerce\"> & {\n checks?: readonly checks.$ZodCheck<string>[];\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":65,"symbol":"snapshotChecks","kind":"function","lang":"typescript","code":"function snapshotChecks<T extends { checks?: readonly checks.$ZodCheck<never>[] }>(def: T) {\n if (def.checks) def.checks = [...def.checks];\n return def as T & { checks?: NonNullable<T[\"checks\"]>[number][] };\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":70,"symbol":"_string","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function _string<T extends schemas.$ZodString>(\n Class: util.SchemaClass<T>,\n params?: string | $ZodStringParams\n): T {\n return new Class(snapshotChecks({ type: \"string\" as const, ...util.normalizeParams(params) }));\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":78,"symbol":"_coercedString","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function _coercedString<T extends schemas.$ZodString>(\n Class: util.SchemaClass<T>,\n params?: string | $ZodStringParams\n): T {\n return new Class(snapshotChecks({ type: \"string\" as const, coerce: true, ...util.normalizeParams(params) }));\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":85,"symbol":"$ZodStringFormatParams","kind":"type","lang":"typescript","code":"type $ZodStringFormatParams = CheckTypeParams<\n schemas.$ZodStringFormat,\n \"format\" | \"coerce\" | \"when\" | \"pattern\"\n>;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":89,"symbol":"$ZodCheckStringFormatParams","kind":"type","lang":"typescript","code":"type $ZodCheckStringFormatParams = CheckParams<checks.$ZodCheckStringFormat, \"format\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":93,"symbol":"$ZodEmailParams","kind":"type","lang":"typescript","doc":"Email","code":"type $ZodEmailParams = StringFormatParams<schemas.$ZodEmail, \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":94,"symbol":"$ZodCheckEmailParams","kind":"type","lang":"typescript","code":"type $ZodCheckEmailParams = CheckStringFormatParams<schemas.$ZodEmail, \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":96,"symbol":"_email","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function _email<T extends schemas.$ZodEmail>(\n Class: util.SchemaClass<T>,\n params?: string | $ZodEmailParams | $ZodCheckEmailParams\n): T {\n return new Class({\n type: \"string\",\n format: \"email\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":110,"symbol":"$ZodGUIDParams","kind":"type","lang":"typescript","doc":"GUID","code":"type $ZodGUIDParams = StringFormatParams<schemas.$ZodGUID, \"pattern\" | \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":111,"symbol":"$ZodCheckGUIDParams","kind":"type","lang":"typescript","code":"type $ZodCheckGUIDParams = CheckStringFormatParams<schemas.$ZodGUID, \"pattern\" | \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":113,"symbol":"_guid","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function _guid<T extends schemas.$ZodGUID>(\n Class: util.SchemaClass<T>,\n params?: string | $ZodGUIDParams | $ZodCheckGUIDParams\n): T {\n return new Class({\n type: \"string\",\n format: \"guid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":127,"symbol":"$ZodUUIDParams","kind":"type","lang":"typescript","doc":"UUID","code":"type $ZodUUIDParams = StringFormatParams<schemas.$ZodUUID, \"pattern\" | \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":128,"symbol":"$ZodCheckUUIDParams","kind":"type","lang":"typescript","code":"type $ZodCheckUUIDParams = CheckStringFormatParams<schemas.$ZodUUID, \"pattern\" | \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":130,"symbol":"_uuid","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function _uuid<T extends schemas.$ZodUUID>(\n Class: util.SchemaClass<T>,\n params?: string | $ZodUUIDParams | $ZodCheckUUIDParams\n): T {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":144,"symbol":"$ZodUUIDv4Params","kind":"type","lang":"typescript","doc":"UUIDv4","code":"type $ZodUUIDv4Params = StringFormatParams<schemas.$ZodUUID, \"pattern\" | \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":145,"symbol":"$ZodCheckUUIDv4Params","kind":"type","lang":"typescript","code":"type $ZodCheckUUIDv4Params = CheckStringFormatParams<schemas.$ZodUUID, \"pattern\" | \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":147,"symbol":"_uuidv4","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function _uuidv4<T extends schemas.$ZodUUID>(\n Class: util.SchemaClass<T>,\n params?: string | $ZodUUIDv4Params | $ZodCheckUUIDv4Params\n): T {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n version: \"v4\",\n ...util.normalizeParams(params),\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":162,"symbol":"$ZodUUIDv6Params","kind":"type","lang":"typescript","doc":"UUIDv6","code":"type $ZodUUIDv6Params = StringFormatParams<schemas.$ZodUUID, \"pattern\" | \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":163,"symbol":"$ZodCheckUUIDv6Params","kind":"type","lang":"typescript","code":"type $ZodCheckUUIDv6Params = CheckStringFormatParams<schemas.$ZodUUID, \"pattern\" | \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":165,"symbol":"_uuidv6","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function _uuidv6<T extends schemas.$ZodUUID>(\n Class: util.SchemaClass<T>,\n params?: string | $ZodUUIDv6Params | $ZodCheckUUIDv6Params\n): T {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n version: \"v6\",\n ...util.normalizeParams(params),\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":180,"symbol":"$ZodUUIDv7Params","kind":"type","lang":"typescript","doc":"UUIDv7","code":"type $ZodUUIDv7Params = StringFormatParams<schemas.$ZodUUID, \"pattern\" | \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":181,"symbol":"$ZodCheckUUIDv7Params","kind":"type","lang":"typescript","code":"type $ZodCheckUUIDv7Params = CheckStringFormatParams<schemas.$ZodUUID, \"pattern\" | \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":183,"symbol":"_uuidv7","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function _uuidv7<T extends schemas.$ZodUUID>(\n Class: util.SchemaClass<T>,\n params?: string | $ZodUUIDv7Params | $ZodCheckUUIDv7Params\n): T {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n version: \"v7\",\n ...util.normalizeParams(params),\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":198,"symbol":"$ZodURLParams","kind":"type","lang":"typescript","doc":"URL","code":"type $ZodURLParams = StringFormatParams<schemas.$ZodURL, \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":199,"symbol":"$ZodCheckURLParams","kind":"type","lang":"typescript","code":"type $ZodCheckURLParams = CheckStringFormatParams<schemas.$ZodURL, \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":201,"symbol":"_url","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function _url<T extends schemas.$ZodURL>(\n Class: util.SchemaClass<T>,\n params?: string | $ZodURLParams | $ZodCheckURLParams\n): T {\n return new Class({\n type: \"string\",\n format: \"url\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":215,"symbol":"$ZodEmojiParams","kind":"type","lang":"typescript","doc":"Emoji","code":"type $ZodEmojiParams = StringFormatParams<schemas.$ZodEmoji, \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":216,"symbol":"$ZodCheckEmojiParams","kind":"type","lang":"typescript","code":"type $ZodCheckEmojiParams = CheckStringFormatParams<schemas.$ZodEmoji, \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":218,"symbol":"_emoji","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function _emoji<T extends schemas.$ZodEmoji>(\n Class: util.SchemaClass<T>,\n params?: string | $ZodEmojiParams | $ZodCheckEmojiParams\n): T {\n return new Class({\n type: \"string\",\n format: \"emoji\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":232,"symbol":"$ZodNanoIDParams","kind":"type","lang":"typescript","doc":"NanoID","code":"type $ZodNanoIDParams = StringFormatParams<schemas.$ZodNanoID, \"when\" | \"pattern\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":233,"symbol":"$ZodCheckNanoIDParams","kind":"type","lang":"typescript","code":"type $ZodCheckNanoIDParams = CheckStringFormatParams<schemas.$ZodNanoID, \"when\" | \"pattern\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":235,"symbol":"_nanoid","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function _nanoid<T extends schemas.$ZodNanoID>(\n Class: util.SchemaClass<T>,\n params?: string | $ZodNanoIDParams | $ZodCheckNanoIDParams\n): T {\n return new Class({\n type: \"string\",\n format: \"nanoid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":254,"symbol":"$ZodCUIDParams","kind":"type","lang":"typescript","doc":"CUID @deprecated CUID v1 is deprecated by its authors due to information leakage (timestamps embedded in the id). Use {@link _cuid2} instead. See https://github.com/paralleldrive/cuid.","code":"type $ZodCUIDParams = StringFormatParams<schemas.$ZodCUID, \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":260,"symbol":"$ZodCheckCUIDParams","kind":"type","lang":"typescript","doc":"@deprecated CUID v1 is deprecated by its authors due to information leakage (timestamps embedded in the id). Use {@link _cuid2} instead. See https://github.com/paralleldrive/cuid.","code":"type $ZodCheckCUIDParams = CheckStringFormatParams<schemas.$ZodCUID, \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":267,"symbol":"_cuid","kind":"function","lang":"typescript","doc":"@deprecated CUID v1 is deprecated by its authors due to information leakage (timestamps embedded in the id). Use {@link _cuid2} instead. See https://github.com/paralleldrive/cuid. @__NO_SIDE_EFFECTS__","code":"function _cuid<T extends schemas.$ZodCUID>(\n Class: util.SchemaClass<T>,\n params?: string | $ZodCUIDParams | $ZodCheckCUIDParams\n): T {\n return new Class({\n type: \"string\",\n format: \"cuid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":281,"symbol":"$ZodCUID2Params","kind":"type","lang":"typescript","doc":"CUID2","code":"type $ZodCUID2Params = StringFormatParams<schemas.$ZodCUID2, \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":282,"symbol":"$ZodCheckCUID2Params","kind":"type","lang":"typescript","code":"type $ZodCheckCUID2Params = CheckStringFormatParams<schemas.$ZodCUID2, \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":284,"symbol":"_cuid2","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function _cuid2<T extends schemas.$ZodCUID2>(\n Class: util.SchemaClass<T>,\n params?: string | $ZodCUID2Params | $ZodCheckCUID2Params\n): T {\n return new Class({\n type: \"string\",\n format: \"cuid2\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":298,"symbol":"$ZodULIDParams","kind":"type","lang":"typescript","doc":"ULID","code":"type $ZodULIDParams = StringFormatParams<schemas.$ZodULID, \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":299,"symbol":"$ZodCheckULIDParams","kind":"type","lang":"typescript","code":"type $ZodCheckULIDParams = CheckStringFormatParams<schemas.$ZodULID, \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":301,"symbol":"_ulid","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function _ulid<T extends schemas.$ZodULID>(\n Class: util.SchemaClass<T>,\n params?: string | $ZodULIDParams | $ZodCheckULIDParams\n): T {\n return new Class({\n type: \"string\",\n format: \"ulid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":315,"symbol":"$ZodXIDParams","kind":"type","lang":"typescript","doc":"XID","code":"type $ZodXIDParams = StringFormatParams<schemas.$ZodXID, \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":316,"symbol":"$ZodCheckXIDParams","kind":"type","lang":"typescript","code":"type $ZodCheckXIDParams = CheckStringFormatParams<schemas.$ZodXID, \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":318,"symbol":"_xid","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function _xid<T extends schemas.$ZodXID>(\n Class: util.SchemaClass<T>,\n params?: string | $ZodXIDParams | $ZodCheckXIDParams\n): T {\n return new Class({\n type: \"string\",\n format: \"xid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":332,"symbol":"$ZodKSUIDParams","kind":"type","lang":"typescript","doc":"KSUID","code":"type $ZodKSUIDParams = StringFormatParams<schemas.$ZodKSUID, \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":333,"symbol":"$ZodCheckKSUIDParams","kind":"type","lang":"typescript","code":"type $ZodCheckKSUIDParams = CheckStringFormatParams<schemas.$ZodKSUID, \"when\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":335,"symbol":"_ksuid","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function _ksuid<T extends schemas.$ZodKSUID>(\n Class: util.SchemaClass<T>,\n params?: string | $ZodKSUIDParams | $ZodCheckKSUIDParams\n): T {\n return new Class({\n type: \"string\",\n format: \"ksuid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":349,"symbol":"$ZodIPv4Params","kind":"type","lang":"typescript","doc":"IPv4","code":"type $ZodIPv4Params = StringFormatParams<schemas.$ZodIPv4, \"pattern\" | \"when\" | \"version\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":350,"symbol":"$ZodCheckIPv4Params","kind":"type","lang":"typescript","code":"type $ZodCheckIPv4Params = CheckStringFormatParams<schemas.$ZodIPv4, \"pattern\" | \"when\" | \"version\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":352,"symbol":"_ipv4","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function _ipv4<T extends schemas.$ZodIPv4>(\n Class: util.SchemaClass<T>,\n params?: string | $ZodIPv4Params | $ZodCheckIPv4Params\n): T {\n return new Class({\n type: \"string\",\n format: \"ipv4\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":366,"symbol":"$ZodIPv6Params","kind":"type","lang":"typescript","doc":"IPv6","code":"type $ZodIPv6Params = StringFormatParams<schemas.$ZodIPv6, \"pattern\" | \"when\" | \"version\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":367,"symbol":"$ZodCheckIPv6Params","kind":"type","lang":"typescript","code":"type $ZodCheckIPv6Params = CheckStringFormatParams<schemas.$ZodIPv6, \"pattern\" | \"when\" | \"version\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/api.ts","line":369,"symbol":"_ipv6","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function _ipv6<T extends schemas.$ZodIPv6>(\n Class: util.SchemaClass<T>,\n params?: string | $ZodIPv6Params | $ZodCheckIPv6Params\n): T {\n return new Class({\n type: \"string\",\n format: \"ipv6\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":11,"symbol":"$ZodCheckDef","kind":"interface","lang":"typescript","code":"interface $ZodCheckDef {\n check: string;\n error?: errors.$ZodErrorMap<never> | undefined;\n /** If true, no later checks will be executed if this check fails. Default `false`. */\n abort?: boolean | undefined;\n /** If provided, the check runs only when this returns `true`. By default, it is skipped if prior parsing produced aborting issues. */\n when?: ((payload: schemas.ParsePayload) => boolean) | undefined;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":20,"symbol":"$ZodCheckInternals","kind":"interface","lang":"typescript","code":"interface $ZodCheckInternals<T> {\n def: $ZodCheckDef;\n /** The set of issues this check might throw. */\n issc?: errors.$ZodIssueBase;\n check(payload: schemas.ParsePayload<T>): util.MaybeAsync<void>;\n onattach: ((schema: schemas.$ZodType) => void)[];\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":28,"symbol":"$ZodCheck","kind":"interface","lang":"typescript","code":"interface $ZodCheck<in T = never> {\n _zod: $ZodCheckInternals<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":32,"symbol":"$ZodCheck","kind":"constant","lang":"typescript","code":"const $ZodCheck: core.$constructor<$ZodCheck<any>> = /*@__PURE__*/ core.$constructor(\n \"$ZodCheck\",\n (inst, def) => {\n inst._zod ??= {} as any;\n inst._zod.def = def;\n inst._zod.onattach ??= [];\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":42,"symbol":"_whenHasSize","kind":"constant","lang":"typescript","doc":"Default `when` for size-based checks: run only on non-nullish values with a `size`.","code":"const _whenHasSize = (payload: schemas.ParsePayload): boolean => {\n const val = payload.value;\n return !util.nullish(val) && (val as any).size !== undefined;\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":43,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = payload.value;"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":48,"symbol":"_whenHasLength","kind":"constant","lang":"typescript","doc":"Default `when` for length-based checks: run only on non-nullish values with a `length`.","code":"const _whenHasLength = (payload: schemas.ParsePayload): boolean => {\n const val = payload.value;\n return !util.nullish(val) && (val as any).length !== undefined;\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":49,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = payload.value;"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":56,"symbol":"$ZodCheckLessThanDef","kind":"interface","lang":"typescript","doc":"//////////////////////////////////// // $ZodCheckLessThan ///// ////////////////////////////////////","code":"interface $ZodCheckLessThanDef extends $ZodCheckDef {\n check: \"less_than\";\n value: util.Numeric;\n inclusive: boolean;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":62,"symbol":"$ZodCheckLessThanInternals","kind":"interface","lang":"typescript","code":"interface $ZodCheckLessThanInternals<T extends util.Numeric = util.Numeric> extends $ZodCheckInternals<T> {\n def: $ZodCheckLessThanDef;\n issc: errors.$ZodIssueTooBig<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":67,"symbol":"numericOriginMap","kind":"constant","lang":"typescript","code":"const numericOriginMap = {\n number: \"number\",\n bigint: \"bigint\",\n object: \"date\",\n} as const;"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":72,"symbol":"$ZodCheckLessThan","kind":"interface","lang":"typescript","code":"interface $ZodCheckLessThan<T extends util.Numeric = util.Numeric> extends $ZodCheck<T> {\n _zod: $ZodCheckLessThanInternals<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":76,"symbol":"$ZodCheckLessThan","kind":"constant","lang":"typescript","code":"const $ZodCheckLessThan: core.$constructor<$ZodCheckLessThan> = /*@__PURE__*/ core.$constructor(\n \"$ZodCheckLessThan\",\n (inst, def) => {\n $ZodCheck.init(inst, def);\n const origin = numericOriginMap[typeof def.value as \"number\" | \"bigint\" | \"object\"];\n\n inst._zod.check = (payload) => {\n if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {\n return;\n }\n\n payload.issues.push({\n origin: numericOriginMap[typeof payload.value as \"number\" | \"bigint\" | \"object\"] ?? origin,\n code: \"too_big\",\n maximum: typeof def.value === \"object\" ? def.value.getTime() : def.value,\n input: payload.value,\n inclusive: def.inclusive,\n inst,\n continue: !def.abort,\n });\n };\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":80,"symbol":"origin","kind":"constant","lang":"typescript","code":"const origin = numericOriginMap[typeof def.value as \"number\" | \"bigint\" | \"object\"];"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":103,"symbol":"$ZodCheckGreaterThanDef","kind":"interface","lang":"typescript","doc":"////////////////////////////////// // $ZodCheckGreaterThan ///// //////////////////////////////////","code":"interface $ZodCheckGreaterThanDef extends $ZodCheckDef {\n check: \"greater_than\";\n value: util.Numeric;\n inclusive: boolean;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":109,"symbol":"$ZodCheckGreaterThanInternals","kind":"interface","lang":"typescript","code":"interface $ZodCheckGreaterThanInternals<T extends util.Numeric = util.Numeric> extends $ZodCheckInternals<T> {\n def: $ZodCheckGreaterThanDef;\n issc: errors.$ZodIssueTooSmall<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":114,"symbol":"$ZodCheckGreaterThan","kind":"interface","lang":"typescript","code":"interface $ZodCheckGreaterThan<T extends util.Numeric = util.Numeric> extends $ZodCheck<T> {\n _zod: $ZodCheckGreaterThanInternals<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":118,"symbol":"$ZodCheckGreaterThan","kind":"constant","lang":"typescript","code":"const $ZodCheckGreaterThan: core.$constructor<$ZodCheckGreaterThan> = /*@__PURE__*/ core.$constructor(\n \"$ZodCheckGreaterThan\",\n (inst, def) => {\n $ZodCheck.init(inst, def);\n const origin = numericOriginMap[typeof def.value as \"number\" | \"bigint\" | \"object\"];\n\n inst._zod.check = (payload) => {\n if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {\n return;\n }\n\n payload.issues.push({\n origin: numericOriginMap[typeof payload.value as \"number\" | \"bigint\" | \"object\"] ?? origin,\n code: \"too_small\",\n minimum: typeof def.value === \"object\" ? def.value.getTime() : def.value,\n input: payload.value,\n inclusive: def.inclusive,\n inst,\n continue: !def.abort,\n });\n };\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":122,"symbol":"origin","kind":"constant","lang":"typescript","code":"const origin = numericOriginMap[typeof def.value as \"number\" | \"bigint\" | \"object\"];"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":147,"symbol":"$ZodCheckMultipleOfDef","kind":"interface","lang":"typescript","code":"interface $ZodCheckMultipleOfDef<T extends number | bigint = number | bigint> extends $ZodCheckDef {\n check: \"multiple_of\";\n value: T;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":152,"symbol":"$ZodCheckMultipleOfInternals","kind":"interface","lang":"typescript","code":"interface $ZodCheckMultipleOfInternals<T extends number | bigint = number | bigint>\n extends $ZodCheckInternals<T> {\n def: $ZodCheckMultipleOfDef<T>;\n issc: errors.$ZodIssueNotMultipleOf;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":158,"symbol":"$ZodCheckMultipleOf","kind":"interface","lang":"typescript","code":"interface $ZodCheckMultipleOf<T extends number | bigint = number | bigint> extends $ZodCheck<T> {\n _zod: $ZodCheckMultipleOfInternals<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":162,"symbol":"$ZodCheckMultipleOf","kind":"constant","lang":"typescript","code":"const $ZodCheckMultipleOf: core.$constructor<$ZodCheckMultipleOf<number | bigint>> =\n /*@__PURE__*/ core.$constructor(\"$ZodCheckMultipleOf\", (inst, def) => {\n $ZodCheck.init(inst, def);\n\n inst._zod.check = (payload) => {\n if (typeof payload.value !== typeof def.value)\n throw new Error(\"Cannot mix number and bigint in multiple_of check.\");\n const isMultiple =\n typeof payload.value === \"bigint\"\n ? // `value % 0n` throws, and nothing is a multiple of zero — the number branch already fails this way via NaN\n (def.value as bigint) !== BigInt(0) && payload.value % (def.value as bigint) === BigInt(0)\n : util.floatSafeRemainder(payload.value, def.value as number) === 0;\n\n if (isMultiple) return;\n payload.issues.push({\n origin: typeof payload.value as \"number\",\n code: \"not_multiple_of\",\n divisor: def.value as number,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":169,"symbol":"isMultiple","kind":"constant","lang":"typescript","code":"const isMultiple =\n typeof payload.value === \"bigint\"\n ? // `value % 0n` throws, and nothing is a multiple of zero — the number branch already fails this way via NaN\n (def.value as bigint) !== BigInt(0) && payload.value % (def.value as bigint) === BigInt(0)\n : util.floatSafeRemainder(payload.value, def.value as number) === 0;"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":235,"symbol":"$ZodNumberFormats","kind":"type","lang":"typescript","code":"type $ZodNumberFormats = \"int32\" | \"uint32\" | \"float32\" | \"float64\" | \"safeint\";"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":237,"symbol":"$ZodCheckNumberFormatDef","kind":"interface","lang":"typescript","code":"interface $ZodCheckNumberFormatDef<Format extends $ZodNumberFormats = $ZodNumberFormats> extends $ZodCheckDef {\n check: \"number_format\";\n format: Format;\n // abort?: boolean;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":243,"symbol":"$ZodCheckNumberFormatInternals","kind":"interface","lang":"typescript","code":"interface $ZodCheckNumberFormatInternals<Format extends $ZodNumberFormats = $ZodNumberFormats>\n extends $ZodCheckInternals<number> {\n def: $ZodCheckNumberFormatDef<Format>;\n issc: errors.$ZodIssueInvalidType | errors.$ZodIssueTooBig<\"number\"> | errors.$ZodIssueTooSmall<\"number\">;\n // bag: util.LoosePartial<{\n // minimum?: number | undefined;\n // }>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":252,"symbol":"$ZodCheckNumberFormat","kind":"interface","lang":"typescript","code":"interface $ZodCheckNumberFormat<Format extends $ZodNumberFormats = $ZodNumberFormats> extends $ZodCheck<number> {\n _zod: $ZodCheckNumberFormatInternals<Format>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":256,"symbol":"$ZodCheckNumberFormat","kind":"constant","lang":"typescript","code":"const $ZodCheckNumberFormat: core.$constructor<$ZodCheckNumberFormat> = /*@__PURE__*/ core.$constructor(\n \"$ZodCheckNumberFormat\",\n (inst, def) => {\n $ZodCheck.init(inst, def); // no format checks\n def.format = def.format || \"float64\";\n\n const isInt = def.format?.includes(\"int\");\n const origin = isInt ? \"int\" : \"number\";\n const [minimum, maximum] = util.NUMBER_FORMAT_RANGES[def.format];\n\n inst._zod.check = (payload) => {\n const input = payload.value;\n\n if (isInt) {\n if (!Number.isInteger(input)) {\n // invalid_format issue\n // payload.issues.push({\n // expected: def.format,\n // format: def.format,\n // code: \"invalid_format\",\n // input,\n // inst,\n // });\n // invalid_type issue\n payload.issues.push({\n expected: origin,\n format: def.format,\n code: \"invalid_type\",\n continue: false,\n input,\n inst,\n });\n\n return;\n\n // not_multiple_of issue\n // payload.issues.push({\n // code: \"not_multiple_of\",\n // origin: \"number\",\n // in"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":262,"symbol":"isInt","kind":"constant","lang":"typescript","code":"const isInt = def.format?.includes(\"int\");"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":263,"symbol":"origin","kind":"constant","lang":"typescript","code":"const origin = isInt ? \"int\" : \"number\";"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":267,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = payload.value;"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":362,"symbol":"$ZodBigIntFormats","kind":"type","lang":"typescript","code":"type $ZodBigIntFormats = \"int64\" | \"uint64\";"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":364,"symbol":"$ZodCheckBigIntFormatDef","kind":"interface","lang":"typescript","code":"interface $ZodCheckBigIntFormatDef<Format extends $ZodBigIntFormats = $ZodBigIntFormats> extends $ZodCheckDef {\n check: \"bigint_format\";\n format: Format;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":369,"symbol":"$ZodCheckBigIntFormatInternals","kind":"interface","lang":"typescript","code":"interface $ZodCheckBigIntFormatInternals<Format extends $ZodBigIntFormats = $ZodBigIntFormats>\n extends $ZodCheckInternals<bigint> {\n def: $ZodCheckBigIntFormatDef<Format>;\n issc: errors.$ZodIssueTooBig<\"bigint\"> | errors.$ZodIssueTooSmall<\"bigint\">;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":375,"symbol":"$ZodCheckBigIntFormat","kind":"interface","lang":"typescript","code":"interface $ZodCheckBigIntFormat<Format extends $ZodBigIntFormats = $ZodBigIntFormats> extends $ZodCheck<bigint> {\n _zod: $ZodCheckBigIntFormatInternals<Format>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":379,"symbol":"$ZodCheckBigIntFormat","kind":"constant","lang":"typescript","code":"const $ZodCheckBigIntFormat: core.$constructor<$ZodCheckBigIntFormat> = /*@__PURE__*/ core.$constructor(\n \"$ZodCheckBigIntFormat\",\n (inst, def) => {\n $ZodCheck.init(inst, def); // no format checks\n\n const [minimum, maximum] = util.BIGINT_FORMAT_RANGES[def.format];\n\n inst._zod.check = (payload) => {\n const input = payload.value;\n\n if (input < minimum) {\n payload.issues.push({\n origin: \"bigint\",\n input,\n code: \"too_small\",\n minimum: minimum as any,\n inclusive: true,\n inst,\n continue: !def.abort,\n });\n }\n\n if (input > maximum) {\n payload.issues.push({\n origin: \"bigint\",\n input,\n code: \"too_big\",\n maximum,\n inclusive: true,\n inst,\n continue: !def.abort,\n } as any);\n }\n };\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":387,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = payload.value;"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":419,"symbol":"$ZodCheckMaxSizeDef","kind":"interface","lang":"typescript","doc":"/////////////////////////////// // $ZodCheckMaxSize ///// ///////////////////////////////","code":"interface $ZodCheckMaxSizeDef extends $ZodCheckDef {\n check: \"max_size\";\n maximum: number;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":424,"symbol":"$ZodCheckMaxSizeInternals","kind":"interface","lang":"typescript","code":"interface $ZodCheckMaxSizeInternals<T extends util.HasSize = util.HasSize> extends $ZodCheckInternals<T> {\n def: $ZodCheckMaxSizeDef;\n issc: errors.$ZodIssueTooBig<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":429,"symbol":"$ZodCheckMaxSize","kind":"interface","lang":"typescript","code":"interface $ZodCheckMaxSize<T extends util.HasSize = util.HasSize> extends $ZodCheck<T> {\n _zod: $ZodCheckMaxSizeInternals<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":433,"symbol":"$ZodCheckMaxSize","kind":"constant","lang":"typescript","code":"const $ZodCheckMaxSize: core.$constructor<$ZodCheckMaxSize> = /*@__PURE__*/ core.$constructor(\n \"$ZodCheckMaxSize\",\n (inst, def) => {\n $ZodCheck.init(inst, def);\n\n inst._zod.def.when ??= _whenHasSize;\n\n inst._zod.check = (payload) => {\n const input = payload.value;\n const size = input.size;\n\n if (size <= def.maximum) return;\n payload.issues.push({\n origin: util.getSizableOrigin(input),\n code: \"too_big\",\n maximum: def.maximum,\n inclusive: true,\n input,\n inst,\n continue: !def.abort,\n });\n };\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":441,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = payload.value;"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":442,"symbol":"size","kind":"constant","lang":"typescript","code":"const size = input.size;"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":461,"symbol":"$ZodCheckMinSizeDef","kind":"interface","lang":"typescript","doc":"/////////////////////////////// // $ZodCheckMinSize ///// ///////////////////////////////","code":"interface $ZodCheckMinSizeDef extends $ZodCheckDef {\n check: \"min_size\";\n minimum: number;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":466,"symbol":"$ZodCheckMinSizeInternals","kind":"interface","lang":"typescript","code":"interface $ZodCheckMinSizeInternals<T extends util.HasSize = util.HasSize> extends $ZodCheckInternals<T> {\n def: $ZodCheckMinSizeDef;\n issc: errors.$ZodIssueTooSmall<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":471,"symbol":"$ZodCheckMinSize","kind":"interface","lang":"typescript","code":"interface $ZodCheckMinSize<T extends util.HasSize = util.HasSize> extends $ZodCheck<T> {\n _zod: $ZodCheckMinSizeInternals<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":475,"symbol":"$ZodCheckMinSize","kind":"constant","lang":"typescript","code":"const $ZodCheckMinSize: core.$constructor<$ZodCheckMinSize> = /*@__PURE__*/ core.$constructor(\n \"$ZodCheckMinSize\",\n (inst, def) => {\n $ZodCheck.init(inst, def);\n\n inst._zod.def.when ??= _whenHasSize;\n\n inst._zod.check = (payload) => {\n const input = payload.value;\n const size = input.size;\n\n if (size >= def.minimum) return;\n payload.issues.push({\n origin: util.getSizableOrigin(input),\n code: \"too_small\",\n minimum: def.minimum,\n inclusive: true,\n input,\n inst,\n continue: !def.abort,\n });\n };\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":483,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = payload.value;"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":484,"symbol":"size","kind":"constant","lang":"typescript","code":"const size = input.size;"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":503,"symbol":"$ZodCheckSizeEqualsDef","kind":"interface","lang":"typescript","doc":"////////////////////////////////// // $ZodCheckSizeEquals ///// //////////////////////////////////","code":"interface $ZodCheckSizeEqualsDef extends $ZodCheckDef {\n check: \"size_equals\";\n size: number;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":508,"symbol":"$ZodCheckSizeEqualsInternals","kind":"interface","lang":"typescript","code":"interface $ZodCheckSizeEqualsInternals<T extends util.HasSize = util.HasSize> extends $ZodCheckInternals<T> {\n def: $ZodCheckSizeEqualsDef;\n issc: errors.$ZodIssueTooBig<T> | errors.$ZodIssueTooSmall<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":513,"symbol":"$ZodCheckSizeEquals","kind":"interface","lang":"typescript","code":"interface $ZodCheckSizeEquals<T extends util.HasSize = util.HasSize> extends $ZodCheck<T> {\n _zod: $ZodCheckSizeEqualsInternals<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":517,"symbol":"$ZodCheckSizeEquals","kind":"constant","lang":"typescript","code":"const $ZodCheckSizeEquals: core.$constructor<$ZodCheckSizeEquals> = /*@__PURE__*/ core.$constructor(\n \"$ZodCheckSizeEquals\",\n (inst, def) => {\n $ZodCheck.init(inst, def);\n\n inst._zod.def.when ??= _whenHasSize;\n\n inst._zod.check = (payload) => {\n const input = payload.value;\n const size = input.size;\n if (size === def.size) return;\n\n const tooBig = size > def.size;\n payload.issues.push({\n origin: util.getSizableOrigin(input),\n ...(tooBig ? { code: \"too_big\", maximum: def.size } : { code: \"too_small\", minimum: def.size }),\n inclusive: true,\n exact: true,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":525,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = payload.value;"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":526,"symbol":"size","kind":"constant","lang":"typescript","code":"const size = input.size;"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":529,"symbol":"tooBig","kind":"constant","lang":"typescript","code":"const tooBig = size > def.size;"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":547,"symbol":"$ZodCheckMaxLengthDef","kind":"interface","lang":"typescript","code":"interface $ZodCheckMaxLengthDef extends $ZodCheckDef {\n check: \"max_length\";\n maximum: number;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":552,"symbol":"$ZodCheckMaxLengthInternals","kind":"interface","lang":"typescript","code":"interface $ZodCheckMaxLengthInternals<T extends util.HasLength = util.HasLength> extends $ZodCheckInternals<T> {\n def: $ZodCheckMaxLengthDef;\n issc: errors.$ZodIssueTooBig<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/checks.ts","line":557,"symbol":"$ZodCheckMaxLength","kind":"interface","lang":"typescript","code":"interface $ZodCheckMaxLength<T extends util.HasLength = util.HasLength> extends $ZodCheck<T> {\n _zod: $ZodCheckMaxLengthInternals<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":25,"symbol":"INVALID","kind":"constant","lang":"typescript","doc":"@internal Sentinel the compiled fast path returns when validation fails.","code":"const INVALID: unique symbol = Symbol.for(\"zod.compile.invalid\");"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":27,"symbol":"INVALID","kind":"type","lang":"typescript","doc":"@internal","code":"type INVALID = typeof INVALID;"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":30,"symbol":"FALLBACK_FLAG","kind":"constant","lang":"typescript","doc":"Set on the parse ctx when a compiled wrapper falls back to the runtime, so nested compiled wrappers skip their fast paths for the rest of that parse.","code":"const FALLBACK_FLAG: unique symbol = Symbol.for(\"zod.compile.fallback\");"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":32,"symbol":"CompileFnOptions","kind":"interface","lang":"typescript","code":"interface CompileFnOptions {\n debug?: boolean | undefined;\n /** Emit a validator instead of a parser: skip building the output value where nothing reads it. */\n assertOnly?: boolean | undefined;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":38,"symbol":"CompiledFn","kind":"type","lang":"typescript","code":"type CompiledFn<T> = ((input: unknown) => T | INVALID) & {\n code?: string | undefined;\n /** False when this function's INVALID does not strictly mean \"the runtime would reject\". */\n definite?: boolean | undefined;\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":45,"symbol":"ZodCompileAsyncError","kind":"class","lang":"typescript","doc":"Raised when the schema contains async refinements or transforms. Surfaces only under `compile(schema, { strict: true })`.","code":"class ZodCompileAsyncError extends Error {\n constructor(message = \"z.compile does not support async refinements, transforms, or checks\") {\n super(message);\n this.name = \"ZodCompileAsyncError\";\n }\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":46,"symbol":"constructor","kind":"method","lang":"typescript","code":"constructor(message = \"z.compile does not support async refinements, transforms, or checks\") {\n super(message);\n this.name = \"ZodCompileAsyncError\";\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":58,"symbol":"ZodCompileUnsupportedError","kind":"class","lang":"typescript","doc":"Raised when the schema contains a feature whose semantics the fast path can't fully model. Both the shim in `zod/compile` and the default `compile()` fall back to the runtime parser for that schema; only `compile(schema, { strict: true })` lets it surface.","code":"class ZodCompileUnsupportedError extends Error {\n /** Whether a container may absorb this refusal by running the child through the runtime (see `compileChild`). False when running only that node on the runtime is not equivalent to running the whole parse there — a runtime island gets no parse context, so a node that *consumes* issues rather than propagating them would finalize them against the wrong error map and still succeed. */\n readonly islandable: boolean;\n\n constructor(feature: string, islandable = true) {\n super(`z.compile does not support ${feature}; this schema must use the runtime parser`);\n this.name = \"ZodCompileUnsupportedError\";\n this.islandable = islandable;\n }\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":62,"symbol":"constructor","kind":"method","lang":"typescript","code":"constructor(feature: string, islandable = true) {\n super(`z.compile does not support ${feature}; this schema must use the runtime parser`);\n this.name = \"ZodCompileUnsupportedError\";\n this.islandable = islandable;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":69,"symbol":"CompileContext","kind":"interface","lang":"typescript","code":"interface CompileContext {\n constants: Map<string, unknown>;\n constantCounter: number;\n varCounter: number;\n /** Cleared when a construct can return INVALID for something the interpreter throws on, so `validate` keeps its fallback. */\n definite: boolean;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":78,"symbol":"SupportedCheck","kind":"type","lang":"typescript","doc":"Union of all check types we support in AOT compilation","code":"type SupportedCheck =\n | checks.$ZodCheckLessThan\n | checks.$ZodCheckGreaterThan\n | checks.$ZodCheckMultipleOf\n | checks.$ZodCheckNumberFormat\n | checks.$ZodCheckBigIntFormat\n | checks.$ZodCheckMaxSize\n | checks.$ZodCheckMinSize\n | checks.$ZodCheckSizeEquals\n | checks.$ZodCheckMaxLength\n | checks.$ZodCheckMinLength\n | checks.$ZodCheckLengthEquals\n | checks.$ZodCheckStringFormat\n | checks.$ZodCheckProperty\n | checks.$ZodCheckProperties\n | checks.$ZodCheckMimeType\n | checks.$ZodCheckOverwrite\n | { _zod: { def: { check: \"custom\"; fn?: (value: unknown) => boolean }; check?: (payload: unknown) => unknown } };"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":102,"symbol":"compileValidator","kind":"function","lang":"typescript","doc":"Build the validator `validate` calls: the same codegen as the parser with the output construction dropped. A schema the flag cannot express reuses the parser, which still answers correctly — it just builds a value nothing reads.","code":"function compileValidator(schema: SomeType, parser: CompiledFn<unknown>): CompiledFn<unknown> {\n try {\n return compileFn(schema, { assertOnly: true }) as CompiledFn<unknown>;\n } catch {\n return parser;\n }\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":110,"symbol":"CompileOptions","kind":"interface","lang":"typescript","code":"interface CompileOptions {\n /** Throw the refusal instead of returning the schema uncompiled. */\n strict?: boolean | undefined;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":126,"symbol":"compile","kind":"function","lang":"typescript","doc":"bypass the fast path and use the runtime directly. - Never throws. A schema the fast path can't model is returned unchanged and keeps using the runtime parser. Pass `{ strict: true }` to get the refusal as a thrown `ZodCompileUnsupportedError` / `ZodCompileAsyncError` instead. - The original schema is unchanged. The clone shares children by reference.","code":"function compile<T extends SomeType>(schema: T, options?: CompileOptions): T {\n try {\n const parser = compileFn(schema);\n const clone = withParser(schema, parser);\n // withParser leaves the parser as its own validator; the generated assert-only variant is better when we have one\n clone._zod.bag.validator = compileValidator(schema, parser as CompiledFn<unknown>);\n return clone;\n } catch (err) {\n if (options?.strict) throw err;\n // a schema we can't compile still has to work, so hand it back untouched on the runtime parser — the same silent fallback global mode already does\n return schema;\n }\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":128,"symbol":"parser","kind":"constant","lang":"typescript","code":"const parser = compileFn(schema);"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":129,"symbol":"clone","kind":"constant","lang":"typescript","code":"const clone = withParser(schema, parser);"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":151,"symbol":"withParser","kind":"function","lang":"typescript","doc":"runtime. It must be synchronous and forward-direction, and it must build fresh output rather than return its input — Zod cannot check either, and a wrong *success* is returned to the caller as-is. `compile()` is the ordinary entry point. This is for a build-time or native compiler that produces a parser where `new Function` is unavailable.","code":"function withParser<T extends SomeType>(schema: T, parser: (input: unknown) => core.output<T> | INVALID): T {\n // generated code never receives the parse context, so only the runtime can close a reference cycle; compileFn refuses these too\n if (isRecursiveSchema(schema as any)) {\n throw new ZodCompileUnsupportedError(\"a schema whose subtree contains a reference cycle\");\n }\n const clone = util.clone(schema as any) as T;\n\n // Capture the source-of-truth runtime eagerly. If schema._zod.run is itself a shim installed by global-mode (`__originalRun` set), unwrap past it. Otherwise capturing the live property lazily would let a later self- replacement of schema._zod.run feed our wrapper back into itself.\n const liveRun = schema._zod.run as ((p: ParsePayload, c: ParseContextInternal) => any) & {\n __originalRun?: (p: ParsePayload, c: ParseContextInternal) => any;\n };\n const originalRun = liveRun.__originalRun ?? liveRun;\n\n // Delegate to the *original* schema's run on bypass/fallback, not the clone's. The original closed over its own `inst` at construction time, and issue payloads use that reference to derive things like the class name for `z.instanceof(Test)`; calling the c"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":156,"symbol":"clone","kind":"constant","lang":"typescript","code":"const clone = util.clone(schema as any) as T;"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":159,"symbol":"liveRun","kind":"constant","lang":"typescript","doc":"Capture the source-of-truth runtime eagerly. If schema._zod.run is itself a shim installed by global-mode (`__originalRun` set), unwrap past it. Otherwise capturing the live property lazily would let a later self- replacement of schema._zod.run feed our wrapper back into itself.","code":"const liveRun = schema._zod.run as ((p: ParsePayload, c: ParseContextInternal) => any) & {\n __originalRun?: (p: ParsePayload, c: ParseContextInternal) => any;\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":162,"symbol":"originalRun","kind":"constant","lang":"typescript","code":"const originalRun = liveRun.__originalRun ?? liveRun;"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":165,"symbol":"wrapped","kind":"constant","lang":"typescript","doc":"Delegate to the *original* schema's run on bypass/fallback, not the clone's. The original closed over its own `inst` at construction time, and issue payloads use that reference to derive things like the class name for `z.instanceof(Test)`; calling the clone's freshly-initialized run would push issues with `inst === clone` and diverge from the original schema's error messages.","code":"const wrapped = (payload: ParsePayload, ctx: ParseContextInternal): any => {\n if (\n ctx?.async ||\n ctx?.direction === \"backward\" ||\n ctx?.skipChecks ||\n (ctx as Record<symbol, unknown> | undefined)?.[FALLBACK_FLAG]\n ) {\n return originalRun(payload, ctx);\n }\n\n // A memoized back-edge: only the runtime can close a reference cycle, and a transform on one must raise $ZodCyclicError from its own parse.\n if (ctx && isBackEdge(ctx, payload.value)) {\n return originalRun(payload, ctx);\n }\n\n const out = parser(payload.value);\n if (out !== INVALID) {\n payload.value = out;\n return payload;\n }\n // Mark this parse as runtime-driven: under global mode every nested schema carries its own compiled wrapper, and without the flag the parent's runtime fallback re-enters each child's fast path, running user callbacks a third time on invalid input.\n if (ctx) (ctx as Record<symbol, unknown>)[FALLBACK_FLAG] = true;\n return originalRun(payload, ctx);\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":180,"symbol":"out","kind":"constant","lang":"typescript","code":"const out = parser(payload.value);"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":202,"symbol":"installCompiledUserMethods","kind":"function","lang":"typescript","code":"function installCompiledUserMethods<T extends SomeType>(\n target: T,\n source: T,\n parser: CompiledFn<core.output<T>>\n): void {\n const targetAny = target as any;\n const sourceAny = source as any;\n\n if (typeof sourceAny.safeParse === \"function\") {\n const originalSafeParse = sourceAny.safeParse;\n targetAny.safeParse = (data: unknown, params?: unknown) => {\n const out = parser(data);\n if (out !== INVALID) {\n return { success: true, data: out };\n }\n return originalSafeParse(data, params);\n };\n }\n\n if (typeof sourceAny.parse === \"function\") {\n const originalParse = sourceAny.parse;\n targetAny.parse = (data: unknown, params?: unknown) => {\n const out = parser(data);\n if (out !== INVALID) {\n return out;\n }\n return originalParse(data, params);\n };\n }\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":207,"symbol":"targetAny","kind":"constant","lang":"typescript","code":"const targetAny = target as any;"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":208,"symbol":"sourceAny","kind":"constant","lang":"typescript","code":"const sourceAny = source as any;"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":211,"symbol":"originalSafeParse","kind":"constant","lang":"typescript","code":"const originalSafeParse = sourceAny.safeParse;"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":213,"symbol":"out","kind":"constant","lang":"typescript","code":"const out = parser(data);"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":222,"symbol":"originalParse","kind":"constant","lang":"typescript","code":"const originalParse = sourceAny.parse;"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":224,"symbol":"out","kind":"constant","lang":"typescript","code":"const out = parser(data);"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":237,"symbol":"compileFn","kind":"function","lang":"typescript","doc":"@internal Generate the standalone compiled function: a parser by default, a validator under `assertOnly`. Returns the parsed value, `true` where nothing reads the output, or `INVALID`. Consumers use `compile()`.","code":"function compileFn<T extends SomeType>(schema: T, options?: CompileFnOptions): CompiledFn<core.output<T>> {\n // Cycle-breaking is keyed on the parse context, which generated code never receives. `shape` can be a getter that throws (z.pick() with an unrecognized mask key), so treat \"can't tell\" as recursive.\n let recursive = true;\n try {\n recursive = isRecursiveSchema(schema as any);\n } catch {}\n if (recursive) {\n throw new ZodCompileUnsupportedError(\"a schema whose subtree contains a reference cycle\");\n }\n\n const ctx: CompileContext = {\n constants: new Map(),\n constantCounter: 0,\n varCounter: 0,\n definite: true,\n };\n\n const doc = new Doc([\"input\"]);\n const outputAccessor = generateCheck(doc, ctx, schema, \"input\", !options?.assertOnly);\n // In assert mode a root that built nothing has already returned INVALID on every failure, so reaching the end means valid.\n doc.write(outputAccessor === null ? `return true;` : `return ${outputAccessor};`);\n\n // Build the function with hoisted constants Always include INVALID as the first constant\n const constantNames = [\"INVALID\", ...ctx.constants.keys()];\n const constantValues = [INVALID, ...ctx.constants.values()"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":247,"symbol":"ctx","kind":"constant","lang":"typescript","code":"const ctx: CompileContext = {\n constants: new Map(),\n constantCounter: 0,\n varCounter: 0,\n definite: true,\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":254,"symbol":"doc","kind":"constant","lang":"typescript","code":"const doc = new Doc([\"input\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":255,"symbol":"outputAccessor","kind":"constant","lang":"typescript","code":"const outputAccessor = generateCheck(doc, ctx, schema, \"input\", !options?.assertOnly);"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":260,"symbol":"constantNames","kind":"constant","lang":"typescript","doc":"Build the function with hoisted constants Always include INVALID as the first constant","code":"const constantNames = [\"INVALID\", ...ctx.constants.keys()];"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":261,"symbol":"constantValues","kind":"constant","lang":"typescript","code":"const constantValues = [INVALID, ...ctx.constants.values()];"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":263,"symbol":"code","kind":"constant","lang":"typescript","code":"const code = doc.content.join(\"\\n\");"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":264,"symbol":"fullCode","kind":"constant","lang":"typescript","code":"const fullCode = options?.debug\n ? constantNames.length > 0\n ? `// Constants: ${constantNames.join(\", \")}\\n${code}`\n : code\n : \"\";"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":270,"symbol":"F","kind":"constant","lang":"typescript","code":"const F = Function;"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":271,"symbol":"factoryCode","kind":"constant","lang":"typescript","code":"const factoryCode = `return (input) => {\\n${code}\\n}`;"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":274,"symbol":"factory","kind":"constant","lang":"typescript","code":"const factory = new F(...constantNames, factoryCode);"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":287,"symbol":"addConstant","kind":"function","lang":"typescript","code":"function addConstant(ctx: CompileContext, value: unknown): string {\n // Check if we already have this constant\n for (const [name, v] of ctx.constants) {\n if (v === value) return name;\n }\n const name = `c${ctx.constantCounter++}`;\n ctx.constants.set(name, value);\n return name;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":292,"symbol":"name","kind":"constant","lang":"typescript","code":"const name = `c${ctx.constantCounter++}`;"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":298,"symbol":"addUserConstant","kind":"function","lang":"typescript","doc":"Hoists a user-supplied callback. Anything the schema's author wrote can throw, and generated code can reject an earlier sibling before ever reaching it, so this clears `definite` — a rejection is then no longer proof that the interpreter would have rejected rather than thrown.","code":"function addUserConstant(ctx: CompileContext, fn: unknown): string {\n ctx.definite = false;\n return addConstant(ctx, fn);\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":303,"symbol":"newVar","kind":"function","lang":"typescript","code":"function newVar(ctx: CompileContext): string {\n return `v${ctx.varCounter++}`;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":308,"symbol":"runtimeRun","kind":"function","lang":"typescript","doc":"Runs a child schema as a black box: its value, or INVALID for a failure or an async run.","code":"function runtimeRun(schema: SomeType, value: unknown): unknown {\n const result = (schema._zod.run as (p: ParsePayload, c: ParseContextInternal) => any)(\n { value, issues: [] },\n {} as ParseContextInternal\n );\n if (result && typeof (result as Promise<unknown>).then === \"function\") return INVALID;\n const r = result as { value: unknown; issues: unknown[] };\n return r.issues.length === 0 ? r.value : INVALID;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":309,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = (schema._zod.run as (p: ParsePayload, c: ParseContextInternal) => any)(\n { value, issues: [] },\n {} as ParseContextInternal\n );"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":314,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = result as { value: unknown; issues: unknown[] };"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":332,"symbol":"compileChild","kind":"function","lang":"typescript","doc":"`null` means the node built no value because nothing reads it. The overloads keep that case out of the 20-odd callers that always want one, so only a caller passing needsValue has to handle it.","code":"function compileChild(\n doc: Doc,\n ctx: CompileContext,\n schema: SomeType,\n accessor: string,\n needsValue = true\n): string | null {\n const contentLen = doc.content.length;\n const constantCount = ctx.constants.size;\n const constantCounter = ctx.constantCounter;\n const varCounter = ctx.varCounter;\n try {\n return generateCheck(doc, ctx, schema, accessor, needsValue);\n } catch (err) {\n if (!(err instanceof ZodCompileUnsupportedError) || !err.islandable) throw err;\n doc.content.length = contentLen;\n if (ctx.constants.size > constantCount) {\n const trailing = Array.from(ctx.constants.keys()).slice(constantCount);\n for (const k of trailing) ctx.constants.delete(k);\n }\n ctx.constantCounter = constantCounter;\n ctx.varCounter = varCounter;\n return emitRuntimeIsland(doc, ctx, schema, accessor);\n }\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":339,"symbol":"contentLen","kind":"constant","lang":"typescript","code":"const contentLen = doc.content.length;"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":340,"symbol":"constantCount","kind":"constant","lang":"typescript","code":"const constantCount = ctx.constants.size;"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":341,"symbol":"constantCounter","kind":"constant","lang":"typescript","code":"const constantCounter = ctx.constantCounter;"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":342,"symbol":"varCounter","kind":"constant","lang":"typescript","code":"const varCounter = ctx.varCounter;"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":349,"symbol":"trailing","kind":"constant","lang":"typescript","code":"const trailing = Array.from(ctx.constants.keys()).slice(constantCount);"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":358,"symbol":"emitRuntimeIsland","kind":"function","lang":"typescript","code":"function emitRuntimeIsland(doc: Doc, ctx: CompileContext, schema: SomeType, accessor: string): string {\n // an islanded child answers INVALID for an async run too, which the interpreter throws for\n ctx.definite = false;\n const schemaConst = addConstant(ctx, schema);\n const runConst = addConstant(ctx, runtimeRun);\n const outVar = newVar(ctx);\n doc.write(`const ${outVar} = ${runConst}(${schemaConst}, ${accessor});`);\n doc.write(`if (${outVar} === INVALID) return INVALID;`);\n return outVar;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":361,"symbol":"schemaConst","kind":"constant","lang":"typescript","code":"const schemaConst = addConstant(ctx, schema);"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":362,"symbol":"runConst","kind":"constant","lang":"typescript","code":"const runConst = addConstant(ctx, runtimeRun);"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":363,"symbol":"outVar","kind":"constant","lang":"typescript","code":"const outVar = newVar(ctx);"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":370,"symbol":"WHEN_DEFAULTED_CHECKS","kind":"constant","lang":"typescript","doc":"Check classes whose `when` is auto-defaulted at init (checks.ts `when ??=`).","code":"const WHEN_DEFAULTED_CHECKS = new Set([\n \"max_size\",\n \"min_size\",\n \"size_equals\",\n \"max_length\",\n \"min_length\",\n \"length_equals\",\n]);"} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":379,"symbol":"generateChecks","kind":"function","lang":"typescript","code":"function generateChecks(doc: Doc, ctx: CompileContext, schema: SomeType, accessor: string): string {\n const schemaChecks = schema._zod.def.checks as SupportedCheck[] | undefined;\n if (!schemaChecks || schemaChecks.length === 0) return accessor;\n\n // Track current accessor - may change if overwrite checks are encountered\n let currentAccessor = accessor;\n\n for (const check of schemaChecks) {\n const def = check._zod.def;\n // A custom `when` skips a check the fast path always runs; the one auto-defaulted on size/length classes matches its bail-on-first-failure.\n if ((def as { when?: unknown }).when && !WHEN_DEFAULTED_CHECKS.has(def.check)) {\n throw new ZodCompileUnsupportedError(`check with a custom \"when\" condition`);\n }\n switch (def.check) {\n case \"greater_than\":\n generateGreaterThanCheck(doc, ctx, def, currentAccessor);\n break;\n case \"less_than\":\n generateLessThanCheck(doc, ctx, def, currentAccessor);\n break;\n case \"multiple_of\":\n generateMultipleOfCheck(doc, ctx, def, currentAccessor);\n break;\n case \"number_format\":\n generateNumberFormatCheck(doc, def, currentAccessor);\n break;\n "} {"repo":"zod","file":"packages/zod/src/v4/core/compile.ts","line":380,"symbol":"schemaChecks","kind":"constant","lang":"typescript","code":"const schemaChecks = schema._zod.def.checks as SupportedCheck[] | undefined;"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":7,"symbol":"ZodTrait","kind":"type","lang":"typescript","code":"type ZodTrait = { _zod: { def: any; [k: string]: any } };"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":8,"symbol":"$constructor","kind":"interface","lang":"typescript","code":"interface $constructor<T extends ZodTrait, D = T[\"_zod\"][\"def\"]> {\n new (def: D): T;\n init(inst: T, def: D): asserts inst is T;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":13,"symbol":"$constructorParams","kind":"interface","lang":"typescript","code":"interface $constructorParams {\n Parent?: typeof Class;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":18,"symbol":"NEVER","kind":"constant","lang":"typescript","doc":"A special constant with type `never`","code":"const NEVER: never = /*@__PURE__*/ Object.freeze({\n status: \"aborted\",\n}) as never;"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":24,"symbol":"_zodDesc","kind":"constant","lang":"typescript","doc":"Shared descriptor for installing `_zod`; defineProperty reads it synchronously, so reusing one object avoids a per-instance allocation.","code":"const _zodDesc: PropertyDescriptor = { value: undefined, enumerable: false };"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":30,"symbol":"newError","kind":"function","lang":"typescript","doc":"v8 captures a stack trace inside the Error constructor, which dominates a failed parse; costs only the frames, and parse() restores those. the constructor must RUN: Object.create is cheaper and passes instanceof, but Error.isError and util.types.isNativeError check an internal slot","code":"function newError(Definition: new () => any): any {\n const E = _E;\n if (E) {\n const saved = E.stackTraceLimit;\n if (typeof saved === \"number\") {\n try {\n E.stackTraceLimit = 0;\n } catch {\n _E = null;\n return new Definition();\n }\n try {\n return new Definition();\n } finally {\n E.stackTraceLimit = saved;\n }\n }\n }\n return new Definition();\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":31,"symbol":"E","kind":"constant","lang":"typescript","code":"const E = _E;"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":33,"symbol":"saved","kind":"constant","lang":"typescript","code":"const saved = E.stackTraceLimit;"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":51,"symbol":"$constructor","kind":"function","lang":"typescript","code":"function $constructor<T extends ZodTrait, D = T[\"_zod\"][\"def\"]>(\n name: string,\n initializer: (inst: T, def: D) => void,\n /** This trait's members, installed once on every prototype that composes it. They cannot be declared in the initializer above: that runs per instance, and the prototype is shared. */\n proto?: ProtoOf<T>,\n params?: $constructorParams\n): $constructor<T, D> {\n // Prototype for this constructor's `_zod` internals. Lazily-derived fields (`values`, `pattern`, `optin`, …) install here once rather than as an accessor on every instance.\n const zodProto: any = {};\n\n // Assigning the fields in the constructor body is what gives instances in-object slots; building the object literally and reparenting it costs a second allocation and a generic property copy.\n function Internals(this: any, def: D) {\n this.def = def;\n this.constr = _;\n this.traits = new Set();\n }\n Internals.prototype = zodProto;\n\n const protoMembers = proto;\n // One trait's members land on every prototype whose chain composes it, so the answer is per prototype rather than per trait.\n const initialized = protoMembers && new WeakSet<object>();\n\n function init(inst: T, def: D) {\n if (!"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":59,"symbol":"zodProto","kind":"constant","lang":"typescript","doc":"Prototype for this constructor's `_zod` internals. Lazily-derived fields (`values`, `pattern`, `optin`, …) install here once rather than as an accessor on every instance.","code":"const zodProto: any = {};"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":62,"symbol":"Internals","kind":"function","lang":"typescript","doc":"Assigning the fields in the constructor body is what gives instances in-object slots; building the object literally and reparenting it costs a second allocation and a generic property copy.","code":"function Internals(this: any, def: D) {\n this.def = def;\n this.constr = _;\n this.traits = new Set();\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":69,"symbol":"protoMembers","kind":"constant","lang":"typescript","code":"const protoMembers = proto;"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":71,"symbol":"initialized","kind":"constant","lang":"typescript","doc":"One trait's members land on every prototype whose chain composes it, so the answer is per prototype rather than per trait.","code":"const initialized = protoMembers && new WeakSet<object>();"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":73,"symbol":"init","kind":"function","lang":"typescript","code":"function init(inst: T, def: D) {\n if (!inst._zod) {\n _zodDesc.value = new (Internals as any)(def);\n try {\n Object.defineProperty(inst, \"_zod\", _zodDesc);\n } finally {\n // Cleared even on throw, so the shared descriptor never leaks one instance's internals into the next.\n _zodDesc.value = undefined;\n }\n } else if (inst._zod.traits.has(name)) {\n return;\n }\n\n inst._zod.traits.add(name);\n\n initializer(inst, def);\n\n if (initialized) {\n // `super(def)` from a user subclass gives `this` a prototype the subclass owns, and installing there would overwrite whatever the subclass declared. `constr` built the instance, so its prototype is the one below the subclass's that should carry the members. A receiver whose chain never reaches that prototype installs on its own, which for a plain object handed straight to `init` means `Object.prototype` — unchanged from before.\n const own = Object.getPrototypeOf(inst);\n const ctorProto = inst._zod.constr.prototype;\n let up: object | null = own;\n while (up && up !== ctorProto) up = Object.getPrototypeOf(up);\n const target = up ?? own;\n if (!initialized.has(t"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":92,"symbol":"own","kind":"constant","lang":"typescript","doc":"`super(def)` from a user subclass gives `this` a prototype the subclass owns, and installing there would overwrite whatever the subclass declared. `constr` built the instance, so its prototype is the one below the subclass's that should carry the members. A receiver whose chain never reaches that prototype installs on its own, which for a plain object handed straight to `init` means `Object.prototype` — unchanged from before.","code":"const own = Object.getPrototypeOf(inst);"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":93,"symbol":"ctorProto","kind":"constant","lang":"typescript","code":"const ctorProto = inst._zod.constr.prototype;"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":96,"symbol":"target","kind":"constant","lang":"typescript","code":"const target = up ?? own;"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":104,"symbol":"proto","kind":"constant","lang":"typescript","doc":"support prototype modifications; for-in avoids the array allocation of Object.keys on the (usually empty) prototype","code":"const proto = _.prototype;"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":114,"symbol":"Parent","kind":"constant","lang":"typescript","doc":"doesn't work if Parent has a constructor with arguments","code":"const Parent = params?.Parent ?? Object;"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":115,"symbol":"Definition","kind":"class","lang":"typescript","code":"class Definition extends Parent {}"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":118,"symbol":"_","kind":"function","lang":"typescript","code":"function _(this: any, def: D) {\n const inst = params?.Parent ? newError(Definition) : this;\n init(inst, def);\n const deferred = inst._zod.deferred;\n if (deferred) {\n for (const fn of deferred) {\n fn();\n }\n // Released: initializers run once, and the list would otherwise be retained for the schema's lifetime.\n inst._zod.deferred = undefined;\n }\n\n // Global post-processor hook. Internal: installed by `import \"zod/compile\"` to enable AOT compilation for every constructed schema. Runs last, once the instance is fully built, because it hands the instance to compile(). The post-processor is expected to be reentrancy-guarded by its own implementation.\n const pp = (globalThis as GlobalThisWithConfig).__zod_globalConfig?.postProcessor;\n if (pp) pp(inst);\n return inst;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":119,"symbol":"inst","kind":"constant","lang":"typescript","code":"const inst = params?.Parent ? newError(Definition) : this;"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":121,"symbol":"deferred","kind":"constant","lang":"typescript","code":"const deferred = inst._zod.deferred;"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":131,"symbol":"pp","kind":"constant","lang":"typescript","doc":"Global post-processor hook. Internal: installed by `import \"zod/compile\"` to enable AOT compilation for every constructed schema. Runs last, once the instance is fully built, because it hands the instance to compile(). The post-processor is expected to be reentrancy-guarded by its own implementation.","code":"const pp = (globalThis as GlobalThisWithConfig).__zod_globalConfig?.postProcessor;"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":148,"symbol":"$brand","kind":"constant","lang":"typescript","doc":"/////////////////////////// UTILITIES ///////////////////////////////////////","code":"const $brand: unique symbol = /*@__PURE__*/ Symbol(\"zod_brand\");"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":149,"symbol":"$brand","kind":"type","lang":"typescript","code":"type $brand<T extends string | number | symbol = string | number | symbol> = {\n [$brand]: { [k in T]: true };\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":153,"symbol":"$ZodBranded","kind":"type","lang":"typescript","code":"type $ZodBranded<\n T extends schemas.SomeType,\n Brand extends string | number | symbol,\n Dir extends \"in\" | \"out\" | \"inout\" = \"out\",\n> = T &\n (Dir extends \"inout\"\n ? { _zod: { input: input<T> & $brand<Brand>; output: output<T> & $brand<Brand> } }\n : Dir extends \"in\"\n ? { _zod: { input: input<T> & $brand<Brand> } }\n : { _zod: { output: output<T> & $brand<Brand> } });"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":164,"symbol":"$ZodNarrow","kind":"type","lang":"typescript","code":"type $ZodNarrow<T extends schemas.SomeType, Out> = T & { _zod: { output: Out } };"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":166,"symbol":"$ZodAsyncError","kind":"class","lang":"typescript","code":"class $ZodAsyncError extends Error {\n constructor() {\n super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);\n }\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":167,"symbol":"constructor","kind":"method","lang":"typescript","code":"constructor() {\n super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":172,"symbol":"$ZodEncodeError","kind":"class","lang":"typescript","code":"class $ZodEncodeError extends Error {\n constructor(name: string) {\n super(`Encountered unidirectional transform during encode: ${name}`);\n this.name = \"ZodEncodeError\";\n }\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":173,"symbol":"constructor","kind":"method","lang":"typescript","code":"constructor(name: string) {\n super(`Encountered unidirectional transform during encode: ${name}`);\n this.name = \"ZodEncodeError\";\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":185,"symbol":"input","kind":"type","lang":"typescript","doc":"export type input<T extends schemas.$ZodType> = T[\"_zod\"][\"input\"]; export type output<T extends schemas.$ZodType> = T[\"_zod\"][\"output\"]; export type input<T extends schemas.$ZodType> = T[\"_zod\"][\"input\"]; export type output<T extends schemas.$ZodType> = T[\"_zod\"][\"output\"];","code":"type input<T> = T extends { _zod: { input: any } } ? T[\"_zod\"][\"input\"] : unknown;"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":186,"symbol":"output","kind":"type","lang":"typescript","code":"type output<T> = T extends { _zod: { output: any } } ? T[\"_zod\"][\"output\"] : unknown;"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":192,"symbol":"$ZodConfig","kind":"interface","lang":"typescript","code":"interface $ZodConfig {\n /** Custom error map. Overrides `config().localeError`. */\n customError?: errors.$ZodErrorMap | undefined;\n /** Localized error map. Lowest priority. */\n localeError?: errors.$ZodErrorMap | undefined;\n /** Disable JIT schema compilation. Useful in environments that disallow `eval`. */\n jitless?: boolean | undefined;\n /** Enables parsing input that contains reference cycles. Read when a schema is constructed. */\n memoizer?: schemas.$ZodMemoizer | undefined;\n /**\n * Internal: post-processor invoked on every freshly-constructed schema\n * instance, after init and deferred fns run. Set by `import \"zod/compile\"`\n * to install AOT compilation. Not part of the public API.\n * @internal\n */\n postProcessor?: ((inst: any) => void) | undefined;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":210,"symbol":"GlobalThisWithConfig","kind":"interface","lang":"typescript","code":"interface GlobalThisWithConfig {\n /**\n * The globalConfig instance shared across both CommonJS and ESM builds.\n * Attached to `globalThis` (mirroring `__zod_globalRegistry`) so that a\n * single config object is used regardless of how Zod is loaded — CJS,\n * ESM, multiple bundles in a monorepo, etc. This means `z.config(...)`\n * applied against any one instance is observed by all of them, and\n * pre-populating it before Zod loads (e.g. `globalThis.__zod_globalConfig\n * = { jitless: true }` in an inline script) takes effect immediately on\n * import.\n */\n __zod_globalConfig?: $ZodConfig;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":225,"symbol":"globalConfig","kind":"constant","lang":"typescript","code":"const globalConfig: $ZodConfig = (globalThis as GlobalThisWithConfig).__zod_globalConfig!;"} {"repo":"zod","file":"packages/zod/src/v4/core/core.ts","line":227,"symbol":"config","kind":"function","lang":"typescript","code":"function config(newConfig?: Partial<$ZodConfig>): $ZodConfig {\n if (newConfig) Object.assign(globalConfig, newConfig);\n return globalConfig;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/doc.ts","line":1,"symbol":"ModeWriter","kind":"type","lang":"typescript","code":"type ModeWriter = (doc: Doc, modes: { execution: \"sync\" | \"async\" }) => void;"} {"repo":"zod","file":"packages/zod/src/v4/core/doc.ts","line":3,"symbol":"Doc","kind":"class","lang":"typescript","code":"class Doc {\n args: string[];\n /** Bindings the compiled function closes over, by name. */\n closed: Record<string, unknown>;\n content: string[] = [];\n indent = 0;\n\n constructor(args: string[] = [], closed: Record<string, unknown> = {}) {\n this.args = args;\n this.closed = closed;\n }\n\n // the compiler catches a child's throw and keeps writing into this doc, so the indent has to unwind with it\n indented(fn: (doc: Doc) => void) {\n this.indent += 1;\n try {\n fn(this);\n } finally {\n this.indent -= 1;\n }\n }\n\n write(fn: ModeWriter): void;\n write(line: string): void;\n write(arg: any) {\n if (typeof arg === \"function\") {\n (arg as ModeWriter)(this, { execution: \"sync\" });\n (arg as ModeWriter)(this, { execution: \"async\" });\n return;\n }\n\n const content = arg as string;\n const lines = content.split(\"\\n\").filter((x) => x);\n const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));\n const dedented = lines.map((x) => x.slice(minIndent)).map((x) => \" \".repeat(this.indent * 2) + x);\n for (const line of dedented) {\n this.content.push(line);\n }\n }\n\n compile(): any {\n const F = Function;\n co"} {"repo":"zod","file":"packages/zod/src/v4/core/doc.ts","line":10,"symbol":"constructor","kind":"method","lang":"typescript","code":"constructor(args: string[] = [], closed: Record<string, unknown> = {}) {\n this.args = args;\n this.closed = closed;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/doc.ts","line":16,"symbol":"indented","kind":"method","lang":"typescript","doc":"the compiler catches a child's throw and keeps writing into this doc, so the indent has to unwind with it","code":"indented(fn: (doc: Doc) => void) {\n this.indent += 1;\n try {\n fn(this);\n } finally {\n this.indent -= 1;\n }\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/doc.ts","line":27,"symbol":"write","kind":"method","lang":"typescript","code":"write(arg: any) {\n if (typeof arg === \"function\") {\n (arg as ModeWriter)(this, { execution: \"sync\" });\n (arg as ModeWriter)(this, { execution: \"async\" });\n return;\n }\n\n const content = arg as string;\n const lines = content.split(\"\\n\").filter((x) => x);\n const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));\n const dedented = lines.map((x) => x.slice(minIndent)).map((x) => \" \".repeat(this.indent * 2) + x);\n for (const line of dedented) {\n this.content.push(line);\n }\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/doc.ts","line":34,"symbol":"content","kind":"constant","lang":"typescript","code":"const content = arg as string;"} {"repo":"zod","file":"packages/zod/src/v4/core/doc.ts","line":35,"symbol":"lines","kind":"constant","lang":"typescript","code":"const lines = content.split(\"\\n\").filter((x) => x);"} {"repo":"zod","file":"packages/zod/src/v4/core/doc.ts","line":36,"symbol":"minIndent","kind":"constant","lang":"typescript","code":"const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));"} {"repo":"zod","file":"packages/zod/src/v4/core/doc.ts","line":37,"symbol":"dedented","kind":"constant","lang":"typescript","code":"const dedented = lines.map((x) => x.slice(minIndent)).map((x) => \" \".repeat(this.indent * 2) + x);"} {"repo":"zod","file":"packages/zod/src/v4/core/doc.ts","line":43,"symbol":"compile","kind":"method","lang":"typescript","code":"compile(): any {\n const F = Function;\n const content = this?.content ?? [``];\n const factory = new F(\n ...Object.keys(this.closed),\n `return function (${this.args.join(\", \")}) {\\n${content.join(\"\\n\")}\\n};`\n );\n return factory(...Object.values(this.closed)) as any;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/doc.ts","line":44,"symbol":"F","kind":"constant","lang":"typescript","code":"const F = Function;"} {"repo":"zod","file":"packages/zod/src/v4/core/doc.ts","line":45,"symbol":"content","kind":"constant","lang":"typescript","code":"const content = this?.content ?? [``];"} {"repo":"zod","file":"packages/zod/src/v4/core/doc.ts","line":46,"symbol":"factory","kind":"constant","lang":"typescript","code":"const factory = new F(\n ...Object.keys(this.closed),\n `return function (${this.args.join(\", \")}) {\\n${content.join(\"\\n\")}\\n};`\n );"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":10,"symbol":"$ZodIssueBase","kind":"interface","lang":"typescript","doc":"//////////////////////// / base type //// ////////////////////////","code":"interface $ZodIssueBase {\n readonly code?: string;\n readonly input?: unknown;\n readonly path: PropertyKey[];\n readonly message: string;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":20,"symbol":"$ZodInvalidTypeExpected","kind":"type","lang":"typescript","doc":"///////////////////////////// / issue subtypes //// /////////////////////////////","code":"type $ZodInvalidTypeExpected =\n | \"string\"\n | \"number\"\n | \"int\"\n | \"boolean\"\n | \"bigint\"\n | \"symbol\"\n | \"undefined\"\n | \"null\"\n | \"never\"\n | \"void\"\n | \"date\"\n | \"array\"\n | \"object\"\n | \"tuple\"\n | \"record\"\n | \"map\"\n | \"set\"\n | \"file\"\n | \"nonoptional\"\n | \"nan\"\n | \"function\"\n | (string & {});"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":44,"symbol":"$ZodIssueInvalidType","kind":"interface","lang":"typescript","code":"interface $ZodIssueInvalidType<Input = unknown> extends $ZodIssueBase {\n readonly code: \"invalid_type\";\n readonly expected: $ZodInvalidTypeExpected;\n readonly input?: Input;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":50,"symbol":"$ZodIssueTooBig","kind":"interface","lang":"typescript","code":"interface $ZodIssueTooBig<Input = unknown> extends $ZodIssueBase {\n readonly code: \"too_big\";\n readonly origin: \"number\" | \"int\" | \"bigint\" | \"date\" | \"string\" | \"array\" | \"set\" | \"file\" | (string & {});\n readonly maximum: number | bigint;\n readonly inclusive?: boolean;\n readonly exact?: boolean;\n readonly input?: Input;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":59,"symbol":"$ZodIssueTooSmall","kind":"interface","lang":"typescript","code":"interface $ZodIssueTooSmall<Input = unknown> extends $ZodIssueBase {\n readonly code: \"too_small\";\n readonly origin: \"number\" | \"int\" | \"bigint\" | \"date\" | \"string\" | \"array\" | \"set\" | \"file\" | (string & {});\n readonly minimum: number | bigint;\n /** True if the allowable range includes the minimum */\n readonly inclusive?: boolean;\n /** True if the allowed value is fixed (e.g.` z.length(5)`), not a range (`z.minLength(5)`) */\n readonly exact?: boolean;\n readonly input?: Input;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":70,"symbol":"$ZodIssueInvalidStringFormat","kind":"interface","lang":"typescript","code":"interface $ZodIssueInvalidStringFormat extends $ZodIssueBase {\n readonly code: \"invalid_format\";\n readonly format: $ZodStringFormats | (string & {});\n readonly pattern?: string;\n readonly input?: string;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":77,"symbol":"$ZodIssueNotMultipleOf","kind":"interface","lang":"typescript","code":"interface $ZodIssueNotMultipleOf<Input extends number | bigint = number | bigint> extends $ZodIssueBase {\n readonly code: \"not_multiple_of\";\n readonly divisor: number;\n readonly input?: Input;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":83,"symbol":"$ZodIssueUnrecognizedKeys","kind":"interface","lang":"typescript","code":"interface $ZodIssueUnrecognizedKeys extends $ZodIssueBase {\n readonly code: \"unrecognized_keys\";\n readonly keys: string[];\n readonly input?: Record<string, unknown>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":89,"symbol":"$ZodIssueInvalidUnionNoMatch","kind":"interface","lang":"typescript","code":"interface $ZodIssueInvalidUnionNoMatch extends $ZodIssueBase {\n readonly code: \"invalid_union\";\n readonly errors: $ZodIssue[][];\n readonly input?: unknown;\n readonly discriminator?: string | undefined;\n readonly options?: util.Primitive[];\n readonly inclusive?: true;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":98,"symbol":"$ZodIssueInvalidUnionMultipleMatch","kind":"interface","lang":"typescript","code":"interface $ZodIssueInvalidUnionMultipleMatch extends $ZodIssueBase {\n readonly code: \"invalid_union\";\n readonly errors: [];\n readonly input?: unknown;\n readonly discriminator?: string | undefined;\n readonly inclusive: false;\n /** Indices of the options that matched */\n readonly matches: number[];\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":108,"symbol":"$ZodIssueInvalidUnion","kind":"type","lang":"typescript","code":"type $ZodIssueInvalidUnion = $ZodIssueInvalidUnionNoMatch | $ZodIssueInvalidUnionMultipleMatch;"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":110,"symbol":"$ZodIssueInvalidKey","kind":"interface","lang":"typescript","code":"interface $ZodIssueInvalidKey<Input = unknown> extends $ZodIssueBase {\n readonly code: \"invalid_key\";\n readonly origin: \"map\" | \"record\";\n readonly issues: $ZodIssue[];\n readonly input?: Input;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":117,"symbol":"$ZodIssueInvalidElement","kind":"interface","lang":"typescript","code":"interface $ZodIssueInvalidElement<Input = unknown> extends $ZodIssueBase {\n readonly code: \"invalid_element\";\n readonly origin: \"map\" | \"set\";\n readonly key: unknown;\n readonly issues: $ZodIssue[];\n readonly input?: Input;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":125,"symbol":"$ZodIssueInvalidValue","kind":"interface","lang":"typescript","code":"interface $ZodIssueInvalidValue<Input = unknown> extends $ZodIssueBase {\n readonly code: \"invalid_value\";\n readonly values: util.Primitive[];\n readonly input?: Input;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":131,"symbol":"$ZodIssueCustom","kind":"interface","lang":"typescript","code":"interface $ZodIssueCustom extends $ZodIssueBase {\n readonly code: \"custom\";\n readonly params?: Record<string, any> | undefined;\n readonly input?: unknown;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":141,"symbol":"$ZodIssueStringCommonFormats","kind":"interface","lang":"typescript","code":"interface $ZodIssueStringCommonFormats extends $ZodIssueInvalidStringFormat {\n format: Exclude<$ZodStringFormats, \"regex\" | \"jwt\" | \"starts_with\" | \"ends_with\" | \"includes\">;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":145,"symbol":"$ZodIssueStringInvalidRegex","kind":"interface","lang":"typescript","code":"interface $ZodIssueStringInvalidRegex extends $ZodIssueInvalidStringFormat {\n format: \"regex\";\n pattern: string;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":150,"symbol":"$ZodIssueStringInvalidJWT","kind":"interface","lang":"typescript","code":"interface $ZodIssueStringInvalidJWT extends $ZodIssueInvalidStringFormat {\n format: \"jwt\";\n algorithm?: string;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":155,"symbol":"$ZodIssueStringStartsWith","kind":"interface","lang":"typescript","code":"interface $ZodIssueStringStartsWith extends $ZodIssueInvalidStringFormat {\n format: \"starts_with\";\n prefix: string;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":160,"symbol":"$ZodIssueStringEndsWith","kind":"interface","lang":"typescript","code":"interface $ZodIssueStringEndsWith extends $ZodIssueInvalidStringFormat {\n format: \"ends_with\";\n suffix: string;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":165,"symbol":"$ZodIssueStringIncludes","kind":"interface","lang":"typescript","code":"interface $ZodIssueStringIncludes extends $ZodIssueInvalidStringFormat {\n format: \"includes\";\n includes: string;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":170,"symbol":"$ZodStringFormatIssues","kind":"type","lang":"typescript","code":"type $ZodStringFormatIssues =\n | $ZodIssueStringCommonFormats\n | $ZodIssueStringInvalidRegex\n | $ZodIssueStringInvalidJWT\n | $ZodIssueStringStartsWith\n | $ZodIssueStringEndsWith\n | $ZodIssueStringIncludes;"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":182,"symbol":"$ZodIssue","kind":"type","lang":"typescript","code":"type $ZodIssue =\n | $ZodIssueInvalidType\n | $ZodIssueTooBig\n | $ZodIssueTooSmall\n | $ZodIssueInvalidStringFormat\n | $ZodIssueNotMultipleOf\n | $ZodIssueUnrecognizedKeys\n | $ZodIssueInvalidUnion\n | $ZodIssueInvalidKey\n | $ZodIssueInvalidElement\n | $ZodIssueInvalidValue\n | $ZodIssueCustom;"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":195,"symbol":"$ZodIssueCode","kind":"type","lang":"typescript","code":"type $ZodIssueCode = $ZodIssue[\"code\"];"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":197,"symbol":"$ZodInternalIssue","kind":"type","lang":"typescript","code":"type $ZodInternalIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue<T> : never;"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":198,"symbol":"RawIssue","kind":"type","lang":"typescript","code":"type RawIssue<T extends $ZodIssueBase> = T extends any\n ? util.Flatten<\n util.MakePartial<T, \"message\" | \"path\"> & {\n /** The input data */\n readonly input: unknown;\n /** The schema or check that originated this issue. */\n readonly inst?: $ZodType | $ZodCheck;\n /** The schema that owns the issue. Equal to `inst` when a schema originated the issue, and the schema the check was attached to when a check did. */\n readonly schema?: $ZodType | undefined;\n /** If `true`, Zod will continue executing checks/refinements after this issue. */\n readonly continue?: boolean | undefined;\n } & Record<string, unknown>\n >\n : never;"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":213,"symbol":"$ZodRawIssue","kind":"type","lang":"typescript","code":"type $ZodRawIssue<T extends $ZodIssueBase = $ZodIssue> = $ZodInternalIssue<T>;"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":215,"symbol":"$ZodErrorMap","kind":"interface","lang":"typescript","code":"interface $ZodErrorMap<T extends $ZodIssueBase = $ZodIssue> {\n // biome-ignore lint/style/useShorthandFunctionType: interface form is public API\n (issue: $ZodRawIssue<T>): { message: string } | string | undefined | null;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":223,"symbol":"$ZodError","kind":"interface","lang":"typescript","doc":"const ZOD_ERROR: symbol = Symbol.for(\"{{zod.error}}\");","code":"interface $ZodError<T = unknown> extends Error {\n type: T;\n issues: $ZodIssue[];\n _zod: {\n output: T;\n def: $ZodIssue[];\n };\n stack?: string;\n name: string;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":240,"symbol":"_getMessage","kind":"function","lang":"typescript","doc":"Computing the message eagerly is expensive (pretty-printed JSON of all issues), so defer it until first read. The accessor functions and descriptors are shared across instances to keep error construction cheap; the computed message is cached on the internals object. The setter preserves plain assignment semantics for consumers that overwrite `message`.","code":"function _getMessage(this: $ZodError): string {\n const internals = this._zod as { def: $ZodIssue[]; message?: string };\n internals.message ??= JSON.stringify(internals.def, util.jsonStringifyReplacer, 2);\n return internals.message;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":241,"symbol":"internals","kind":"constant","lang":"typescript","code":"const internals = this._zod as { def: $ZodIssue[]; message?: string };"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":245,"symbol":"_setMessage","kind":"function","lang":"typescript","code":"function _setMessage(this: $ZodError, value: string): void {\n (this._zod as { message?: string }).message = value;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":248,"symbol":"_messageDesc","kind":"constant","lang":"typescript","code":"const _messageDesc: PropertyDescriptor = {\n get: _getMessage,\n set: _setMessage,\n enumerable: true,\n configurable: true,\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":254,"symbol":"_issuesDesc","kind":"constant","lang":"typescript","code":"const _issuesDesc: PropertyDescriptor = { value: undefined, enumerable: false };"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":259,"symbol":"_installedToString","kind":"constant","lang":"typescript","doc":"Prototypes that already carry the lazy `toString`. Seeded with the intrinsics so that `init` on a foreign object — it accepts any object — can never install an accessor onto a prototype we do not own.","code":"const _installedToString = /* @__PURE__ */ new WeakSet<object>([Object.prototype, Error.prototype]);"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":261,"symbol":"initializer","kind":"constant","lang":"typescript","code":"const initializer = (inst: $ZodError, def: $ZodIssue[]): void => {\n inst.name = \"$ZodError\";\n // `_zod` is already non-enumerable: $constructor's init defined it with this same descriptor\n _issuesDesc.value = def;\n Object.defineProperty(inst, \"issues\", _issuesDesc);\n // Clear the shared slot; a retained `value` pins the last error's issues.\n _issuesDesc.value = undefined;\n Object.defineProperty(inst, \"message\", _messageDesc);\n\n /* `toString` lives as a non-enumerable lazy getter on the shared\n * prototype; on first access it caches a per-instance closure so\n * detached usage still works. */\n const proto = Object.getPrototypeOf(inst);\n if (!_installedToString.has(proto)) {\n _installedToString.add(proto);\n Object.defineProperty(proto, \"toString\", {\n configurable: true,\n enumerable: false,\n get(this: $ZodError) {\n const value = () => this.message;\n Object.defineProperty(this, \"toString\", { value, configurable: true, writable: true });\n return value;\n },\n set(this: $ZodError, value: unknown) {\n Object.defineProperty(this, \"toString\", { value, configurable: true, writable: true });\n },\n });\n }\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":273,"symbol":"proto","kind":"constant","lang":"typescript","doc":"`toString` lives as a non-enumerable lazy getter on the shared prototype; on first access it caches a per-instance closure so detached usage still works.","code":"const proto = Object.getPrototypeOf(inst);"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":279,"symbol":"get","kind":"method","lang":"typescript","code":"get(this: $ZodError) {\n const value = () => this.message;\n Object.defineProperty(this, \"toString\", { value, configurable: true, writable: true });\n return value;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":280,"symbol":"value","kind":"constant","lang":"typescript","code":"const value = () => this.message;"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":284,"symbol":"set","kind":"method","lang":"typescript","code":"set(this: $ZodError, value: unknown) {\n Object.defineProperty(this, \"toString\", { value, configurable: true, writable: true });\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":291,"symbol":"$ZodError","kind":"constant","lang":"typescript","code":"const $ZodError: $constructor<$ZodError> = $constructor(\"$ZodError\", initializer);"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":292,"symbol":"$ZodRealError","kind":"interface","lang":"typescript","code":"interface $ZodRealError<T = any> extends $ZodError<T> {}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":293,"symbol":"$ZodRealError","kind":"constant","lang":"typescript","code":"const $ZodRealError: $constructor<$ZodRealError> = $constructor(\"$ZodError\", initializer, undefined, {\n Parent: Error,\n});"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":300,"symbol":"$ZodFlattenedError","kind":"type","lang":"typescript","doc":"flatten","code":"type $ZodFlattenedError<T, U = string> = _FlattenedError<T, U>;"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":301,"symbol":"_FlattenedError","kind":"type","lang":"typescript","code":"type _FlattenedError<T, U = string> = {\n formErrors: U[];\n fieldErrors: {\n [P in keyof T]?: U[];\n };\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":311,"symbol":"node","kind":"function","lang":"typescript","doc":"Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member (\"toString\", \"constructor\") would otherwise read through to the prototype, and assigning \"__proto__\" would hit the setter instead of creating a key.","code":"function node<T>(obj: any, key: PropertyKey, make: () => T): T {\n if (!Object.prototype.hasOwnProperty.call(obj, key)) {\n if (key === \"__proto__\") {\n Object.defineProperty(obj, key, { value: make(), writable: true, enumerable: true, configurable: true });\n } else {\n obj[key] = make();\n }\n }\n return obj[key];\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":324,"symbol":"flattenError","kind":"function","lang":"typescript","code":"function flattenError<T, U>(error: $ZodError<T>, mapper = (issue: $ZodIssue) => issue.message as U) {\n const fieldErrors: Record<PropertyKey, any> = {};\n const formErrors: U[] = [];\n for (const sub of error.issues) {\n if (sub.path.length > 0) {\n node<U[]>(fieldErrors, sub.path[0]!, () => []).push(mapper(sub));\n } else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":325,"symbol":"fieldErrors","kind":"constant","lang":"typescript","code":"const fieldErrors: Record<PropertyKey, any> = {};"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":326,"symbol":"formErrors","kind":"constant","lang":"typescript","code":"const formErrors: U[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":337,"symbol":"_ZodFormattedError","kind":"type","lang":"typescript","code":"type _ZodFormattedError<T, U = string> = T extends [any, ...any[]]\n ? { [K in keyof T]?: $ZodFormattedError<T[K], U> }\n : T extends any[]\n ? { [k: number]: $ZodFormattedError<T[number], U> }\n : T extends object\n ? util.Flatten<{ [K in keyof T]?: $ZodFormattedError<T[K], U> }>\n : any;"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":345,"symbol":"$ZodFormattedError","kind":"type","lang":"typescript","code":"type $ZodFormattedError<T, U = string> = {\n _errors: U[];\n} & util.Flatten<_ZodFormattedError<T, U>>;"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":351,"symbol":"formatError","kind":"function","lang":"typescript","code":"function formatError<T, U>(error: $ZodError<T>, mapper = (issue: $ZodIssue) => issue.message as U) {\n const fieldErrors: $ZodFormattedError<T> = { _errors: [] } as any;\n const processError = (error: { issues: $ZodIssue[] }, path: PropertyKey[] = []) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\" && issue.errors.length) {\n issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));\n } else if (issue.code === \"invalid_key\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n } else if (issue.code === \"invalid_element\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n } else {\n const fullpath = [...path, ...issue.path];\n if (fullpath.length === 0) {\n (fieldErrors as any)._errors.push(mapper(issue));\n } else {\n let curr: any = fieldErrors;\n let i = 0;\n while (i < fullpath.length) {\n const el = fullpath[i]!;\n const terminal = i === fullpath.length - 1;\n\n // `_errors` is reserved by this legacy format, so merge a matching path segment into the current node instead"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":352,"symbol":"fieldErrors","kind":"constant","lang":"typescript","code":"const fieldErrors: $ZodFormattedError<T> = { _errors: [] } as any;"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":353,"symbol":"processError","kind":"constant","lang":"typescript","code":"const processError = (error: { issues: $ZodIssue[] }, path: PropertyKey[] = []) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\" && issue.errors.length) {\n issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));\n } else if (issue.code === \"invalid_key\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n } else if (issue.code === \"invalid_element\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n } else {\n const fullpath = [...path, ...issue.path];\n if (fullpath.length === 0) {\n (fieldErrors as any)._errors.push(mapper(issue));\n } else {\n let curr: any = fieldErrors;\n let i = 0;\n while (i < fullpath.length) {\n const el = fullpath[i]!;\n const terminal = i === fullpath.length - 1;\n\n // `_errors` is reserved by this legacy format, so merge a matching path segment into the current node instead of treating its array as a child.\n if (el === \"_errors\") {\n if (terminal) curr._errors.push(mapper(issue));\n i++;\n contin"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":362,"symbol":"fullpath","kind":"constant","lang":"typescript","code":"const fullpath = [...path, ...issue.path];"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":369,"symbol":"el","kind":"constant","lang":"typescript","code":"const el = fullpath[i]!;"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":370,"symbol":"terminal","kind":"constant","lang":"typescript","code":"const terminal = i === fullpath.length - 1;"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":393,"symbol":"node","kind":"constant","lang":"typescript","code":"const node = curr[el];"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":408,"symbol":"$ZodErrorTree","kind":"type","lang":"typescript","code":"type $ZodErrorTree<T, U = string> = T extends util.Primitive\n ? { errors: U[] }\n : T extends [any, ...any[]]\n ? { errors: U[]; items?: { [K in keyof T]?: $ZodErrorTree<T[K], U> } }\n : T extends any[]\n ? { errors: U[]; items?: Array<$ZodErrorTree<T[number], U>> }\n : T extends object\n ? {\n errors: U[];\n properties?: { [K in keyof T]?: $ZodErrorTree<T[K], U> };\n }\n : { errors: U[] };"} {"repo":"zod","file":"packages/zod/src/v4/core/errors.ts","line":423,"symbol":"treeifyError","kind":"function","lang":"typescript","code":"function treeifyError<T, U>(error: $ZodError<T>, mapper = (issue: $ZodIssue) => issue.message as U) {\n const result: $ZodErrorTree<T, U> = { errors: [] } as any;\n const processError = (error: { issues: $ZodIssue[] }, path: PropertyKey[] = []) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\" && issue.errors.length) {\n // regular union error\n issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));\n } else if (issue.code === \"invalid_key\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n } else if (issue.code === \"invalid_element\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n } else {\n const fullpath = [...path, ...issue.path];\n if (fullpath.length === 0) {\n result.errors.push(mapper(issue));\n continue;\n }\n\n let curr: any = result;\n let i = 0;\n while (i < fullpath.length) {\n const el = fullpath[i]!;\n\n const terminal = i === fullpath.length - 1;\n if (typeof el === \"string\") {\n curr.properties ??= {};\n // el may collide with an "} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-generator.ts","line":20,"symbol":"EmitParams","kind":"type","lang":"typescript","doc":"Parameters for the emit method of JSONSchemaGenerator. @deprecated Use toJSONSchema function instead","code":"type EmitParams = Pick<JSONSchemaGeneratorParams, \"cycles\" | \"reused\" | \"external\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-generator.ts","line":26,"symbol":"JSONSchemaGeneratorConstructorParams","kind":"type","lang":"typescript","doc":"Parameters for JSONSchemaGenerator constructor. @deprecated Use toJSONSchema function instead","code":"type JSONSchemaGeneratorConstructorParams = Pick<\n JSONSchemaGeneratorParams,\n \"metadata\" | \"target\" | \"unrepresentable\" | \"override\" | \"io\"\n>;"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-generator.ts","line":48,"symbol":"JSONSchemaGenerator","kind":"class","lang":"typescript","doc":"const result = gen.emit(schema); // Preferred modern usage const result = toJSONSchema(schema, { target: \"draft-07\" }); ```","code":"class JSONSchemaGenerator {\n private ctx: ToJSONSchemaContext;\n\n /** @deprecated Access via ctx instead */\n get metadataRegistry(): $ZodRegistry<Record<string, any>> {\n return this.ctx.metadataRegistry;\n }\n /** @deprecated Access via ctx instead */\n get target() {\n return this.ctx.target;\n }\n // annotated so the .d.cts emits an indexed access rather than an inline `import()` of an ESM path\n /** @deprecated Access via ctx instead */\n get unrepresentable(): ToJSONSchemaContext[\"unrepresentable\"] {\n return this.ctx.unrepresentable;\n }\n /** @deprecated Access via ctx instead */\n get override() {\n return this.ctx.override;\n }\n /** @deprecated Access via ctx instead */\n get io() {\n return this.ctx.io;\n }\n /** @deprecated Access via ctx instead */\n get counter() {\n return this.ctx.counter;\n }\n set counter(value: number) {\n this.ctx.counter = value;\n }\n /** @deprecated Access via ctx instead */\n get seen(): Map<schemas.$ZodType, Seen> {\n return this.ctx.seen;\n }\n\n constructor(params?: JSONSchemaGeneratorConstructorParams) {\n // Normalize target for internal context\n let normalizedTarget: ToJSONSchemaContext[\"target\"] = params?.target "} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-generator.ts","line":52,"symbol":"metadataRegistry","kind":"method","lang":"typescript","doc":"@deprecated Access via ctx instead","code":"get metadataRegistry(): $ZodRegistry<Record<string, any>> {\n return this.ctx.metadataRegistry;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-generator.ts","line":56,"symbol":"target","kind":"method","lang":"typescript","doc":"@deprecated Access via ctx instead","code":"get target() {\n return this.ctx.target;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-generator.ts","line":61,"symbol":"unrepresentable","kind":"method","lang":"typescript","doc":"annotated so the .d.cts emits an indexed access rather than an inline `import()` of an ESM path @deprecated Access via ctx instead","code":"get unrepresentable(): ToJSONSchemaContext[\"unrepresentable\"] {\n return this.ctx.unrepresentable;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-generator.ts","line":65,"symbol":"override","kind":"method","lang":"typescript","doc":"@deprecated Access via ctx instead","code":"get override() {\n return this.ctx.override;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-generator.ts","line":69,"symbol":"io","kind":"method","lang":"typescript","doc":"@deprecated Access via ctx instead","code":"get io() {\n return this.ctx.io;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-generator.ts","line":73,"symbol":"counter","kind":"method","lang":"typescript","doc":"@deprecated Access via ctx instead","code":"get counter() {\n return this.ctx.counter;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-generator.ts","line":76,"symbol":"counter","kind":"method","lang":"typescript","code":"set counter(value: number) {\n this.ctx.counter = value;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-generator.ts","line":80,"symbol":"seen","kind":"method","lang":"typescript","doc":"@deprecated Access via ctx instead","code":"get seen(): Map<schemas.$ZodType, Seen> {\n return this.ctx.seen;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-generator.ts","line":84,"symbol":"constructor","kind":"method","lang":"typescript","code":"constructor(params?: JSONSchemaGeneratorConstructorParams) {\n // Normalize target for internal context\n let normalizedTarget: ToJSONSchemaContext[\"target\"] = params?.target ?? \"draft-2020-12\";\n if (normalizedTarget === \"draft-4\") normalizedTarget = \"draft-04\";\n if (normalizedTarget === \"draft-7\") normalizedTarget = \"draft-07\";\n\n this.ctx = initializeContext({\n processors: allProcessors,\n target: normalizedTarget,\n ...(params?.metadata && { metadata: params.metadata }),\n ...(params?.unrepresentable && { unrepresentable: params.unrepresentable }),\n ...(params?.override && { override: params.override as any }),\n ...(params?.io && { io: params.io }),\n });\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-generator.ts","line":104,"symbol":"process","kind":"method","lang":"typescript","doc":"Process a schema to prepare it for JSON Schema generation. This must be called before emit().","code":"process(schema: schemas.$ZodType, _params: ProcessParams = { path: [], schemaPath: [] }): JSONSchema.BaseSchema {\n return processSchema(schema, this.ctx, _params);\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-generator.ts","line":112,"symbol":"emit","kind":"method","lang":"typescript","doc":"Emit the final JSON Schema after processing. Must call process() first.","code":"emit(schema: schemas.$ZodType, _params?: EmitParams): JSONSchema.BaseSchema {\n // Apply emit params to the context\n if (_params) {\n if (_params.cycles) this.ctx.cycles = _params.cycles;\n if (_params.reused) this.ctx.reused = _params.reused;\n if (_params.external) this.ctx.external = _params.external;\n }\n\n // extractDefs/finalize skip their whole-map passes when they have already run for this `external`, but they also branch on `cycles`, `reused`, `seen.count` and the metadata registry — any of which can change between emits, including with no params at all. Drop the guards so the passes re-run. The registry conversion calls extractDefs/finalize directly and never routes through here, so it keeps skipping them.\n this.ctx.sharedDefsExtractedFor = undefined;\n this.ctx.sharedEmitDoneFor = undefined;\n\n extractDefs(this.ctx, schema);\n const result = finalize(this.ctx, schema);\n\n // Strip ~standard property to match old implementation's return type\n const { \"~standard\": _, ...plainResult } = result as any;\n return plainResult as JSONSchema.BaseSchema;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-generator.ts","line":125,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = finalize(this.ctx, schema);"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":26,"symbol":"Bound","kind":"type","lang":"typescript","doc":"constraint metadata comes from folding `def.checks` here, not from trusting `_zod.bag`: the bag is written by each check's own `onattach` in chain order, which has repeatedly produced order-dependent and lossy values (#6550). runtime checks are a conjunction, so every merge below is the conjunction's — tightest bound wins, patterns union, divisors collect, mime lists intersect","code":"type Bound = number | bigint | Date;"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":28,"symbol":"CheckAggregate","kind":"interface","lang":"typescript","code":"interface CheckAggregate<N extends Bound = Bound> {\n minimum?: N;\n maximum?: N;\n exclusiveMinimum?: N;\n exclusiveMaximum?: N;\n multipleOf?: number[];\n format?: string;\n // ORed across formats: any integer format keeps the conjunction integer, whatever format lands last\n isInt?: boolean;\n patterns?: Set<RegExp>;\n mime?: string[];\n contentEncoding?: string;\n // a datetime that drops the offset or the seconds accepts what `date-time` forbids, so the keyword is withheld\n laxFormat?: boolean;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":44,"symbol":"narrowMin","kind":"constant","lang":"typescript","code":"const narrowMin = (agg: CheckAggregate, key: \"minimum\" | \"exclusiveMinimum\", value: Bound): void => {\n if (agg[key] === undefined || value > agg[key]) agg[key] = value;\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":47,"symbol":"narrowMax","kind":"constant","lang":"typescript","code":"const narrowMax = (agg: CheckAggregate, key: \"maximum\" | \"exclusiveMaximum\", value: Bound): void => {\n if (agg[key] === undefined || value < agg[key]) agg[key] = value;\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":50,"symbol":"narrowBoth","kind":"constant","lang":"typescript","code":"const narrowBoth = (agg: CheckAggregate, value: number): void => {\n narrowMin(agg, \"minimum\", value);\n narrowMax(agg, \"maximum\", value);\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":54,"symbol":"addDivisor","kind":"constant","lang":"typescript","code":"const addDivisor = (agg: CheckAggregate, value: number): void => {\n agg.multipleOf ??= [];\n if (!agg.multipleOf.includes(value)) agg.multipleOf.push(value);\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":58,"symbol":"addPattern","kind":"constant","lang":"typescript","code":"const addPattern = (agg: CheckAggregate, pattern: RegExp): void => {\n agg.patterns ??= new Set();\n agg.patterns.add(pattern);\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":62,"symbol":"intersectMime","kind":"constant","lang":"typescript","code":"const intersectMime = (agg: CheckAggregate, mime: string[]): void => {\n agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":66,"symbol":"setFormat","kind":"constant","lang":"typescript","doc":"last-wins, matching the bag's historical write order; the flag keeps an integer format from being lost to a later float one","code":"const setFormat = (agg: CheckAggregate, format: string): void => {\n agg.format = format;\n if (format.includes(\"int\")) agg.isInt = true;\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":71,"symbol":"Contributor","kind":"type","lang":"typescript","code":"type Contributor = (agg: CheckAggregate, def: any) => void;"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":72,"symbol":"minContributor","kind":"constant","lang":"typescript","code":"const minContributor: Contributor = (agg, def) => narrowMin(agg, \"minimum\", def.minimum);"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":73,"symbol":"maxContributor","kind":"constant","lang":"typescript","code":"const maxContributor: Contributor = (agg, def) => narrowMax(agg, \"maximum\", def.maximum);"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":74,"symbol":"formatContributor","kind":"constant","lang":"typescript","code":"const formatContributor =\n (ranges: Record<string, [Bound, Bound]>): Contributor =>\n (agg, def) => {\n setFormat(agg, def.format);\n const [minimum, maximum] = ranges[def.format]!;\n narrowMin(agg, \"minimum\", minimum);\n narrowMax(agg, \"maximum\", maximum);\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":83,"symbol":"contributors","kind":"constant","lang":"typescript","code":"const contributors: Record<string, Contributor> = {\n greater_than: (agg, def) => narrowMin(agg, def.inclusive ? \"minimum\" : \"exclusiveMinimum\", def.value),\n less_than: (agg, def) => narrowMax(agg, def.inclusive ? \"maximum\" : \"exclusiveMaximum\", def.value),\n multiple_of: (agg, def) => addDivisor(agg, def.value),\n number_format: formatContributor(NUMBER_FORMAT_RANGES),\n bigint_format: formatContributor(BIGINT_FORMAT_RANGES),\n min_length: minContributor,\n max_length: maxContributor,\n length_equals: (agg, def) => narrowBoth(agg, def.length),\n min_size: minContributor,\n max_size: maxContributor,\n size_equals: (agg, def) => narrowBoth(agg, def.size),\n string_format: (agg, def) => {\n setFormat(agg, def.format);\n if (def.pattern) addPattern(agg, def.pattern);\n if (def.format === \"base64\" || def.format === \"base64url\") agg.contentEncoding = def.format;\n if (def.local || def.precision === -1) agg.laxFormat = true;\n },\n mime_type: (agg, def) => intersectMime(agg, def.mime),\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":104,"symbol":"aggregateChecks","kind":"function","lang":"typescript","code":"function aggregateChecks<N extends Bound = Bound>(schema: schemas.$ZodType): CheckAggregate<N> {\n const agg: CheckAggregate = {};\n const def = schema._zod.def;\n // a format schema is its own first check, same rule as $ZodType init\n const list: checks.$ZodCheck[] = schema._zod.traits.has(\"$ZodCheck\")\n ? [schema as unknown as checks.$ZodCheck, ...(def.checks ?? [])]\n : (def.checks ?? []);\n for (const ch of list) contributors[ch._zod.def.check]?.(agg, ch._zod.def);\n\n // reconcile with the bag so third-party onattach contributions still land; first-party residue is never tighter than the fold, so merging it back is idempotent for one and additive for the other\n const bag = schema._zod.bag as Omit<CheckAggregate, \"multipleOf\"> & { multipleOf?: number };\n if (bag.minimum !== undefined) narrowMin(agg, \"minimum\", bag.minimum);\n if (bag.exclusiveMinimum !== undefined) narrowMin(agg, \"exclusiveMinimum\", bag.exclusiveMinimum);\n if (bag.maximum !== undefined) narrowMax(agg, \"maximum\", bag.maximum);\n if (bag.exclusiveMaximum !== undefined) narrowMax(agg, \"exclusiveMaximum\", bag.exclusiveMaximum);\n if (bag.multipleOf !== undefined) addDivisor(agg, bag.multipleOf);\n if (bag.for"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":105,"symbol":"agg","kind":"constant","lang":"typescript","code":"const agg: CheckAggregate = {};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":106,"symbol":"def","kind":"constant","lang":"typescript","code":"const def = schema._zod.def;"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":108,"symbol":"list","kind":"constant","lang":"typescript","doc":"a format schema is its own first check, same rule as $ZodType init","code":"const list: checks.$ZodCheck[] = schema._zod.traits.has(\"$ZodCheck\")\n ? [schema as unknown as checks.$ZodCheck, ...(def.checks ?? [])]\n : (def.checks ?? []);"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":114,"symbol":"bag","kind":"constant","lang":"typescript","doc":"reconcile with the bag so third-party onattach contributions still land; first-party residue is never tighter than the fold, so merging it back is idempotent for one and additive for the other","code":"const bag = schema._zod.bag as Omit<CheckAggregate, \"multipleOf\"> & { multipleOf?: number };"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":129,"symbol":"formatMap","kind":"constant","lang":"typescript","code":"const formatMap: Partial<Record<checks.$ZodStringFormats, string | undefined>> = {\n guid: \"uuid\",\n url: \"uri\",\n datetime: \"date-time\",\n json_string: \"json-string\",\n regex: \"\", // do not set\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":140,"symbol":"exactPatterns","kind":"constant","lang":"typescript","doc":"the runtime patterns are lax so parse paths never overflow the regex stack; the emitted schema swaps in the exact block forms, which zod itself never executes","code":"const exactPatterns: Map<RegExp, RegExp> = new Map([\n [base64Charset, regexes.base64],\n [base64urlCharset, regexes.base64url],\n]);"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":144,"symbol":"exactPattern","kind":"constant","lang":"typescript","code":"const exactPattern = (p: RegExp): RegExp => exactPatterns.get(p) ?? p;"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":146,"symbol":"stringProcessor","kind":"constant","lang":"typescript","code":"const stringProcessor: Processor<schemas.$ZodString> = (schema, ctx, _json, _params) => {\n const json = _json as JSONSchema.StringSchema;\n json.type = \"string\";\n const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);\n if (typeof minimum === \"number\") json.minLength = minimum;\n if (typeof maximum === \"number\") json.maxLength = maximum;\n // custom pattern overrides format\n if (format) {\n json.format = formatMap[format as checks.$ZodStringFormats] ?? format;\n if (json.format === \"\") delete json.format; // empty format is not valid\n\n // `z.iso.time()` is never full-time, and `laxFormat` carries the datetime shapes that also accept what their keyword forbids\n if (format === \"time\" || laxFormat) {\n delete json.format;\n }\n }\n if (contentEncoding) json.contentEncoding = contentEncoding;\n if (patterns && patterns.size > 0) {\n const patternList = [...patterns].map(exactPattern);\n if (patternList.length === 1) json.pattern = patternList[0]!.source;\n else if (patternList.length > 1) {\n json.allOf = [\n ...patternList.map((regex) => ({\n ...(ctx.target === \"draft-07\" || ctx.target === \"draft-0"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":147,"symbol":"json","kind":"constant","lang":"typescript","code":"const json = _json as JSONSchema.StringSchema;"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":164,"symbol":"patternList","kind":"constant","lang":"typescript","code":"const patternList = [...patterns].map(exactPattern);"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":179,"symbol":"numberProcessor","kind":"constant","lang":"typescript","code":"const numberProcessor: Processor<schemas.$ZodNumber> = (schema, ctx, _json, params) => {\n const json = _json as JSONSchema.NumberSchema | JSONSchema.IntegerSchema;\n const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks<number>(schema);\n json.type = isInt ? \"integer\" : \"number\";\n\n // when both minimum and exclusiveMinimum exist, pick the more restrictive one\n const exMin = typeof exclusiveMinimum === \"number\" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);\n const exMax = typeof exclusiveMaximum === \"number\" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);\n const legacy = ctx.target === \"draft-04\" || ctx.target === \"openapi-3.0\";\n\n if (exMin) {\n if (legacy) {\n json.minimum = exclusiveMinimum;\n json.exclusiveMinimum = true;\n } else {\n json.exclusiveMinimum = exclusiveMinimum;\n }\n } else if (typeof minimum === \"number\") {\n json.minimum = minimum;\n }\n\n if (exMax) {\n if (legacy) {\n json.maximum = exclusiveMaximum;\n json.exclusiveMaximum = true;\n } else {\n json.exclusiveMaximum = exclusiveMaximum;\n }\n } else if (typeof maximum === \"number\") {\n json.max"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":180,"symbol":"json","kind":"constant","lang":"typescript","code":"const json = _json as JSONSchema.NumberSchema | JSONSchema.IntegerSchema;"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":185,"symbol":"exMin","kind":"constant","lang":"typescript","doc":"when both minimum and exclusiveMinimum exist, pick the more restrictive one","code":"const exMin = typeof exclusiveMinimum === \"number\" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":186,"symbol":"exMax","kind":"constant","lang":"typescript","code":"const exMax = typeof exclusiveMaximum === \"number\" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":187,"symbol":"legacy","kind":"constant","lang":"typescript","code":"const legacy = ctx.target === \"draft-04\" || ctx.target === \"openapi-3.0\";"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":213,"symbol":"divisors","kind":"constant","lang":"typescript","doc":"JSON Schema requires a divisor strictly greater than zero, and a non-finite one does not survive JSON at all. A negative divisor accepts exactly what its absolute value accepts, so it still maps; zero, NaN and Infinity have no keyword form.","code":"const divisors = new Set<number>();"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":232,"symbol":"booleanProcessor","kind":"constant","lang":"typescript","code":"const booleanProcessor: Processor<schemas.$ZodBoolean> = (_schema, _ctx, json, _params) => {\n (json as JSONSchema.BooleanSchema).type = \"boolean\";\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":236,"symbol":"bigintProcessor","kind":"constant","lang":"typescript","code":"const bigintProcessor: Processor<schemas.$ZodBigInt> = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"BigInt cannot be represented in JSON Schema\");\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":240,"symbol":"symbolProcessor","kind":"constant","lang":"typescript","code":"const symbolProcessor: Processor<schemas.$ZodSymbol> = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Symbols cannot be represented in JSON Schema\");\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":244,"symbol":"nullProcessor","kind":"constant","lang":"typescript","code":"const nullProcessor: Processor<schemas.$ZodNull> = (_schema, ctx, json, _params) => {\n if (ctx.target === \"openapi-3.0\") {\n json.type = \"string\";\n json.nullable = true;\n json.enum = [null];\n } else {\n json.type = \"null\";\n }\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":254,"symbol":"undefinedProcessor","kind":"constant","lang":"typescript","code":"const undefinedProcessor: Processor<schemas.$ZodUndefined> = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Undefined cannot be represented in JSON Schema\");\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":258,"symbol":"voidProcessor","kind":"constant","lang":"typescript","code":"const voidProcessor: Processor<schemas.$ZodVoid> = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Void cannot be represented in JSON Schema\");\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":262,"symbol":"neverProcessor","kind":"constant","lang":"typescript","code":"const neverProcessor: Processor<schemas.$ZodNever> = (_schema, _ctx, json, _params) => {\n json.not = {};\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":266,"symbol":"anyProcessor","kind":"constant","lang":"typescript","code":"const anyProcessor: Processor<schemas.$ZodAny> = (_schema, _ctx, _json, _params) => {\n // empty schema accepts anything\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":270,"symbol":"unknownProcessor","kind":"constant","lang":"typescript","code":"const unknownProcessor: Processor<schemas.$ZodUnknown> = (_schema, _ctx, _json, _params) => {\n // empty schema accepts anything\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":274,"symbol":"dateProcessor","kind":"constant","lang":"typescript","code":"const dateProcessor: Processor<schemas.$ZodDate> = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Date cannot be represented in JSON Schema\");\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":278,"symbol":"enumProcessor","kind":"constant","lang":"typescript","code":"const enumProcessor: Processor<schemas.$ZodEnum> = (schema, _ctx, json, _params) => {\n const def = schema._zod.def as schemas.$ZodEnumDef;\n const values = getEnumValues(def.entries);\n\n // an empty enum accepts nothing, same as z.never()\n if (values.length === 0) {\n json.not = {};\n return;\n }\n\n // Number enums can have both string and number values\n if (values.every((v) => typeof v === \"number\")) json.type = \"number\";\n if (values.every((v) => typeof v === \"string\")) json.type = \"string\";\n json.enum = values;\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":279,"symbol":"def","kind":"constant","lang":"typescript","code":"const def = schema._zod.def as schemas.$ZodEnumDef;"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":280,"symbol":"values","kind":"constant","lang":"typescript","code":"const values = getEnumValues(def.entries);"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":294,"symbol":"literalProcessor","kind":"constant","lang":"typescript","code":"const literalProcessor: Processor<schemas.$ZodLiteral> = (schema, ctx, json, params) => {\n const def = schema._zod.def as schemas.$ZodLiteralDef<any>;\n\n // a literal with no values accepts nothing, same as z.never()\n if (def.values.length === 0) {\n json.not = {};\n return;\n }\n\n const vals: (string | number | boolean | null)[] = [];\n for (const val of def.values) {\n if (val === undefined) {\n // a custom schema replaces the whole literal, so there is nothing left to accumulate\n if (handleUnrepresentable(schema, ctx, json, params, \"Literal `undefined` cannot be represented in JSON Schema\"))\n return;\n // otherwise do not add to vals\n } else if (typeof val === \"bigint\") {\n if (handleUnrepresentable(schema, ctx, json, params, \"BigInt literals cannot be represented in JSON Schema\"))\n return;\n vals.push(Number(val));\n } else {\n vals.push(val);\n }\n }\n if (vals.length === 0) {\n // do nothing (an undefined literal was stripped)\n } else if (vals.length === 1) {\n const val = vals[0]!;\n json.type = val === null ? (\"null\" as const) : (typeof val as any);\n if (ctx.target === \"draft-04\" || ctx.target === \"openapi-3.0\""} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":295,"symbol":"def","kind":"constant","lang":"typescript","code":"const def = schema._zod.def as schemas.$ZodLiteralDef<any>;"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":303,"symbol":"vals","kind":"constant","lang":"typescript","code":"const vals: (string | number | boolean | null)[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":321,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = vals[0]!;"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":337,"symbol":"nanProcessor","kind":"constant","lang":"typescript","code":"const nanProcessor: Processor<schemas.$ZodNaN> = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"NaN cannot be represented in JSON Schema\");\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":341,"symbol":"templateLiteralProcessor","kind":"constant","lang":"typescript","code":"const templateLiteralProcessor: Processor<schemas.$ZodTemplateLiteral> = (schema, _ctx, json, _params) => {\n const _json = json as JSONSchema.StringSchema;\n const pattern = schema._zod.pattern;\n if (!pattern) throw new Error(\"Pattern not found in template literal\");\n _json.type = \"string\";\n _json.pattern = pattern.source;\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":342,"symbol":"_json","kind":"constant","lang":"typescript","code":"const _json = json as JSONSchema.StringSchema;"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":343,"symbol":"pattern","kind":"constant","lang":"typescript","code":"const pattern = schema._zod.pattern;"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":349,"symbol":"fileProcessor","kind":"constant","lang":"typescript","code":"const fileProcessor: Processor<schemas.$ZodFile> = (schema, _ctx, json, _params) => {\n const _json = json as JSONSchema.StringSchema;\n _json.type = \"string\";\n _json.format = \"binary\";\n _json.contentEncoding = \"binary\";\n\n const { minimum, maximum, mime } = aggregateChecks<number>(schema);\n if (minimum !== undefined) _json.minLength = minimum;\n if (maximum !== undefined) _json.maxLength = maximum;\n if (!mime) return;\n // an empty intersection means the mime checks share no value, so nothing passes at runtime; `anyOf` must be non-empty, so the false schema is `not: {}`\n if (mime.length === 0) _json.not = {};\n else if (mime.length === 1) _json.contentMediaType = mime[0]!;\n // only contentMediaType differs, so the shared props stay at the root\n else _json.anyOf = mime.map((m) => ({ contentMediaType: m }));\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":350,"symbol":"_json","kind":"constant","lang":"typescript","code":"const _json = json as JSONSchema.StringSchema;"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":366,"symbol":"successProcessor","kind":"constant","lang":"typescript","code":"const successProcessor: Processor<schemas.$ZodSuccess> = (_schema, _ctx, json, _params) => {\n (json as JSONSchema.BooleanSchema).type = \"boolean\";\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":370,"symbol":"customProcessor","kind":"constant","lang":"typescript","code":"const customProcessor: Processor<schemas.$ZodCustom> = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Custom types cannot be represented in JSON Schema\");\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":374,"symbol":"functionProcessor","kind":"constant","lang":"typescript","code":"const functionProcessor: Processor<schemas.$ZodFunction> = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Function types cannot be represented in JSON Schema\");\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":378,"symbol":"transformProcessor","kind":"constant","lang":"typescript","code":"const transformProcessor: Processor<schemas.$ZodTransform> = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Transforms cannot be represented in JSON Schema\");\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":382,"symbol":"mapProcessor","kind":"constant","lang":"typescript","code":"const mapProcessor: Processor<schemas.$ZodMap> = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Map cannot be represented in JSON Schema\");\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema-processors.ts","line":386,"symbol":"setProcessor","kind":"constant","lang":"typescript","code":"const setProcessor: Processor<schemas.$ZodSet> = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Set cannot be represented in JSON Schema\");\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema.ts","line":1,"symbol":"Schema","kind":"type","lang":"typescript","code":"type Schema =\n | ObjectSchema\n | ArraySchema\n | StringSchema\n | NumberSchema\n | IntegerSchema\n | BooleanSchema\n | NullSchema;"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema.ts","line":45,"symbol":"_JSONSchema","kind":"type","lang":"typescript","code":"type _JSONSchema = boolean | JSONSchema;"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema.ts","line":46,"symbol":"SchemaType","kind":"type","lang":"typescript","code":"type SchemaType = \"object\" | \"array\" | \"string\" | \"number\" | \"boolean\" | \"null\" | \"integer\";"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema.ts","line":47,"symbol":"JSONSchema","kind":"type","lang":"typescript","code":"type JSONSchema = {\n [k: string]: unknown;\n $schema?:\n | \"https://json-schema.org/draft/2020-12/schema\"\n | \"http://json-schema.org/draft-07/schema#\"\n | \"http://json-schema.org/draft-04/schema#\";\n $id?: string;\n $anchor?: string;\n $ref?: string;\n $dynamicRef?: string;\n $dynamicAnchor?: string;\n $vocabulary?: Record<string, boolean>;\n $comment?: string;\n $defs?: Record<string, JSONSchema>;\n type?: SchemaType | SchemaType[];\n additionalItems?: _JSONSchema;\n unevaluatedItems?: _JSONSchema;\n prefixItems?: _JSONSchema[];\n items?: _JSONSchema | _JSONSchema[];\n contains?: _JSONSchema;\n additionalProperties?: _JSONSchema;\n unevaluatedProperties?: _JSONSchema;\n properties?: Record<string, _JSONSchema>;\n patternProperties?: Record<string, _JSONSchema>;\n dependentSchemas?: Record<string, _JSONSchema>;\n propertyNames?: _JSONSchema;\n if?: _JSONSchema;\n then?: _JSONSchema;\n else?: _JSONSchema;\n allOf?: JSONSchema[];\n anyOf?: JSONSchema[];\n oneOf?: JSONSchema[];\n not?: _JSONSchema;\n multipleOf?: number;\n maximum?: number;\n exclusiveMaximum?: number | boolean;\n minimum?: number;\n exclusiveMinimum?: number | boolean;\n maxLength?: number;\n minLength?: numb"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema.ts","line":120,"symbol":"BaseSchema","kind":"type","lang":"typescript","doc":"for backwards compatibility","code":"type BaseSchema = JSONSchema;"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema.ts","line":122,"symbol":"ObjectSchema","kind":"interface","lang":"typescript","code":"interface ObjectSchema extends JSONSchema {\n type: \"object\";\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema.ts","line":126,"symbol":"ArraySchema","kind":"interface","lang":"typescript","code":"interface ArraySchema extends JSONSchema {\n type: \"array\";\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema.ts","line":130,"symbol":"StringSchema","kind":"interface","lang":"typescript","code":"interface StringSchema extends JSONSchema {\n type: \"string\";\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema.ts","line":134,"symbol":"NumberSchema","kind":"interface","lang":"typescript","code":"interface NumberSchema extends JSONSchema {\n type: \"number\";\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema.ts","line":138,"symbol":"IntegerSchema","kind":"interface","lang":"typescript","code":"interface IntegerSchema extends JSONSchema {\n type: \"integer\";\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema.ts","line":142,"symbol":"BooleanSchema","kind":"interface","lang":"typescript","code":"interface BooleanSchema extends JSONSchema {\n type: \"boolean\";\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/json-schema.ts","line":146,"symbol":"NullSchema","kind":"interface","lang":"typescript","code":"interface NullSchema extends JSONSchema {\n type: \"null\";\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":5,"symbol":"$ZodCyclicError","kind":"class","lang":"typescript","code":"class $ZodCyclicError extends Error {\n constructor() {\n super(`Cannot parse a reference cycle that closes through a transform`);\n this.name = \"ZodCyclicError\";\n }\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":6,"symbol":"constructor","kind":"method","lang":"typescript","code":"constructor() {\n super(`Cannot parse a reference cycle that closes through a transform`);\n this.name = \"ZodCyclicError\";\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":12,"symbol":"Entry","kind":"interface","lang":"typescript","code":"interface Entry {\n value: unknown;\n /** `null` until the node's children are parsed. */\n issues: errors.$ZodRawIssue[] | null;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":18,"symbol":"State","kind":"interface","lang":"typescript","code":"interface State {\n /** Weak throughout because `attach` caches a bucket on the schema instance, which outlives the parse. */\n buckets: WeakMap<$ZodType, WeakMap<object, Entry>>;\n /** Nodes a back-edge resolved to before they finished. */\n backEdges: WeakSet<object> | undefined;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":26,"symbol":"STATE","kind":"constant","lang":"typescript","doc":"Keyed off the context object every schema in one parse call already shares.","code":"const STATE = \"~memo\";"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":27,"symbol":"WithState","kind":"type","lang":"typescript","code":"type WithState = { [STATE]?: State };"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":29,"symbol":"NO_ISSUES","kind":"constant","lang":"typescript","code":"const NO_ISSUES: errors.$ZodRawIssue[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":32,"symbol":"isRef","kind":"function","lang":"typescript","doc":"a value a cycle can close through","code":"function isRef(value: unknown): value is object {\n return value !== null && typeof value === \"object\";\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":37,"symbol":"cloneIssues","kind":"function","lang":"typescript","doc":"Receivers prefix paths in place, so the cache and every hand-out need their own copies.","code":"function cloneIssues(issues: errors.$ZodRawIssue[]): errors.$ZodRawIssue[] {\n return issues.map((iss) => (iss.path ? { ...iss, path: iss.path.slice() } : { ...iss }));\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":41,"symbol":"recursive","kind":"constant","lang":"typescript","code":"const recursive: WeakMap<object, boolean> = /*@__PURE__*/ new WeakMap();"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":44,"symbol":"NONE","kind":"constant","lang":"typescript","doc":"What the walk established, in order of certainty: ordered so the strongest answer among children wins.","code":"const NONE = 0;"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":45,"symbol":"ASSUMED","kind":"constant","lang":"typescript","code":"const ASSUMED = 1;"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":46,"symbol":"PROVEN","kind":"constant","lang":"typescript","code":"const PROVEN = 2;"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":47,"symbol":"Answer","kind":"type","lang":"typescript","code":"type Answer = typeof NONE | typeof ASSUMED | typeof PROVEN;"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":50,"symbol":"isRecursive","kind":"function","lang":"typescript","doc":"Whether this schema's subtree contains a cycle, so one parse can re-enter it.","code":"function isRecursive(inst: $ZodType, stack: Set<object>, resolve: boolean): Answer {\n const cached = recursive.get(inst);\n if (cached !== undefined) return cached ? PROVEN : NONE;\n // Relative to the walk in progress, so not cached.\n if (stack.has(inst)) return PROVEN;\n stack.add(inst);\n\n let result: Answer = NONE;\n const check = (child: any) => {\n if (result !== PROVEN && child?._zod) {\n const answer = isRecursive(child, stack, resolve);\n if (answer > result) result = answer;\n }\n };\n\n // `Reflect.ownKeys` rather than `Object.keys`, so a cycle through a declared symbol key is still seen\n const shape = (sh: object, spread: boolean): Answer => {\n let answer: Answer = NONE;\n for (const key of Reflect.ownKeys(sh)) {\n const desc = Object.getOwnPropertyDescriptor(sh, key)!;\n // an object resolves its shape by spread, so a key it does not enumerate is never parsed; `z.properties` reads every own key and so keeps them all\n if (spread && !desc.enumerable) continue;\n // resolving runs user code, and a factory mints a fresh subtree per read, so an edge the walk can't follow counts as a cycle\n const child = desc.get ? ASSUMED : desc.valu"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":51,"symbol":"cached","kind":"constant","lang":"typescript","code":"const cached = recursive.get(inst);"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":58,"symbol":"check","kind":"constant","lang":"typescript","code":"const check = (child: any) => {\n if (result !== PROVEN && child?._zod) {\n const answer = isRecursive(child, stack, resolve);\n if (answer > result) result = answer;\n }\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":60,"symbol":"answer","kind":"constant","lang":"typescript","code":"const answer = isRecursive(child, stack, resolve);"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":66,"symbol":"shape","kind":"constant","lang":"typescript","doc":"`Reflect.ownKeys` rather than `Object.keys`, so a cycle through a declared symbol key is still seen","code":"const shape = (sh: object, spread: boolean): Answer => {\n let answer: Answer = NONE;\n for (const key of Reflect.ownKeys(sh)) {\n const desc = Object.getOwnPropertyDescriptor(sh, key)!;\n // an object resolves its shape by spread, so a key it does not enumerate is never parsed; `z.properties` reads every own key and so keeps them all\n if (spread && !desc.enumerable) continue;\n // resolving runs user code, and a factory mints a fresh subtree per read, so an edge the walk can't follow counts as a cycle\n const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;\n if (child > answer) answer = child;\n }\n return answer;\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":69,"symbol":"desc","kind":"constant","lang":"typescript","code":"const desc = Object.getOwnPropertyDescriptor(sh, key)!;"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":73,"symbol":"child","kind":"constant","lang":"typescript","doc":"resolving runs user code, and a factory mints a fresh subtree per read, so an edge the walk can't follow counts as a cycle","code":"const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":79,"symbol":"merge","kind":"constant","lang":"typescript","code":"const merge = (answer: Answer) => {\n if (answer > result) result = answer;\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":83,"symbol":"def","kind":"constant","lang":"typescript","code":"const def = inst._zod.def as any;"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":84,"symbol":"kind","kind":"constant","lang":"typescript","code":"const kind = def.type as $ZodTypeDef[\"type\"];"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":87,"symbol":"raw","kind":"constant","lang":"typescript","code":"const raw = util.rawShape(def);"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":136,"symbol":"inner","kind":"constant","lang":"typescript","code":"const inner = def._cachedInner ?? (resolve ? (inst as any)._zod.innerType : undefined);"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":169,"symbol":"desc","kind":"constant","lang":"typescript","code":"const desc = Object.getOwnPropertyDescriptor(def, key);"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":171,"symbol":"value","kind":"constant","lang":"typescript","code":"const value = desc.value;"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":184,"symbol":"settle","kind":"function","lang":"typescript","doc":"An assumed answer must not outlive the resolution that settles it, so only a certain one is cached.","code":"function settle(inst: $ZodType, answer: Answer): Answer {\n if (answer !== ASSUMED) recursive.set(inst, answer === PROVEN);\n return answer;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":195,"symbol":"isRecursiveSchema","kind":"function","lang":"typescript","doc":"Whether one parse can re-enter this schema, i.e. its subtree contains a cycle. Exported for `z.compile`, which refuses to compile such a schema: cycle breaking is driven from here off state keyed on the parse context, and a generated fast path has no context to key on.","code":"function isRecursiveSchema(inst: $ZodType): boolean {\n // z.compile never parses, so nothing would ever resolve a lazy for it; it runs once and already treats a throw here as recursive\n return isRecursive(inst, new Set(), true) !== NONE;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":200,"symbol":"bucketFor","kind":"function","lang":"typescript","code":"function bucketFor(state: State, inst: $ZodType): WeakMap<object, Entry> {\n let bucket = state.buckets.get(inst);\n if (!bucket) {\n bucket = new WeakMap();\n state.buckets.set(inst, bucket);\n }\n return bucket;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":213,"symbol":"open","kind":"constant","lang":"typescript","doc":"Allocated but unfinished entries. `alloc` and the matching pop both happen in the synchronous part of a parse, so they nest even when children are async, and one stack serves every schema.","code":"const open: Entry[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":215,"symbol":"memo","kind":"constant","lang":"typescript","code":"const memo: $ZodMemoizer = {\n alloc(_inst, payload, empty) {\n const bucket = handoff;\n if (!bucket) return empty;\n handoff = undefined;\n const entry: Entry = { value: empty, issues: null };\n bucket.set(payload.value as object, entry);\n open.push(entry);\n return empty;\n },\n\n guard(inst) {\n inst._zod.deferred ??= [];\n inst._zod.deferred.push(() => {\n const base = inst._zod.parse;\n const wrapped = (payload: ParsePayload, ctx: ParseContextInternal): util.MaybeAsync<ParsePayload> => {\n // The value is a placeholder a back-edge is still waiting on, so the cycle closes through this transform. Its output can't exist in time to bind.\n if (ctx.direction !== \"backward\" && isBackEdge(ctx, payload.value)) throw new $ZodCyclicError();\n return base(payload, ctx);\n };\n inst._zod.parse = wrapped;\n if (inst._zod.run === base) inst._zod.run = wrapped;\n });\n },\n\n attach(inst) {\n let isRecursiveInst: boolean | undefined;\n let rechecked = false;\n // a recursive schema is re-entered many times per parse and its bucket never changes\n let lastCtx: object | undefined;\n let lastBucket: WeakMap<object, Entry> | und"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":216,"symbol":"alloc","kind":"method","lang":"typescript","code":"alloc(_inst, payload, empty) {\n const bucket = handoff;\n if (!bucket) return empty;\n handoff = undefined;\n const entry: Entry = { value: empty, issues: null };\n bucket.set(payload.value as object, entry);\n open.push(entry);\n return empty;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":217,"symbol":"bucket","kind":"constant","lang":"typescript","code":"const bucket = handoff;"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":220,"symbol":"entry","kind":"constant","lang":"typescript","code":"const entry: Entry = { value: empty, issues: null };"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":226,"symbol":"guard","kind":"method","lang":"typescript","code":"guard(inst) {\n inst._zod.deferred ??= [];\n inst._zod.deferred.push(() => {\n const base = inst._zod.parse;\n const wrapped = (payload: ParsePayload, ctx: ParseContextInternal): util.MaybeAsync<ParsePayload> => {\n // The value is a placeholder a back-edge is still waiting on, so the cycle closes through this transform. Its output can't exist in time to bind.\n if (ctx.direction !== \"backward\" && isBackEdge(ctx, payload.value)) throw new $ZodCyclicError();\n return base(payload, ctx);\n };\n inst._zod.parse = wrapped;\n if (inst._zod.run === base) inst._zod.run = wrapped;\n });\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":229,"symbol":"base","kind":"constant","lang":"typescript","code":"const base = inst._zod.parse;"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":230,"symbol":"wrapped","kind":"constant","lang":"typescript","code":"const wrapped = (payload: ParsePayload, ctx: ParseContextInternal): util.MaybeAsync<ParsePayload> => {\n // The value is a placeholder a back-edge is still waiting on, so the cycle closes through this transform. Its output can't exist in time to bind.\n if (ctx.direction !== \"backward\" && isBackEdge(ctx, payload.value)) throw new $ZodCyclicError();\n return base(payload, ctx);\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":240,"symbol":"attach","kind":"method","lang":"typescript","code":"attach(inst) {\n let isRecursiveInst: boolean | undefined;\n let rechecked = false;\n // a recursive schema is re-entered many times per parse and its bucket never changes\n let lastCtx: object | undefined;\n let lastBucket: WeakMap<object, Entry> | undefined;\n\n // Wraps `parse` in a deferred so it sees the container's final parse. Core's own deferred copies `parse` into `run` when there are no checks, and it ran first, so `run` is patched to match; with checks, `run` reads `parse` dynamically.\n inst._zod.deferred ??= [];\n inst._zod.deferred.push(() => {\n const base = inst._zod.parse;\n\n const wrapped = (payload: ParsePayload, ctx: ParseContextInternal): util.MaybeAsync<ParsePayload> => {\n if (isRecursiveInst === undefined) {\n const walked = isRecursive(inst, new Set(), false);\n if (walked === NONE) {\n // Nothing here can ever fire, so take it back out.\n inst._zod.parse = base;\n if (inst._zod.run === wrapped) inst._zod.run = base;\n return base(payload, ctx);\n }\n // this parse resolves the deferred edges on its own path, so ask once more before latching\n if (wa"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":250,"symbol":"base","kind":"constant","lang":"typescript","code":"const base = inst._zod.parse;"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":252,"symbol":"wrapped","kind":"constant","lang":"typescript","code":"const wrapped = (payload: ParsePayload, ctx: ParseContextInternal): util.MaybeAsync<ParsePayload> => {\n if (isRecursiveInst === undefined) {\n const walked = isRecursive(inst, new Set(), false);\n if (walked === NONE) {\n // Nothing here can ever fire, so take it back out.\n inst._zod.parse = base;\n if (inst._zod.run === wrapped) inst._zod.run = base;\n return base(payload, ctx);\n }\n // this parse resolves the deferred edges on its own path, so ask once more before latching\n if (walked === PROVEN || rechecked) isRecursiveInst = true;\n else rechecked = true;\n }\n\n const input = payload.value;\n if (!isRef(input)) return base(payload, ctx);\n\n let state = (ctx as WithState)[STATE];\n if (!state) {\n state = { buckets: new WeakMap(), backEdges: undefined };\n (ctx as WithState)[STATE] = state;\n }\n\n let bucket: WeakMap<object, Entry>;\n if (lastCtx === ctx) {\n bucket = lastBucket!;\n } else {\n bucket = bucketFor(state, inst);\n lastCtx = ctx;\n lastBucket = bucket;\n }\n\n "} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":254,"symbol":"walked","kind":"constant","lang":"typescript","code":"const walked = isRecursive(inst, new Set(), false);"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":266,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = payload.value;"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":284,"symbol":"hit","kind":"constant","lang":"typescript","code":"const hit = bucket.get(input);"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":299,"symbol":"depth","kind":"constant","lang":"typescript","code":"const depth = open.length;"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":300,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = base(payload, ctx);"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":303,"symbol":"entry","kind":"constant","lang":"typescript","doc":"A container that rejected its input outright allocated nothing.","code":"const entry = open.length > depth ? open.pop()! : undefined;"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":323,"symbol":"memoizer","kind":"function","lang":"typescript","doc":"The memoizer that gives containers cycle support. `zod` installs it by default; `zod/mini` opts in with `config({ memoizer: memoizer() })`.","code":"function memoizer(): $ZodMemoizer {\n return memo;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":328,"symbol":"isBackEdge","kind":"function","lang":"typescript","doc":"Whether this value is a node a back-edge resolved to before it finished.","code":"function isBackEdge(ctx: object, value: unknown): boolean {\n const backEdges = (ctx as WithState)[STATE]?.backEdges;\n return backEdges !== undefined && isRef(value) && backEdges.has(value);\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/memoizer.ts","line":329,"symbol":"backEdges","kind":"constant","lang":"typescript","code":"const backEdges = (ctx as WithState)[STATE]?.backEdges;"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":6,"symbol":"$ZodErrorClass","kind":"type","lang":"typescript","code":"type $ZodErrorClass = { new (issues: errors.$ZodIssue[]): errors.$ZodError };"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":7,"symbol":"$ParseParams","kind":"type","lang":"typescript","code":"type $ParseParams = { callee?: util.AnyFunc; Err?: $ZodErrorClass | undefined };"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":10,"symbol":"finalizeParams","kind":"function","lang":"typescript","doc":"Always both keys, so the `_params` read site in `_parse` sees one object shape rather than two.","code":"function finalizeParams(callee: util.AnyFunc, params: $ParseParams | undefined): $ParseParams {\n return { callee: params?.callee ?? callee, Err: params?.Err };\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":15,"symbol":"$Parse","kind":"type","lang":"typescript","doc":"//////// METHODS ///////////","code":"type $Parse = <T extends schemas.$ZodType>(\n schema: T,\n value: unknown,\n _ctx?: schemas.ParseContext<errors.$ZodIssue>,\n _params?: $ParseParams\n) => core.output<T>;"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":22,"symbol":"_parse","kind":"constant","lang":"typescript","code":"const _parse: (_Err: $ZodErrorClass) => $Parse = (_Err) => {\n const fn: $Parse = (schema, value, _ctx, _params) => {\n const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: false } : { async: false };\n const result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise) {\n throw new core.$ZodAsyncError();\n }\n if (result.issues.length) {\n const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));\n util.captureStackTrace(e, _params?.callee ?? fn);\n throw e;\n }\n return result.value as core.output<typeof schema>;\n };\n return fn;\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":23,"symbol":"fn","kind":"constant","lang":"typescript","code":"const fn: $Parse = (schema, value, _ctx, _params) => {\n const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: false } : { async: false };\n const result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise) {\n throw new core.$ZodAsyncError();\n }\n if (result.issues.length) {\n const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));\n util.captureStackTrace(e, _params?.callee ?? fn);\n throw e;\n }\n return result.value as core.output<typeof schema>;\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":24,"symbol":"ctx","kind":"constant","lang":"typescript","code":"const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: false } : { async: false };"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":25,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema._zod.run({ value, issues: [] }, ctx);"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":30,"symbol":"e","kind":"constant","lang":"typescript","code":"const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":39,"symbol":"parse","kind":"constant","lang":"typescript","code":"const parse: $Parse = /* @__PURE__*/ _parse(errors.$ZodRealError);"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":41,"symbol":"$ParseAsync","kind":"type","lang":"typescript","code":"type $ParseAsync = <T extends schemas.$ZodType>(\n schema: T,\n value: unknown,\n _ctx?: schemas.ParseContext<errors.$ZodIssue>,\n _params?: $ParseParams\n) => Promise<core.output<T>>;"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":48,"symbol":"_parseAsync","kind":"constant","lang":"typescript","code":"const _parseAsync: (_Err: $ZodErrorClass) => $ParseAsync = (_Err) => {\n const fn: $ParseAsync = async (schema, value, _ctx, params) => {\n const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: true } : { async: true };\n let result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise) result = await result;\n if (result.issues.length) {\n const e = new (params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));\n util.captureStackTrace(e, params?.callee ?? fn);\n throw e;\n }\n return result.value as core.output<typeof schema>;\n };\n return fn;\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":49,"symbol":"fn","kind":"constant","lang":"typescript","code":"const fn: $ParseAsync = async (schema, value, _ctx, params) => {\n const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: true } : { async: true };\n let result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise) result = await result;\n if (result.issues.length) {\n const e = new (params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));\n util.captureStackTrace(e, params?.callee ?? fn);\n throw e;\n }\n return result.value as core.output<typeof schema>;\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":50,"symbol":"ctx","kind":"constant","lang":"typescript","code":"const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: true } : { async: true };"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":54,"symbol":"e","kind":"constant","lang":"typescript","code":"const e = new (params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":63,"symbol":"parseAsync","kind":"constant","lang":"typescript","code":"const parseAsync: $ParseAsync = /* @__PURE__*/ _parseAsync(errors.$ZodRealError);"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":65,"symbol":"$SafeParse","kind":"type","lang":"typescript","code":"type $SafeParse = <T extends schemas.$ZodType>(\n schema: T,\n value: unknown,\n _ctx?: schemas.ParseContext<errors.$ZodIssue>\n) => util.SafeParseResult<core.output<T>>;"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":71,"symbol":"_safeParse","kind":"constant","lang":"typescript","code":"const _safeParse: (_Err: $ZodErrorClass) => $SafeParse = (_Err) => (schema, value, _ctx) => {\n const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: false } : { async: false };\n const result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise) {\n throw new core.$ZodAsyncError();\n }\n\n return result.issues.length ? failure(_Err, result.issues, ctx) : ({ success: true, data: result.value } as any);\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":72,"symbol":"ctx","kind":"constant","lang":"typescript","code":"const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: false } : { async: false };"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":73,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema._zod.run({ value, issues: [] }, ctx);"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":80,"symbol":"safeParse","kind":"constant","lang":"typescript","code":"const safeParse: $SafeParse = /* @__PURE__*/ _safeParse(errors.$ZodRealError);"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":83,"symbol":"failure","kind":"function","lang":"typescript","doc":"the error is built on the first read of `error`: finalizing the issues and constructing the instance is most of a failing parse, and a caller that only branches on `success` never pays it. a getter in the literal keeps this small; the alternative, one shared accessor descriptor plus a hidden state slot, reads ~15% faster but costs ~75 B gzipped in every bundle","code":"function failure(Err: $ZodErrorClass, issues: errors.$ZodRawIssue[], ctx: schemas.ParseContextInternal): any {\n let error: errors.$ZodError | undefined;\n return {\n success: false,\n get error() {\n if (!error) {\n error = new Err(issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));\n // finalizeIssue drops `input`, so the built error holds nothing; keeping the raw issues past this point pins the parsed value for the life of the result\n issues = undefined as any;\n ctx = undefined as any;\n }\n return error;\n },\n set error(e: errors.$ZodError) {\n error = e;\n // a replacement makes the getter's branch unreachable, so the captures have to go here too\n issues = undefined as any;\n ctx = undefined as any;\n },\n };\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":87,"symbol":"error","kind":"method","lang":"typescript","code":"get error() {\n if (!error) {\n error = new Err(issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));\n // finalizeIssue drops `input`, so the built error holds nothing; keeping the raw issues past this point pins the parsed value for the life of the result\n issues = undefined as any;\n ctx = undefined as any;\n }\n return error;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":96,"symbol":"error","kind":"method","lang":"typescript","code":"set error(e: errors.$ZodError) {\n error = e;\n // a replacement makes the getter's branch unreachable, so the captures have to go here too\n issues = undefined as any;\n ctx = undefined as any;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":105,"symbol":"$SafeParseAsync","kind":"type","lang":"typescript","code":"type $SafeParseAsync = <T extends schemas.$ZodType>(\n schema: T,\n value: unknown,\n _ctx?: schemas.ParseContext<errors.$ZodIssue>\n) => Promise<util.SafeParseResult<core.output<T>>>;"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":111,"symbol":"_safeParseAsync","kind":"constant","lang":"typescript","code":"const _safeParseAsync: (_Err: $ZodErrorClass) => $SafeParseAsync = (_Err) => async (schema, value, _ctx) => {\n const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: true } : { async: true };\n let result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise) result = await result;\n\n return result.issues.length ? failure(_Err, result.issues, ctx) : ({ success: true, data: result.value } as any);\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":112,"symbol":"ctx","kind":"constant","lang":"typescript","code":"const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: true } : { async: true };"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":119,"symbol":"safeParseAsync","kind":"constant","lang":"typescript","code":"const safeParseAsync: $SafeParseAsync = /* @__PURE__*/ _safeParseAsync(errors.$ZodRealError);"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":122,"symbol":"COMPILE_INVALID","kind":"constant","lang":"typescript","doc":"registry mirrors of the compiler's sentinels, so this module never imports the compiler","code":"const COMPILE_INVALID = /* @__PURE__ */ Symbol.for(\"zod.compile.invalid\");"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":123,"symbol":"COMPILE_FALLBACK","kind":"constant","lang":"typescript","code":"const COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for(\"zod.compile.fallback\");"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":125,"symbol":"CompiledBag","kind":"interface","lang":"typescript","code":"interface CompiledBag {\n validator?: ((input: unknown) => unknown) & { definite?: boolean | undefined };\n fallbackRun?: (payload: schemas.ParsePayload, ctx: schemas.ParseContextInternal) => unknown;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":130,"symbol":"$Validate","kind":"type","lang":"typescript","code":"type $Validate = <T extends schemas.$ZodType>(\n schema: T,\n value: unknown,\n _ctx?: schemas.ParseContext<errors.$ZodIssue>\n) => value is core.input<T>;"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":137,"symbol":"validate","kind":"constant","lang":"typescript","doc":"Deliberately tiny, because v8 will not inline a body carrying the fallback's object literals and throw. Everything that is not the compiled happy path lives in validateFallback, and that split is worth ~35% on a compiled schema.","code":"const validate: $Validate = ((\n schema: schemas.$ZodType,\n value: unknown,\n _ctx?: schemas.ParseContext<errors.$ZodIssue>\n): boolean => {\n const validator = (schema._zod.bag as CompiledBag).validator;\n if (validator !== undefined) {\n if (validator(value) !== COMPILE_INVALID) return true;\n // a definite sentinel means the runtime would reject, so skip the re-parse; a ctx can still change the answer\n if (validator.definite === true && _ctx === undefined) return false;\n }\n return validateFallback(schema, value, _ctx);\n}) as $Validate;"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":142,"symbol":"validator","kind":"constant","lang":"typescript","code":"const validator = (schema._zod.bag as CompiledBag).validator;"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":151,"symbol":"validateFallback","kind":"function","lang":"typescript","code":"function validateFallback(\n schema: schemas.$ZodType,\n value: unknown,\n _ctx?: schemas.ParseContext<errors.$ZodIssue>\n): boolean {\n const ctx: schemas.ParseContextInternal = _ctx\n ? { ..._ctx, async: false, abortEarly: true }\n : { async: false, abortEarly: true };\n const fallbackRun = (schema._zod.bag as CompiledBag).fallbackRun;\n let result: unknown;\n if (fallbackRun) {\n // skip nested fast paths on the fallback, so user callbacks keep the at-most-twice bound\n (ctx as Record<symbol, unknown>)[COMPILE_FALLBACK] = true;\n result = fallbackRun({ value, issues: [] }, ctx);\n } else {\n result = schema._zod.run({ value, issues: [] }, ctx);\n }\n if (result instanceof Promise) {\n throw new core.$ZodAsyncError();\n }\n return (result as schemas.ParsePayload).issues.length === 0;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":156,"symbol":"ctx","kind":"constant","lang":"typescript","code":"const ctx: schemas.ParseContextInternal = _ctx\n ? { ..._ctx, async: false, abortEarly: true }\n : { async: false, abortEarly: true };"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":159,"symbol":"fallbackRun","kind":"constant","lang":"typescript","code":"const fallbackRun = (schema._zod.bag as CompiledBag).fallbackRun;"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":174,"symbol":"$ValidateAsync","kind":"type","lang":"typescript","code":"type $ValidateAsync = <T extends schemas.$ZodType>(\n schema: T,\n value: unknown,\n _ctx?: schemas.ParseContext<errors.$ZodIssue>\n) => Promise<boolean>;"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":181,"symbol":"validateAsync","kind":"constant","lang":"typescript","doc":"no fast path: the compiler keeps async parses on the runtime, because a promise-returning callback that is not declared async compiles to a throw","code":"const validateAsync: $ValidateAsync = async (schema, value, _ctx) => {\n const ctx: schemas.ParseContextInternal = _ctx\n ? { ..._ctx, async: true, abortEarly: true }\n : { async: true, abortEarly: true };\n let result: unknown = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise) result = await result;\n return (result as schemas.ParsePayload).issues.length === 0;\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":182,"symbol":"ctx","kind":"constant","lang":"typescript","code":"const ctx: schemas.ParseContextInternal = _ctx\n ? { ..._ctx, async: true, abortEarly: true }\n : { async: true, abortEarly: true };"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":191,"symbol":"$Encode","kind":"type","lang":"typescript","doc":"Codec functions","code":"type $Encode = <T extends schemas.$ZodType>(\n schema: T,\n value: core.output<T>,\n _ctx?: schemas.ParseContext<errors.$ZodIssue>,\n _params?: $ParseParams\n) => core.input<T>;"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":198,"symbol":"_encode","kind":"constant","lang":"typescript","code":"const _encode: (_Err: $ZodErrorClass) => $Encode = (_Err) => {\n const parse = _parse(_Err);\n const fn: $Encode = (schema, value, _ctx, _params) => {\n const ctx = _ctx ? { ..._ctx, direction: \"backward\" as const } : { direction: \"backward\" as const };\n return parse(schema, value, ctx as any, finalizeParams(fn, _params)) as any;\n };\n return fn;\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":199,"symbol":"parse","kind":"constant","lang":"typescript","code":"const parse = _parse(_Err);"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":200,"symbol":"fn","kind":"constant","lang":"typescript","code":"const fn: $Encode = (schema, value, _ctx, _params) => {\n const ctx = _ctx ? { ..._ctx, direction: \"backward\" as const } : { direction: \"backward\" as const };\n return parse(schema, value, ctx as any, finalizeParams(fn, _params)) as any;\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":201,"symbol":"ctx","kind":"constant","lang":"typescript","code":"const ctx = _ctx ? { ..._ctx, direction: \"backward\" as const } : { direction: \"backward\" as const };"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":207,"symbol":"encode","kind":"constant","lang":"typescript","code":"const encode: $Encode = /* @__PURE__*/ _encode(errors.$ZodRealError);"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":209,"symbol":"$Decode","kind":"type","lang":"typescript","code":"type $Decode = <T extends schemas.$ZodType>(\n schema: T,\n value: core.input<T>,\n _ctx?: schemas.ParseContext<errors.$ZodIssue>,\n _params?: $ParseParams\n) => core.output<T>;"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":216,"symbol":"_decode","kind":"constant","lang":"typescript","code":"const _decode: (_Err: $ZodErrorClass) => $Decode = (_Err) => {\n const parse = _parse(_Err);\n const fn: $Decode = (schema, value, _ctx, _params) => {\n return parse(schema, value, _ctx, finalizeParams(fn, _params));\n };\n return fn;\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":217,"symbol":"parse","kind":"constant","lang":"typescript","code":"const parse = _parse(_Err);"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":218,"symbol":"fn","kind":"constant","lang":"typescript","code":"const fn: $Decode = (schema, value, _ctx, _params) => {\n return parse(schema, value, _ctx, finalizeParams(fn, _params));\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":224,"symbol":"decode","kind":"constant","lang":"typescript","code":"const decode: $Decode = /* @__PURE__*/ _decode(errors.$ZodRealError);"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":226,"symbol":"$EncodeAsync","kind":"type","lang":"typescript","code":"type $EncodeAsync = <T extends schemas.$ZodType>(\n schema: T,\n value: core.output<T>,\n _ctx?: schemas.ParseContext<errors.$ZodIssue>,\n _params?: $ParseParams\n) => Promise<core.input<T>>;"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":233,"symbol":"_encodeAsync","kind":"constant","lang":"typescript","code":"const _encodeAsync: (_Err: $ZodErrorClass) => $EncodeAsync = (_Err) => {\n const parseAsync = _parseAsync(_Err);\n const fn: $EncodeAsync = async (schema, value, _ctx, _params) => {\n const ctx = _ctx ? { ..._ctx, direction: \"backward\" as const } : { direction: \"backward\" as const };\n return (await parseAsync(schema, value, ctx as any, finalizeParams(fn, _params))) as any;\n };\n return fn;\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":234,"symbol":"parseAsync","kind":"constant","lang":"typescript","code":"const parseAsync = _parseAsync(_Err);"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":235,"symbol":"fn","kind":"constant","lang":"typescript","code":"const fn: $EncodeAsync = async (schema, value, _ctx, _params) => {\n const ctx = _ctx ? { ..._ctx, direction: \"backward\" as const } : { direction: \"backward\" as const };\n return (await parseAsync(schema, value, ctx as any, finalizeParams(fn, _params))) as any;\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":236,"symbol":"ctx","kind":"constant","lang":"typescript","code":"const ctx = _ctx ? { ..._ctx, direction: \"backward\" as const } : { direction: \"backward\" as const };"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":242,"symbol":"encodeAsync","kind":"constant","lang":"typescript","code":"const encodeAsync: $EncodeAsync = /* @__PURE__*/ _encodeAsync(errors.$ZodRealError);"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":244,"symbol":"$DecodeAsync","kind":"type","lang":"typescript","code":"type $DecodeAsync = <T extends schemas.$ZodType>(\n schema: T,\n value: core.input<T>,\n _ctx?: schemas.ParseContext<errors.$ZodIssue>,\n _params?: $ParseParams\n) => Promise<core.output<T>>;"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":251,"symbol":"_decodeAsync","kind":"constant","lang":"typescript","code":"const _decodeAsync: (_Err: $ZodErrorClass) => $DecodeAsync = (_Err) => {\n const parseAsync = _parseAsync(_Err);\n const fn: $DecodeAsync = async (schema, value, _ctx, _params) => {\n return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params));\n };\n return fn;\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/parse.ts","line":252,"symbol":"parseAsync","kind":"constant","lang":"typescript","code":"const parseAsync = _parseAsync(_Err);"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":8,"symbol":"cuid","kind":"constant","lang":"typescript","doc":"@deprecated CUID v1 is deprecated by its authors due to information leakage (timestamps embedded in the id). Use {@link cuid2} instead. See https://github.com/paralleldrive/cuid.","code":"const cuid: RegExp = /^[cC][0-9a-z]{6,}$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":9,"symbol":"cuid2","kind":"constant","lang":"typescript","code":"const cuid2: RegExp = /^[0-9a-z]+$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":10,"symbol":"ulid","kind":"constant","lang":"typescript","code":"const ulid: RegExp = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":11,"symbol":"xid","kind":"constant","lang":"typescript","code":"const xid: RegExp = /^[0-9a-vA-V]{20}$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":12,"symbol":"ksuid","kind":"constant","lang":"typescript","code":"const ksuid: RegExp = /^[A-Za-z0-9]{27}$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":13,"symbol":"nanoid","kind":"constant","lang":"typescript","code":"const nanoid: RegExp = /^[a-zA-Z0-9_-]{21}$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":14,"symbol":"nanoidOfLength","kind":"function","lang":"typescript","code":"function nanoidOfLength(length: number): RegExp {\n return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":19,"symbol":"duration","kind":"constant","lang":"typescript","doc":"ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components.","code":"const duration: RegExp =\n /^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":23,"symbol":"extendedDuration","kind":"constant","lang":"typescript","doc":"Implements ISO 8601-2 extensions like explicit +- prefixes, mixing weeks with other units, and fractional/negative components.","code":"const extendedDuration: RegExp =\n /^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":27,"symbol":"guid","kind":"constant","lang":"typescript","doc":"A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern","code":"const guid: RegExp = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":32,"symbol":"uuid","kind":"constant","lang":"typescript","doc":"Returns a regex for validating an RFC 9562/4122 UUID. @param version Optionally specify a version 1-8. If no version is specified, all versions are supported.","code":"const uuid = (version?: number | undefined): RegExp => {\n if (!version)\n return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;\n return new RegExp(\n `^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`\n );\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":39,"symbol":"uuid4","kind":"constant","lang":"typescript","code":"const uuid4: RegExp = /*@__PURE__*/ uuid(4);"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":40,"symbol":"uuid6","kind":"constant","lang":"typescript","code":"const uuid6: RegExp = /*@__PURE__*/ uuid(6);"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":41,"symbol":"uuid7","kind":"constant","lang":"typescript","code":"const uuid7: RegExp = /*@__PURE__*/ uuid(7);"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":44,"symbol":"email","kind":"constant","lang":"typescript","doc":"Practical email validation","code":"const email: RegExp =\n /^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":48,"symbol":"html5Email","kind":"constant","lang":"typescript","doc":"Equivalent to the HTML5 input[type=email] validation implemented by browsers. Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email","code":"const html5Email: RegExp =\n /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":52,"symbol":"rfc5322Email","kind":"constant","lang":"typescript","doc":"The classic emailregex.com regex for RFC 5322-compliant emails","code":"const rfc5322Email =\n /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":56,"symbol":"unicodeEmail","kind":"constant","lang":"typescript","doc":"A loose regex that allows Unicode characters, enforces length limits, and that's about it.","code":"const unicodeEmail = /^[^\\s@\"]{1,64}@[^\\s@]{1,255}$/u;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":57,"symbol":"idnEmail","kind":"constant","lang":"typescript","code":"const idnEmail = unicodeEmail;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":59,"symbol":"browserEmail","kind":"constant","lang":"typescript","code":"const browserEmail: RegExp =\n /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":64,"symbol":"_emoji","kind":"constant","lang":"typescript","doc":"Single character class, not an alternation: the two properties overlap (U+1F9B0-U+1F9B3), so `(A|B)+` backtracks exponentially on a failed match. The leading lookahead then demands one anchor — a pictograph, a regional indicator, or the enclosing keycap — because `\\p{Emoji_Component}` on its own covers ASCII digits, `#`, `*`, ZWJ, variation selectors and skin tone modifiers, none of which is an emoji without a base.","code":"const _emoji: string = `^(?=[\\\\s\\\\S]*[\\\\p{Extended_Pictographic}\\\\p{Regional_Indicator}\\\\u20E3])[\\\\p{Extended_Pictographic}\\\\p{Emoji_Component}]+$`;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":65,"symbol":"emoji","kind":"function","lang":"typescript","code":"function emoji(): RegExp {\n return new RegExp(_emoji, \"u\");\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":69,"symbol":"ipv4","kind":"constant","lang":"typescript","code":"const ipv4: RegExp =\n /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":71,"symbol":"ipv6","kind":"constant","lang":"typescript","code":"const ipv6: RegExp =\n /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":73,"symbol":"mac","kind":"constant","lang":"typescript","code":"const mac = (delimiter?: string): RegExp => {\n const escapedDelim = util.escapeRegex(delimiter ?? \":\");\n return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`);\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":74,"symbol":"escapedDelim","kind":"constant","lang":"typescript","code":"const escapedDelim = util.escapeRegex(delimiter ?? \":\");"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":77,"symbol":"cidrv4","kind":"constant","lang":"typescript","code":"const cidrv4: RegExp =\n /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/([0-9]|[1-2][0-9]|3[0-2])$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":79,"symbol":"cidrv6","kind":"constant","lang":"typescript","code":"const cidrv6: RegExp =\n /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":83,"symbol":"base64","kind":"constant","lang":"typescript","doc":"https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript","code":"const base64: RegExp = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":84,"symbol":"base64url","kind":"constant","lang":"typescript","code":"const base64url: RegExp = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":88,"symbol":"hostname","kind":"constant","lang":"typescript","doc":"based on https://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address export const hostname: RegExp = /^([a-zA-Z0-9-]+\\.)*[a-zA-Z0-9-]+$/;","code":"const hostname: RegExp =\n /^(?=.{1,253}\\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\\.?$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":91,"symbol":"domain","kind":"constant","lang":"typescript","code":"const domain: RegExp = /^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,63}$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":93,"symbol":"httpProtocol","kind":"constant","lang":"typescript","code":"const httpProtocol: RegExp = /^https?$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":96,"symbol":"e164","kind":"constant","lang":"typescript","doc":"https://blog.stevenlevithan.com/archives/validate-phone-number#r4-3 (regex sans spaces) E.164: leading digit must be 1-9; total digits (excluding '+') between 7-15","code":"const e164: RegExp = /^\\+[1-9]\\d{6,14}$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":99,"symbol":"creditCard","kind":"constant","lang":"typescript","doc":"Credit card shape: 12–19 digits, optionally separated by single spaces or single hyphens. ISO/IEC 7812 caps the PAN at 19 digits; 12 is the shortest issued length (Maestro).","code":"const creditCard: RegExp = /^\\d(?:[ -]?\\d){11,18}$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":102,"symbol":"currencyCode","kind":"constant","lang":"typescript","doc":"ISO 4217 alpha codes from the SIX list, regenerated by scripts/update-iso-4217.ts","code":"const currencyCode: RegExp =\n /^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":106,"symbol":"iban","kind":"constant","lang":"typescript","doc":"iban electronic format: 2-letter country, check digits 02-98 (the only values `98 - remainder` can produce), 11-30 bban characters","code":"const iban: RegExp = /^[A-Z]{2}(?!00|01|99)\\d{2}[A-Z0-9]{11,30}$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":108,"symbol":"dateSource","kind":"constant","lang":"typescript","code":"const dateSource = `(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))`;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":113,"symbol":"anchor","kind":"function","lang":"typescript","doc":"Anchors a pattern source. The interpolation lives here rather than at the call site because esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it will drop `anchor(dateSource)`. Keeping it inline pinned `date` into every bundle.","code":"function anchor(source: string): RegExp {\n return new RegExp(`^${source}$`);\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":117,"symbol":"date","kind":"constant","lang":"typescript","code":"const date: RegExp = /*@__PURE__*/ anchor(dateSource);"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":119,"symbol":"timeSource","kind":"function","lang":"typescript","code":"function timeSource(args: { precision?: number | null | undefined; seconds?: boolean }) {\n const hhmm = `(?:[01]\\\\d|2[0-3]):[0-5]\\\\d`;\n const regex =\n typeof args.precision === \"number\"\n ? args.precision === -1\n ? `${hhmm}`\n : args.precision === 0\n ? `${hhmm}:[0-5]\\\\d`\n : `${hhmm}:[0-5]\\\\d\\\\.\\\\d{${args.precision}}`\n : args.seconds\n ? `${hhmm}:[0-5]\\\\d(?:\\\\.\\\\d+)?`\n : `${hhmm}(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?`;\n return regex;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":120,"symbol":"hhmm","kind":"constant","lang":"typescript","code":"const hhmm = `(?:[01]\\\\d|2[0-3]):[0-5]\\\\d`;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":121,"symbol":"regex","kind":"constant","lang":"typescript","code":"const regex =\n typeof args.precision === \"number\"\n ? args.precision === -1\n ? `${hhmm}`\n : args.precision === 0\n ? `${hhmm}:[0-5]\\\\d`\n : `${hhmm}:[0-5]\\\\d\\\\.\\\\d{${args.precision}}`\n : args.seconds\n ? `${hhmm}:[0-5]\\\\d(?:\\\\.\\\\d+)?`\n : `${hhmm}(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?`;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":133,"symbol":"time","kind":"function","lang":"typescript","code":"function time(args: {\n precision?: number | null;\n // local?: boolean;\n}): RegExp {\n return new RegExp(`^${timeSource(args)}$`);\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":141,"symbol":"datetime","kind":"function","lang":"typescript","doc":"Adapted from https://stackoverflow.com/a/3143231","code":"function datetime(args: {\n precision?: number | null;\n offset?: boolean;\n local?: boolean;\n}): RegExp {\n const opts = [\"Z\"];\n // if (args.offset) opts.push(`([+-]\\\\d{2}:\\\\d{2})`);\n if (args.offset) opts.push(`([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)`);\n\n // RFC 3339 mandates seconds wherever the time carries a `Z` or an offset, so only the unqualified form `local` adds may omit them\n const qualified = `${timeSource({ precision: args.precision, seconds: true })}(?:${opts.join(\"|\")})`;\n const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;\n\n return new RegExp(`^${dateSource}T(?:${timeRegex})$`);\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":146,"symbol":"opts","kind":"constant","lang":"typescript","code":"const opts = [\"Z\"];"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":151,"symbol":"qualified","kind":"constant","lang":"typescript","doc":"RFC 3339 mandates seconds wherever the time carries a `Z` or an offset, so only the unqualified form `local` adds may omit them","code":"const qualified = `${timeSource({ precision: args.precision, seconds: true })}(?:${opts.join(\"|\")})`;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":152,"symbol":"timeRegex","kind":"constant","lang":"typescript","code":"const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":158,"symbol":"anyString","kind":"constant","lang":"typescript","doc":"the unbounded form of `string()` as a literal, so every plain string shares one instance instead of building its own","code":"const anyString: RegExp = /^[\\s\\S]{0,}$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":160,"symbol":"string","kind":"constant","lang":"typescript","code":"const string = (params?: { minimum?: number | undefined; maximum?: number | undefined }): RegExp => {\n const regex = params ? `[\\\\s\\\\S]{${params?.minimum ?? 0},${params?.maximum ?? \"\"}}` : `[\\\\s\\\\S]*`;\n return new RegExp(`^${regex}$`);\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":161,"symbol":"regex","kind":"constant","lang":"typescript","code":"const regex = params ? `[\\\\s\\\\S]{${params?.minimum ?? 0},${params?.maximum ?? \"\"}}` : `[\\\\s\\\\S]*`;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":165,"symbol":"bigint","kind":"constant","lang":"typescript","code":"const bigint: RegExp = /^-?\\d+n?$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":166,"symbol":"integer","kind":"constant","lang":"typescript","code":"const integer: RegExp = /^-?\\d+$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":167,"symbol":"number","kind":"constant","lang":"typescript","code":"const number: RegExp = /^-?\\d+(?:\\.\\d+)?$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":168,"symbol":"boolean","kind":"constant","lang":"typescript","code":"const boolean: RegExp = /^(?:true|false)$/i;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":169,"symbol":"_null","kind":"constant","lang":"typescript","code":"const _null: RegExp = /^null$/i;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":171,"symbol":"_undefined","kind":"constant","lang":"typescript","code":"const _undefined: RegExp = /^undefined$/i;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":175,"symbol":"lowercase","kind":"constant","lang":"typescript","doc":"regex for string with no uppercase letters","code":"const lowercase: RegExp = /^[^A-Z]*$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":177,"symbol":"uppercase","kind":"constant","lang":"typescript","doc":"regex for string with no lowercase letters","code":"const uppercase: RegExp = /^[^a-z]*$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/regexes.ts","line":180,"symbol":"hex","kind":"constant","lang":"typescript","doc":"regex for hexadecimal strings (any length)","code":"const hex: RegExp = /^[0-9a-fA-F]*$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":4,"symbol":"$output","kind":"constant","lang":"typescript","code":"const $output: unique symbol = /*@__PURE__*/ Symbol(\"ZodOutput\");"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":5,"symbol":"$output","kind":"type","lang":"typescript","code":"type $output = typeof $output;"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":6,"symbol":"$input","kind":"constant","lang":"typescript","code":"const $input: unique symbol = /*@__PURE__*/ Symbol(\"ZodInput\");"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":7,"symbol":"$input","kind":"type","lang":"typescript","code":"type $input = typeof $input;"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":9,"symbol":"$replace","kind":"type","lang":"typescript","code":"type $replace<Meta, S extends $ZodType> = Meta extends $output\n ? core.output<S>\n : Meta extends $input\n ? core.input<S>\n : Meta extends (infer M)[]\n ? $replace<M, S>[]\n : Meta extends (...args: infer P) => infer R\n ? (\n ...args: {\n [K in keyof P]: $replace<P[K], S>; // tuple\n }\n ) => $replace<R, S>\n : // handle objects\n Meta extends object\n ? { [K in keyof Meta]: $replace<Meta[K], S> }\n : Meta;"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":26,"symbol":"MetadataType","kind":"type","lang":"typescript","code":"type MetadataType = object | undefined;"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":27,"symbol":"$ZodRegistry","kind":"class","lang":"typescript","code":"class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema extends $ZodType = $ZodType> {\n _meta!: Meta;\n _schema!: Schema;\n _map: WeakMap<Schema, $replace<Meta, Schema>> = new WeakMap();\n _idmap: Map<string, Schema> = new Map();\n\n add<S extends Schema>(\n schema: S,\n ..._meta: undefined extends Meta ? [$replace<Meta, S>?] : [$replace<Meta, S>]\n ): this {\n const meta: any = _meta[0];\n this._map.set(schema, meta!);\n if (meta && typeof meta === \"object\" && \"id\" in meta) {\n this._idmap.set(meta.id!, schema);\n }\n return this as any;\n }\n\n clear(): this {\n this._map = new WeakMap();\n this._idmap = new Map();\n return this;\n }\n\n remove(schema: Schema): this {\n const meta: any = this._map.get(schema);\n if (meta && typeof meta === \"object\" && \"id\" in meta) {\n this._idmap.delete(meta.id!);\n }\n this._map.delete(schema);\n return this;\n }\n\n get<S extends Schema>(schema: S): $replace<Meta, S> | undefined {\n // return this._map.get(schema) as any;\n\n // inherit metadata\n const p = schema._zod.parent as Schema;\n if (p) {\n const pm: any = { ...(this.get(p) ?? {}) };\n delete pm.id; // do not inherit id\n "} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":33,"symbol":"add","kind":"method","lang":"typescript","code":"add<S extends Schema>(\n schema: S,\n ..._meta: undefined extends Meta ? [$replace<Meta, S>?] : [$replace<Meta, S>]\n ): this {\n const meta: any = _meta[0];\n this._map.set(schema, meta!);\n if (meta && typeof meta === \"object\" && \"id\" in meta) {\n this._idmap.set(meta.id!, schema);\n }\n return this as any;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":37,"symbol":"meta","kind":"constant","lang":"typescript","code":"const meta: any = _meta[0];"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":45,"symbol":"clear","kind":"method","lang":"typescript","code":"clear(): this {\n this._map = new WeakMap();\n this._idmap = new Map();\n return this;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":51,"symbol":"remove","kind":"method","lang":"typescript","code":"remove(schema: Schema): this {\n const meta: any = this._map.get(schema);\n if (meta && typeof meta === \"object\" && \"id\" in meta) {\n this._idmap.delete(meta.id!);\n }\n this._map.delete(schema);\n return this;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":52,"symbol":"meta","kind":"constant","lang":"typescript","code":"const meta: any = this._map.get(schema);"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":60,"symbol":"get","kind":"method","lang":"typescript","code":"get<S extends Schema>(schema: S): $replace<Meta, S> | undefined {\n // return this._map.get(schema) as any;\n\n // inherit metadata\n const p = schema._zod.parent as Schema;\n if (p) {\n const pm: any = { ...(this.get(p) ?? {}) };\n delete pm.id; // do not inherit id\n const f = { ...pm, ...this._map.get(schema) } as any;\n return Object.keys(f).length ? f : undefined;\n }\n return this._map.get(schema) as any;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":64,"symbol":"p","kind":"constant","lang":"typescript","doc":"inherit metadata","code":"const p = schema._zod.parent as Schema;"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":66,"symbol":"pm","kind":"constant","lang":"typescript","code":"const pm: any = { ...(this.get(p) ?? {}) };"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":68,"symbol":"f","kind":"constant","lang":"typescript","code":"const f = { ...pm, ...this._map.get(schema) } as any;"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":74,"symbol":"has","kind":"method","lang":"typescript","code":"has(schema: Schema): boolean {\n return this._map.has(schema);\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":79,"symbol":"JSONSchemaMeta","kind":"interface","lang":"typescript","code":"interface JSONSchemaMeta {\n id?: string | undefined;\n title?: string | undefined;\n description?: string | undefined;\n deprecated?: boolean | undefined;\n [k: string]: unknown;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":87,"symbol":"GlobalMeta","kind":"interface","lang":"typescript","code":"interface GlobalMeta extends JSONSchemaMeta {}"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":90,"symbol":"registry","kind":"function","lang":"typescript","doc":"registries","code":"function registry<T extends MetadataType = MetadataType, S extends $ZodType = $ZodType>(): $ZodRegistry<T, S> {\n return new $ZodRegistry<T, S>();\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":94,"symbol":"GlobalThisWithRegistry","kind":"interface","lang":"typescript","code":"interface GlobalThisWithRegistry {\n /**\n * The globalRegistry instance shared across both CommonJS and ESM builds.\n * By attaching the registry to `globalThis`, this property ensures a single, deduplicated instance\n * is used regardless of whether the package is loaded via `require` (CJS) or `import` (ESM).\n * This prevents dual package hazards and keeps registry state consistent.\n */\n __zod_globalRegistry?: $ZodRegistry<GlobalMeta>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/registries.ts","line":105,"symbol":"globalRegistry","kind":"constant","lang":"typescript","code":"const globalRegistry: $ZodRegistry<GlobalMeta> = (globalThis as GlobalThisWithRegistry).__zod_globalRegistry!;"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":17,"symbol":"ParseContext","kind":"interface","lang":"typescript","code":"interface ParseContext<T extends errors.$ZodIssueBase = never> {\n /** Customize error messages. */\n readonly error?: errors.$ZodErrorMap<T>;\n /** Include the `input` field in issue objects. Default `false`. */\n readonly reportInput?: boolean;\n /** Skip eval-based fast path. Default `false`. */\n readonly jitless?: boolean;\n /** Abort validation after the first error. Default `false`. */\n // readonly abortEarly?: boolean;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":29,"symbol":"ParseContextInternal","kind":"interface","lang":"typescript","doc":"@internal","code":"interface ParseContextInternal<T extends errors.$ZodIssueBase = never> extends ParseContext<T> {\n readonly async?: boolean | undefined;\n readonly direction?: \"forward\" | \"backward\";\n readonly skipChecks?: boolean;\n /** Set only by `validate`/`validateAsync`. A container may stop before its next child, never inside one, so a map entry and a tuple's fixed items parse whole. */\n readonly abortEarly?: boolean;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":38,"symbol":"$ZodMemoizer","kind":"interface","lang":"typescript","doc":"Gives a container cycle support: `attach` wraps its parse, and `alloc` registers the object it builds into before any child is parsed so a reference back to the same input resolves to it.","code":"interface $ZodMemoizer {\n attach(inst: $ZodType): void;\n guard(inst: $ZodType): void;\n alloc<T extends object>(inst: $ZodType, payload: ParsePayload, empty: T, ctx: ParseContextInternal): T;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":44,"symbol":"ParsePayload","kind":"interface","lang":"typescript","code":"interface ParsePayload<T = unknown> {\n value: T;\n issues: errors.$ZodRawIssue[];\n /** A way to mark a whole payload as aborted. Used in codecs/pipes. */\n aborted?: boolean;\n /** @internal Set when the value came from a repeat visit to a node still being\n * parsed. Its checks run on the node itself, against the finished value. */\n memo?: boolean | undefined;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":54,"symbol":"CheckFn","kind":"type","lang":"typescript","code":"type CheckFn<T> = (input: ParsePayload<T>) => util.MaybeAsync<void>;"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":58,"symbol":"$ZodTypeDef","kind":"interface","lang":"typescript","code":"interface $ZodTypeDef {\n type:\n | \"string\"\n | \"number\"\n | \"int\"\n | \"boolean\"\n | \"bigint\"\n | \"symbol\"\n | \"null\"\n | \"undefined\"\n | \"void\" // merge with undefined?\n | \"never\"\n | \"any\"\n | \"unknown\"\n | \"date\"\n | \"object\"\n | \"record\"\n | \"file\"\n | \"array\"\n | \"tuple\"\n | \"union\"\n | \"intersection\"\n | \"map\"\n | \"set\"\n | \"enum\"\n | \"literal\"\n | \"nullable\"\n | \"optional\"\n | \"nonoptional\"\n | \"success\"\n | \"transform\"\n | \"default\"\n | \"prefault\"\n | \"catch\"\n | \"nan\"\n | \"pipe\"\n | \"readonly\"\n | \"template_literal\"\n | \"promise\"\n | \"lazy\"\n | \"function\"\n | \"custom\";\n error?: errors.$ZodErrorMap<never> | undefined;\n checks?: checks.$ZodCheck<never>[];\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":104,"symbol":"_$ZodTypeInternals","kind":"interface","lang":"typescript","code":"interface _$ZodTypeInternals {\n /** The `@zod/core` version of this schema */\n version: typeof version;\n\n /** Schema definition. */\n def: $ZodTypeDef;\n // types: Types;\n\n /** @internal Randomly generated ID for this schema. */\n // id: string;\n\n /** @internal List of deferred initializers. */\n deferred: util.AnyFunc[] | undefined;\n\n /** @internal Parses input and runs all checks (refinements). */\n run(payload: ParsePayload<any>, ctx: ParseContextInternal): util.MaybeAsync<ParsePayload>;\n\n /** @internal Parses input, doesn't run checks. */\n parse(payload: ParsePayload<any>, ctx: ParseContextInternal): util.MaybeAsync<ParsePayload>;\n\n /** @internal Stores identifiers for the set of traits implemented by this schema. */\n traits: Set<string>;\n\n /** @internal Indicates that a schema output type should be considered optional inside objects.\n * @default Required\n */\n\n /** @internal Three rungs, each strictly stronger than the last:\n * undefined — required; the container may not omit this slot\n * \"optional\" — the container may omit it; nothing is supplied in its place\n * \"defaulted\" — the container may omit it AND this schema substitutes a value\n * "} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":181,"symbol":"$ZodTypeInternals","kind":"interface","lang":"typescript","doc":"@internal","code":"interface $ZodTypeInternals<out O = unknown, out I = unknown> extends _$ZodTypeInternals {\n /** @internal The inferred output type */\n output: O; //extends { $out: infer O } ? O : Out;\n /** @internal The inferred input type */\n input: I; //extends { $in: infer I } ? I : In;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":188,"symbol":"$ZodStandardSchema","kind":"type","lang":"typescript","code":"type $ZodStandardSchema<T> = StandardSchemaV1.Props<core.input<T>, core.output<T>>;"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":190,"symbol":"SomeType","kind":"type","lang":"typescript","code":"type SomeType = { _zod: _$ZodTypeInternals };"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":192,"symbol":"$ZodType","kind":"interface","lang":"typescript","code":"interface $ZodType<\n O = unknown,\n I = unknown,\n Internals extends $ZodTypeInternals<O, I> = $ZodTypeInternals<O, I>,\n> {\n _zod: Internals;\n \"~standard\": $ZodStandardSchema<this>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":200,"symbol":"_$ZodType","kind":"interface","lang":"typescript","code":"interface _$ZodType<T extends $ZodTypeInternals = $ZodTypeInternals>\n extends $ZodType<T[\"output\"], T[\"input\"], T> {}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":203,"symbol":"$ZodType","kind":"constant","lang":"typescript","code":"const $ZodType: core.$constructor<$ZodType> = /*@__PURE__*/ core.$constructor<$ZodType>(\n \"$ZodType\",\n (inst, def) => {\n inst ??= {} as any;\n\n inst._zod.def = def; // set _def property\n inst._zod.bag = inst._zod.bag || {}; // initialize _bag object\n inst._zod.version = version;\n\n const defChecks = inst._zod.def.checks;\n // if inst is itself a checks.$ZodCheck, run it as a check\n const checks: checks.$ZodCheck<never>[] = inst._zod.traits.has(\"$ZodCheck\")\n ? [inst as any, ...(defChecks ?? [])]\n : defChecks?.length\n ? [...defChecks]\n : [];\n\n for (const ch of checks) {\n for (const fn of ch._zod.onattach) {\n fn(inst);\n }\n }\n\n if (checks.length === 0) {\n // deferred initializer inst._zod.parse is not yet defined\n inst._zod.deferred ??= [];\n inst._zod.deferred?.push(() => {\n inst._zod.run = inst._zod.parse;\n });\n } else {\n const runChecks = (\n payload: ParsePayload,\n checks: checks.$ZodCheck<never>[],\n ctx?: ParseContextInternal | undefined\n ): util.MaybeAsync<ParsePayload> => {\n if (payload.memo) return payload;\n\n let isAborted = util.aborted"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":212,"symbol":"defChecks","kind":"constant","lang":"typescript","code":"const defChecks = inst._zod.def.checks;"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":214,"symbol":"checks","kind":"constant","lang":"typescript","doc":"if inst is itself a checks.$ZodCheck, run it as a check","code":"const checks: checks.$ZodCheck<never>[] = inst._zod.traits.has(\"$ZodCheck\")\n ? [inst as any, ...(defChecks ?? [])]\n : defChecks?.length\n ? [...defChecks]\n : [];"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":233,"symbol":"runChecks","kind":"constant","lang":"typescript","code":"const runChecks = (\n payload: ParsePayload,\n checks: checks.$ZodCheck<never>[],\n ctx?: ParseContextInternal | undefined\n ): util.MaybeAsync<ParsePayload> => {\n if (payload.memo) return payload;\n\n let isAborted = util.aborted(payload);\n\n let asyncResult!: Promise<unknown> | undefined;\n for (const ch of checks) {\n if (ch._zod.def.when) {\n if (util.explicitlyAborted(payload)) continue;\n const shouldRun = ch._zod.def.when(payload);\n if (!shouldRun) continue;\n } else if (isAborted) {\n continue;\n }\n const currLen = payload.issues.length;\n const _ = ch._zod.check(payload as any) as any as ParsePayload;\n\n if (_ instanceof Promise && ctx?.async === false) {\n throw new core.$ZodAsyncError();\n }\n if (asyncResult || _ instanceof Promise) {\n asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {\n await _;\n const nextLen = payload.issues.length;\n if (nextLen === currLen) return;\n util.attachSchema(payload.issues, currLen, inst);\n "} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":246,"symbol":"shouldRun","kind":"constant","lang":"typescript","code":"const shouldRun = ch._zod.def.when(payload);"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":251,"symbol":"currLen","kind":"constant","lang":"typescript","code":"const currLen = payload.issues.length;"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":252,"symbol":"_","kind":"constant","lang":"typescript","code":"const _ = ch._zod.check(payload as any) as any as ParsePayload;"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":260,"symbol":"nextLen","kind":"constant","lang":"typescript","code":"const nextLen = payload.issues.length;"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":266,"symbol":"nextLen","kind":"constant","lang":"typescript","code":"const nextLen = payload.issues.length;"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":281,"symbol":"handleCanaryResult","kind":"constant","lang":"typescript","code":"const handleCanaryResult = (canary: ParsePayload, payload: ParsePayload, ctx: ParseContextInternal) => {\n // abort if the canary is aborted\n if (util.aborted(canary)) {\n canary.aborted = true;\n return canary;\n }\n\n // run checks first, then\n const checkResult = runChecks(payload, checks, ctx);\n if (checkResult instanceof Promise) {\n if (ctx.async === false) throw new core.$ZodAsyncError();\n return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));\n }\n return inst._zod.parse(checkResult, ctx);\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":289,"symbol":"checkResult","kind":"constant","lang":"typescript","doc":"run checks first, then","code":"const checkResult = runChecks(payload, checks, ctx);"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":303,"symbol":"canary","kind":"constant","lang":"typescript","doc":"run canary initial pass (no checks)","code":"const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":315,"symbol":"result","kind":"constant","lang":"typescript","doc":"forward","code":"const result = inst._zod.parse(payload, ctx);"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":338,"symbol":"toStandardResult","kind":"constant","lang":"typescript","doc":"The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. a Standard Schema result only reports issues, so a failure finalizes them straight off the raw payload: no ZodError, and no lazy result to read through","code":"const toStandardResult = (r: ParsePayload, ctx: ParseContextInternal) =>\n r.issues.length ? { issues: r.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())) } : { value: r.value };"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":341,"symbol":"validateAsync","kind":"function","lang":"typescript","code":"async function validateAsync(inst: $ZodType, value: unknown) {\n const ctx: ParseContextInternal = { async: true };\n return toStandardResult((await inst._zod.run({ value, issues: [] }, ctx)) as ParsePayload, ctx);\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":342,"symbol":"ctx","kind":"constant","lang":"typescript","code":"const ctx: ParseContextInternal = { async: true };"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":346,"symbol":"standardProps","kind":"function","lang":"typescript","code":"function standardProps(inst: $ZodType): StandardSchemaV1.Props<any, any> {\n return {\n validate: (value: unknown) => {\n const ctx: ParseContextInternal = { async: false };\n try {\n const r = inst._zod.run({ value, issues: [] }, ctx);\n if (!(r instanceof Promise)) return toStandardResult(r, ctx);\n } catch (_) {}\n // async function so a synchronously throwing check rejects instead of escaping validate\n return validateAsync(inst, value);\n },\n vendor: \"zod\",\n version: 1 as const,\n };\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":349,"symbol":"ctx","kind":"constant","lang":"typescript","code":"const ctx: ParseContextInternal = { async: false };"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":351,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = inst._zod.run({ value, issues: [] }, ctx);"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":371,"symbol":"$ZodStringDef","kind":"interface","lang":"typescript","doc":"/////////////////////////////////////// /////// ////////// /////// $ZodString ////////// /////// ////////// /////////////////////////////////////// ///////////////////////////////////////","code":"interface $ZodStringDef extends $ZodTypeDef {\n type: \"string\";\n coerce?: boolean;\n checks?: checks.$ZodCheck<string>[];\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":377,"symbol":"$ZodStringInternals","kind":"interface","lang":"typescript","code":"interface $ZodStringInternals<Input> extends $ZodTypeInternals<string, Input> {\n def: $ZodStringDef;\n /** @deprecated Internal API, use with caution (not deprecated) */\n pattern: RegExp;\n\n /** @deprecated Internal API, use with caution (not deprecated) */\n isst: errors.$ZodIssueInvalidType;\n bag: util.LoosePartial<{\n minimum: number;\n maximum: number;\n patterns: Set<RegExp>;\n format: string;\n contentEncoding: string;\n /** the pattern admits strings its `format` keyword forbids, so `toJSONSchema` must not emit it */\n laxFormat: boolean;\n }>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":395,"symbol":"$ZodString","kind":"interface","lang":"typescript","code":"interface $ZodString<Input = unknown> extends _$ZodType<$ZodStringInternals<Input>> {\n // _zod: $ZodStringInternals<Input>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":399,"symbol":"$ZodString","kind":"constant","lang":"typescript","code":"const $ZodString: core.$constructor<$ZodString> = /*@__PURE__*/ core.$constructor(\"$ZodString\", (inst, def) => {\n $ZodType.init(inst, def);\n // a format's own pattern, else unbounded; a template literal derives the check-aware form itself\n inst._zod.pattern = (def as $ZodStringFormatDef).pattern ?? regexes.anyString;\n inst._zod.parse = (payload, _) => {\n if (def.coerce)\n try {\n payload.value = String(payload.value);\n } catch (_) {}\n\n if (typeof payload.value === \"string\") return payload;\n\n payload.issues.push({\n expected: \"string\",\n code: \"invalid_type\",\n\n input: payload.value,\n inst,\n });\n return payload;\n };\n});"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":424,"symbol":"$ZodStringFormatDef","kind":"interface","lang":"typescript","code":"interface $ZodStringFormatDef<Format extends string = string>\n extends $ZodStringDef,\n checks.$ZodCheckStringFormatDef<Format> {}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":428,"symbol":"$ZodStringFormatInternals","kind":"interface","lang":"typescript","code":"interface $ZodStringFormatInternals<Format extends string = string>\n extends $ZodStringInternals<string>,\n checks.$ZodCheckStringFormatInternals {\n def: $ZodStringFormatDef<Format>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":433,"symbol":"$ZodStringFormat","kind":"interface","lang":"typescript","code":"interface $ZodStringFormat<Format extends string = string> extends $ZodType {\n _zod: $ZodStringFormatInternals<Format>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":437,"symbol":"$ZodStringFormat","kind":"constant","lang":"typescript","code":"const $ZodStringFormat: core.$constructor<$ZodStringFormat> = /*@__PURE__*/ core.$constructor(\n \"$ZodStringFormat\",\n (inst, def): void => {\n // check initialization must come first\n checks.$ZodCheckStringFormat.init(inst, def);\n $ZodString.init(inst, def);\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":447,"symbol":"$ZodGUIDDef","kind":"interface","lang":"typescript","doc":"/////////////////////////// ZodGUID //////////////////////////////","code":"interface $ZodGUIDDef extends $ZodStringFormatDef<\"guid\"> {}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":448,"symbol":"$ZodGUIDInternals","kind":"interface","lang":"typescript","code":"interface $ZodGUIDInternals extends $ZodStringFormatInternals<\"guid\"> {}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":450,"symbol":"$ZodGUID","kind":"interface","lang":"typescript","code":"interface $ZodGUID extends $ZodType {\n _zod: $ZodGUIDInternals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":454,"symbol":"$ZodGUID","kind":"constant","lang":"typescript","code":"const $ZodGUID: core.$constructor<$ZodGUID> = /*@__PURE__*/ core.$constructor(\"$ZodGUID\", (inst, def): void => {\n def.pattern ??= regexes.guid;\n $ZodStringFormat.init(inst, def);\n});"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":461,"symbol":"$ZodUUIDDef","kind":"interface","lang":"typescript","code":"interface $ZodUUIDDef extends $ZodStringFormatDef<\"uuid\"> {\n version?: \"v1\" | \"v2\" | \"v3\" | \"v4\" | \"v5\" | \"v6\" | \"v7\" | \"v8\";\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":465,"symbol":"$ZodUUIDInternals","kind":"interface","lang":"typescript","code":"interface $ZodUUIDInternals extends $ZodStringFormatInternals<\"uuid\"> {\n def: $ZodUUIDDef;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":469,"symbol":"$ZodUUID","kind":"interface","lang":"typescript","code":"interface $ZodUUID extends $ZodType {\n _zod: $ZodUUIDInternals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":473,"symbol":"$ZodUUID","kind":"constant","lang":"typescript","code":"const $ZodUUID: core.$constructor<$ZodUUID> = /*@__PURE__*/ core.$constructor(\"$ZodUUID\", (inst, def): void => {\n if (def.version) {\n const versionMap: Record<string, number> = {\n v1: 1,\n v2: 2,\n v3: 3,\n v4: 4,\n v5: 5,\n v6: 6,\n v7: 7,\n v8: 8,\n };\n const v = versionMap[def.version];\n if (v === undefined) throw new Error(`Invalid UUID version: \"${def.version}\"`);\n def.pattern ??= regexes.uuid(v);\n } else def.pattern ??= regexes.uuid();\n $ZodStringFormat.init(inst, def);\n});"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":475,"symbol":"versionMap","kind":"constant","lang":"typescript","code":"const versionMap: Record<string, number> = {\n v1: 1,\n v2: 2,\n v3: 3,\n v4: 4,\n v5: 5,\n v6: 6,\n v7: 7,\n v8: 8,\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":485,"symbol":"v","kind":"constant","lang":"typescript","code":"const v = versionMap[def.version];"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":494,"symbol":"$ZodEmailDef","kind":"interface","lang":"typescript","code":"interface $ZodEmailDef extends $ZodStringFormatDef<\"email\"> {}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":495,"symbol":"$ZodEmailInternals","kind":"interface","lang":"typescript","code":"interface $ZodEmailInternals extends $ZodStringFormatInternals<\"email\"> {}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":496,"symbol":"$ZodEmail","kind":"interface","lang":"typescript","code":"interface $ZodEmail extends $ZodType {\n _zod: $ZodEmailInternals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":500,"symbol":"$ZodEmail","kind":"constant","lang":"typescript","code":"const $ZodEmail: core.$constructor<$ZodEmail> = /*@__PURE__*/ core.$constructor(\n \"$ZodEmail\",\n (inst, def): void => {\n def.pattern ??= regexes.email;\n $ZodStringFormat.init(inst, def);\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":510,"symbol":"$ZodURLDef","kind":"interface","lang":"typescript","code":"interface $ZodURLDef extends $ZodStringFormatDef<\"url\"> {\n hostname?: RegExp | undefined;\n protocol?: RegExp | undefined;\n normalize?: boolean | undefined;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":515,"symbol":"$ZodURLInternals","kind":"interface","lang":"typescript","code":"interface $ZodURLInternals extends $ZodStringFormatInternals<\"url\"> {\n def: $ZodURLDef;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":519,"symbol":"$ZodURL","kind":"interface","lang":"typescript","code":"interface $ZodURL extends $ZodType {\n _zod: $ZodURLInternals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":524,"symbol":"URL_BAD_FORMAT","kind":"constant","lang":"typescript","doc":"The `://` guard rejected the input before the URL constructor saw it.","code":"const URL_BAD_FORMAT = 1;"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":526,"symbol":"URL_UNPARSEABLE","kind":"constant","lang":"typescript","doc":"The URL parser rejected the input.","code":"const URL_UNPARSEABLE = 2;"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":528,"symbol":"canParseURL","kind":"function","lang":"typescript","code":"function canParseURL(input: string): boolean {\n try {\n if (typeof URL !== \"undefined\" && typeof URL.canParse === \"function\") return URL.canParse(input);\n new URL(input);\n return true;\n } catch {\n return false;\n }\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/schemas.ts","line":538,"symbol":"validateURL","kind":"function","lang":"typescript","code":"function validateURL(\n trimmed: string,\n def: Pick<$ZodURLDef, \"protocol\" | \"hostname\" | \"normalize\">\n): URL | true | typeof URL_BAD_FORMAT | typeof URL_UNPARSEABLE {\n if (!(\"normalize\" in def) && !(\"hostname\" in def) && !(\"protocol\" in def)) {\n return canParseURL(trimmed) || URL_UNPARSEABLE;\n }\n return parseURLObject(trimmed, def);\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":2,"symbol":"StandardTypedV1","kind":"interface","lang":"typescript","doc":"The Standard interface.","code":"interface StandardTypedV1<Input = unknown, Output = Input> {\n /** The Standard properties. */\n readonly \"~standard\": StandardTypedV1.Props<Input, Output>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":9,"symbol":"Props","kind":"interface","lang":"typescript","doc":"The Standard properties interface.","code":"interface Props<Input = unknown, Output = Input> {\n /** The version number of the standard. */\n readonly version: 1;\n /** The vendor name of the schema library. */\n readonly vendor: string;\n /** Inferred types associated with the schema. */\n readonly types?: Types<Input, Output> | undefined;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":19,"symbol":"Types","kind":"interface","lang":"typescript","doc":"The Standard types interface.","code":"interface Types<Input = unknown, Output = Input> {\n /** The input type of the schema. */\n readonly input: Input;\n /** The output type of the schema. */\n readonly output: Output;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":27,"symbol":"InferInput","kind":"type","lang":"typescript","doc":"Infers the input type of a Standard.","code":"type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema[\"~standard\"][\"types\"]>[\"input\"];"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":30,"symbol":"InferOutput","kind":"type","lang":"typescript","doc":"Infers the output type of a Standard.","code":"type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema[\"~standard\"][\"types\"]>[\"output\"];"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":34,"symbol":"StandardSchemaV1","kind":"interface","lang":"typescript","doc":"The Standard Schema interface.","code":"interface StandardSchemaV1<Input = unknown, Output = Input> {\n /** The Standard Schema properties. */\n readonly \"~standard\": StandardSchemaV1.Props<Input, Output>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":41,"symbol":"Props","kind":"interface","lang":"typescript","doc":"The Standard Schema properties interface.","code":"interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {\n /** Validates unknown input values. */\n readonly validate: (\n value: unknown,\n options?: StandardSchemaV1.Options | undefined\n ) => Result<Output> | Promise<Result<Output>>;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":50,"symbol":"Result","kind":"type","lang":"typescript","doc":"The result interface of the validate function.","code":"type Result<Output> = SuccessResult<Output> | FailureResult;"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":53,"symbol":"SuccessResult","kind":"interface","lang":"typescript","doc":"The result interface if validation succeeds.","code":"interface SuccessResult<Output> {\n /** The typed output value. */\n readonly value: Output;\n /** The absence of issues indicates success. */\n readonly issues?: undefined;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":60,"symbol":"Options","kind":"interface","lang":"typescript","code":"interface Options {\n /** Implicit support for additional vendor-specific parameters, if needed. */\n readonly libraryOptions?: Record<string, unknown> | undefined;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":66,"symbol":"FailureResult","kind":"interface","lang":"typescript","doc":"The result interface if validation fails.","code":"interface FailureResult {\n /** The issues of failed validation. */\n readonly issues: ReadonlyArray<Issue>;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":72,"symbol":"Issue","kind":"interface","lang":"typescript","doc":"The issue interface of the failure output.","code":"interface Issue {\n /** The error message of the issue. */\n readonly message: string;\n /** The path of the issue, if any. */\n readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":80,"symbol":"PathSegment","kind":"interface","lang":"typescript","doc":"The path segment interface of the issue.","code":"interface PathSegment {\n /** The key representing a path segment. */\n readonly key: PropertyKey;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":86,"symbol":"Types","kind":"interface","lang":"typescript","doc":"The Standard types interface.","code":"interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":89,"symbol":"InferInput","kind":"type","lang":"typescript","doc":"Infers the input type of a Standard.","code":"type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":92,"symbol":"InferOutput","kind":"type","lang":"typescript","doc":"Infers the output type of a Standard.","code":"type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":96,"symbol":"StandardJSONSchemaV1","kind":"interface","lang":"typescript","doc":"The Standard JSON Schema interface.","code":"interface StandardJSONSchemaV1<Input = unknown, Output = Input> {\n /** The Standard JSON Schema properties. */\n readonly \"~standard\": StandardJSONSchemaV1.Props<Input, Output>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":103,"symbol":"Props","kind":"interface","lang":"typescript","doc":"The Standard JSON Schema properties interface.","code":"interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {\n /** Methods for generating the input/output JSON Schema. */\n readonly jsonSchema: Converter;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":109,"symbol":"Converter","kind":"interface","lang":"typescript","doc":"The Standard JSON Schema converter interface.","code":"interface Converter {\n /** Converts the input type to JSON Schema. May throw if conversion is not supported. */\n readonly input: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;\n /** Converts the output type to JSON Schema. May throw if conversion is not supported. */\n readonly output: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":124,"symbol":"Target","kind":"type","lang":"typescript","doc":"It is *strongly recommended* that implementers support `\"draft-2020-12\"` and `\"draft-07\"`, as they are both in wide use. The `\"openapi-3.0\"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `\"draft-04\"`. All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target.","code":"type Target =\n | \"draft-2020-12\"\n | \"draft-07\"\n | \"openapi-3.0\"\n // Accepts any string for future targets while preserving autocomplete\n | ({} & string);"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":132,"symbol":"Options","kind":"interface","lang":"typescript","doc":"The options for the input/output methods.","code":"interface Options {\n /** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */\n readonly target: Target;\n\n /** Implicit support for additional vendor-specific parameters, if needed. */\n readonly libraryOptions?: Record<string, unknown> | undefined;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":141,"symbol":"Types","kind":"interface","lang":"typescript","doc":"The Standard types interface.","code":"interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":144,"symbol":"InferInput","kind":"type","lang":"typescript","doc":"Infers the input type of a Standard.","code":"type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":147,"symbol":"InferOutput","kind":"type","lang":"typescript","doc":"Infers the output type of a Standard.","code":"type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":150,"symbol":"StandardSchemaWithJSONProps","kind":"interface","lang":"typescript","code":"interface StandardSchemaWithJSONProps<Input = unknown, Output = Input>\n extends StandardSchemaV1.Props<Input, Output>,\n StandardJSONSchemaV1.Props<Input, Output> {}"} {"repo":"zod","file":"packages/zod/src/v4/core/standard-schema.ts","line":157,"symbol":"StandardSchemaWithJSON","kind":"interface","lang":"typescript","doc":"An interface that combines StandardJSONSchema and StandardSchema.","code":"interface StandardSchemaWithJSON<Input = unknown, Output = Input> {\n \"~standard\": StandardSchemaWithJSONProps<Input, Output>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/cached.test.ts","line":7,"symbol":"box","kind":"constant","lang":"typescript","code":"const box = util.cached(() => ++runs);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/cached.test.ts","line":16,"symbol":"box","kind":"constant","lang":"typescript","code":"const box = util.cached(() => {\n runs++;\n return undefined;\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/cached.test.ts","line":27,"symbol":"box","kind":"constant","lang":"typescript","code":"const box = util.cached(() => {\n if (++attempts < 2) throw new Error(\"boom\");\n return \"recovered\";\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/cached.test.ts","line":37,"symbol":"box","kind":"constant","lang":"typescript","code":"const box = util.cached(() => 1);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/cached.test.ts","line":45,"symbol":"box","kind":"constant","lang":"typescript","code":"const box = util.cached(() => 1);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":7,"symbol":"describe","kind":"function","lang":"typescript","doc":"Differential harness: assert compiled schema agrees with the original on every fixture. Success path: data identical (incl. key order and undefined-vs-absent, which toEqual cannot see) AND the fast path actually produced the value (a fixture set that silently falls back on valid inputs tests nothing). Failure path: issues deep-equal (errors always come from the runtime fallback).","code":"function describe(value: unknown): string {\n try {\n return JSON.stringify(value, (_k, v) => (typeof v === \"bigint\" ? `${v}n` : v));\n } catch {\n return String(value);\n }\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":16,"symbol":"assertIdentical","kind":"function","lang":"typescript","doc":"Stricter-than-toEqual structural identity: own-key order, symbol keys, undefined-valued vs absent keys, array holes, frozenness, NaN/-0.","code":"function assertIdentical(actual: unknown, expected: unknown, path: string): void {\n if (Object.is(actual, expected)) return;\n if (actual === null || expected === null || typeof expected !== \"object\" || typeof actual !== \"object\") {\n expect(actual, `value mismatch at ${path}`).toEqual(expected);\n expect(Object.is(actual, expected), `Object.is mismatch at ${path} (NaN/-0?)`).toBe(true);\n return;\n }\n expect(Object.getPrototypeOf(actual), `prototype mismatch at ${path}`).toBe(Object.getPrototypeOf(expected));\n expect(Object.isFrozen(actual), `frozenness mismatch at ${path}`).toBe(Object.isFrozen(expected));\n if (expected instanceof Date) {\n expect((actual as Date).getTime(), `Date mismatch at ${path}`).toBe(expected.getTime());\n return;\n }\n if (expected instanceof Map) {\n expect([...(actual as Map<unknown, unknown>).entries()], `Map mismatch at ${path}`).toEqual([\n ...expected.entries(),\n ]);\n return;\n }\n if (expected instanceof Set) {\n expect([...(actual as Set<unknown>)], `Set mismatch at ${path}`).toEqual([...expected]);\n return;\n }\n if (Array.isArray(expected)) {\n expect((actual as unknown[]).length, `length mismatch at ${path}`).to"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":47,"symbol":"actualKeys","kind":"constant","lang":"typescript","code":"const actualKeys = Reflect.ownKeys(actual as object);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":48,"symbol":"expectedKeys","kind":"constant","lang":"typescript","code":"const expectedKeys = Reflect.ownKeys(expected as object);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":59,"symbol":"differential","kind":"function","lang":"typescript","code":"function differential(schema: z.ZodType, inputs: unknown[], opts?: { fallbackOk?: boolean }) {\n const compiled = compile(schema);\n const fast = compileFn(schema);\n // Assert-mode codegen shares every validation path with the parser and only drops the output construction, so it must reach the same verdict on every fixture. Refusing to compile at all is fine (the caller falls back); silently disagreeing is the drift this catches.\n const assertFast = attempt(() => compileFn(schema, { assertOnly: true })).value;\n for (const input of inputs) {\n // A schema may throw rather than return — an async check reached synchronously does. Both sides have to agree on that too, and comparing results would just rethrow.\n const at = attempt(() => schema.safeParse(input));\n const bt = attempt(() => compiled.safeParse(input));\n expect(\n bt.threw,\n `throw mismatch for input ${describe(input)}: runtime ${at.threw ?? \"did not throw\"}, compiled ${bt.threw ?? \"did not throw\"}`\n ).toBe(at.threw);\n if (at.threw) continue;\n const a = at.value!;\n const b = bt.value!;\n expect(b.success, `success mismatch for input ${describe(input)}`).toBe(a.success);\n if (assertFast)"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":60,"symbol":"compiled","kind":"constant","lang":"typescript","code":"const compiled = compile(schema);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":61,"symbol":"fast","kind":"constant","lang":"typescript","code":"const fast = compileFn(schema);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":63,"symbol":"assertFast","kind":"constant","lang":"typescript","doc":"Assert-mode codegen shares every validation path with the parser and only drops the output construction, so it must reach the same verdict on every fixture. Refusing to compile at all is fine (the caller falls back); silently disagreeing is the drift this catches.","code":"const assertFast = attempt(() => compileFn(schema, { assertOnly: true })).value;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":66,"symbol":"at","kind":"constant","lang":"typescript","doc":"A schema may throw rather than return — an async check reached synchronously does. Both sides have to agree on that too, and comparing results would just rethrow.","code":"const at = attempt(() => schema.safeParse(input));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":67,"symbol":"bt","kind":"constant","lang":"typescript","code":"const bt = attempt(() => compiled.safeParse(input));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":73,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = at.value!;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":74,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = bt.value!;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":77,"symbol":"parseVerdict","kind":"constant","lang":"typescript","code":"const parseVerdict = attempt(() => fast(input) !== INVALID);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":78,"symbol":"assertVerdict","kind":"constant","lang":"typescript","code":"const assertVerdict = attempt(() => assertFast(input) !== INVALID);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":112,"symbol":"attempt","kind":"function","lang":"typescript","doc":"so a bail-out silently becomes a different parse result with no error at all. Wrap the schema next to a branch that accepts anything and assert the sentinel never wins on input the schema itself accepts. Runs `fn`, reporting the error's class rather than letting it escape. `constructor.name`, not `.name`: `$ZodAsyncError` never sets `.name`, so it reads as plain `\"Error\"` and a swapped error class would compare equal to a user throw.","code":"function attempt<T>(fn: () => T): { value?: T; threw?: string } {\n try {\n return { value: fn() };\n } catch (err) {\n return { threw: (err as Error)?.constructor?.name || \"Error\" };\n }\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":120,"symbol":"assertUnionSound","kind":"function","lang":"typescript","code":"function assertUnionSound(schema: z.ZodType, inputs: unknown[]) {\n const marker = Symbol(\"sentinel\");\n const sentinel = z.any().transform(() => marker);\n let union: z.ZodType;\n let compiledUnion: z.ZodType;\n try {\n union = z.union([schema, sentinel]) as unknown as z.ZodType;\n compiledUnion = compile(union);\n } catch {\n return; // Refused at codegen, which is the outcome a union honours.\n }\n for (const input of inputs) {\n const direct = attempt(() => schema.safeParse(input));\n const viaUnion = attempt(() => compiledUnion.safeParse(input));\n\n if (direct.threw) {\n // A bare throw does not decide what the union does, so the interpreted union is the only reference: `refine`, `superRefine` and `custom` propagate out of it, while `transform` and `pipe` let it answer with a later branch. Measure it rather than assume. Nothing else in this file can see this class — the bare differential compares a fast path that returned INVALID against a fallback that re-runs the interpreter, so both sides reproduce the throw whichever way the guard is written.\n const interpreted = attempt(() => union.safeParse(input));\n expect(\n viaUnion.threw ?? \"did not th"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":121,"symbol":"marker","kind":"constant","lang":"typescript","code":"const marker = Symbol(\"sentinel\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":122,"symbol":"sentinel","kind":"constant","lang":"typescript","code":"const sentinel = z.any().transform(() => marker);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":132,"symbol":"direct","kind":"constant","lang":"typescript","code":"const direct = attempt(() => schema.safeParse(input));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":133,"symbol":"viaUnion","kind":"constant","lang":"typescript","code":"const viaUnion = attempt(() => compiledUnion.safeParse(input));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":137,"symbol":"interpreted","kind":"constant","lang":"typescript","doc":"A bare throw does not decide what the union does, so the interpreted union is the only reference: `refine`, `superRefine` and `custom` propagate out of it, while `transform` and `pipe` let it answer with a later branch. Measure it rather than assume. Nothing else in this file can see this class — the bare differential compares a fast path that returned INVALID against a fallback that re-runs the interpreter, so both sides reproduce the throw whichever way the guard is written.","code":"const interpreted = attempt(() => union.safeParse(input));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":150,"symbol":"got","kind":"constant","lang":"typescript","code":"const got = viaUnion.value!;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":227,"symbol":"shape","kind":"constant","lang":"typescript","code":"const shape = { a: z.string(), b: z.number() };"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":404,"symbol":"key","kind":"constant","lang":"typescript","code":"const key = Symbol(\"record-key\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":405,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = { a: 1, [key]: 2 };"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":414,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(\n z.enum([\"a\", \"b\"]).transform((key) => (key === \"a\" ? \"x\" : \"y\")),\n z.number()\n );"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":471,"symbol":"inputs","kind":"constant","lang":"typescript","code":"const inputs = [\n \"abc\",\n \"\\u{1F600}\",\n \"\\u{1F600}\\u{1F600}\",\n \"\\u{1F600}\\u{1F600}\\u{1F600}\",\n \"\\u{1F600}\\u{1F600}ab\",\n \"\\uD83D\",\n \"\",\n ];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":546,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().superRefine((val, ctx) => {\n if (!val.includes(\"@\")) ctx.addIssue({ code: \"custom\", message: \"missing @\" });\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":569,"symbol":"schema","kind":"constant","lang":"typescript","doc":"The callback reads issues finalized against the caller's per-parse error map, which generated code has no access to. Refusing at codegen is what makes it safe inside a union; returning INVALID at parse time would read as a rejected branch.","code":"const schema = z.catch(z.string().min(5), (ctx) => `e:${ctx.error.issues.length}`);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":577,"symbol":"inner","kind":"constant","lang":"typescript","doc":"A container normally absorbs an unsupported child by running just that node through the runtime. That is only equivalent for a node that *propagates* its issues: an island gets no parse context, and catch CONSUMES issues, so an islanded catch finalizes against an empty error map and still succeeds. The divergence is silent — the parse returns a different string with no error anywhere. Refusing the whole schema is what keeps the container honest, so this asserts the throw rather than a matching value.","code":"const inner = z.catch(z.string(), (ctx) => `msg=${ctx.error.issues[0]?.message}`);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":578,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: inner, b: z.number() });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":579,"symbol":"mapped","kind":"constant","lang":"typescript","code":"const mapped = { error: () => \"MAPPED\" };"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":610,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.looseObject({ name: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":611,"symbol":"polluted","kind":"constant","lang":"typescript","code":"const polluted = JSON.parse('{\"name\":\"ok\",\"__proto__\":{\"x\":1}}');"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":616,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.array(\n z.object({\n kind: z.string(),\n value: z.union([z.string(), z.number(), z.array(z.boolean())]),\n })\n );"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":634,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n a: z\n .object({\n b: z.number().default(10),\n })\n .optional(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":648,"symbol":"inputs","kind":"constant","lang":"typescript","doc":"`parseValidURL` is a second implementation of what `$ZodURL`'s own check does inline — the trim, the `://` guard, the hostname and protocol tests, the normalize step. Deduplicating them faithfully is awkward, because hostname and protocol can both fail and each pushes its own issue, so the shared helper would have to return a list of reasons rather than a value. Until that happens this matrix is what keeps the two copies honest: a fix to either that the other misses fails here rather than drifting silently, which is exactly how z.creditCard() went wrong.","code":"const inputs = [\n \"https://example.com\",\n \"https://example.com/a/b?c=1#d\",\n \" https://example.com \",\n \"http://example.com\",\n \"http:example.com\",\n \"https:/path\",\n \"ftp://example.com\",\n \"https://sub.example.co.uk\",\n \"https://example.com:8443/x\",\n \"not a url\",\n \"\",\n \"//example.com\",\n \"mailto:a@b.com\",\n // The WHATWG parser deletes these rather than failing, so the two paths only agree if both apply that deletion to the value they return.\n \"https://exa\\nmple.com\",\n \"https://exa\\tmple.com\",\n \"https://example.com/a\\rb?c=d#e\",\n ];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":667,"symbol":"schemas","kind":"constant","lang":"typescript","code":"const schemas: z.ZodType[] = [\n z.url(),\n z.url({ normalize: true }),\n z.url({ hostname: /^example\\.com$/ }),\n z.url({ protocol: /^https$/ }),\n z.url({ protocol: /^https?$/ }),\n z.url({ hostname: /^example\\.com$/, protocol: /^https$/ }),\n z.url({ hostname: /^example\\.com$/, normalize: true }),\n z.httpUrl(),\n ];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":681,"symbol":"sanitized","kind":"constant","lang":"typescript","code":"const sanitized = \"https://example.com\";"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":682,"symbol":"withNewline","kind":"constant","lang":"typescript","code":"const withNewline = \"https://exa\\nmple.com\";"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":686,"symbol":"URLStatic","kind":"constant","lang":"typescript","code":"const URLStatic = URL as typeof URL & { parse: (input: string) => URL | null };"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":687,"symbol":"descriptor","kind":"constant","lang":"typescript","code":"const descriptor = Object.getOwnPropertyDescriptor(URLStatic, \"parse\")!;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":688,"symbol":"marker","kind":"constant","lang":"typescript","code":"const marker = new Error(\"href read\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":694,"symbol":"get","kind":"method","lang":"typescript","code":"get() {\n throw marker;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":701,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.url({ normalize: true });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":702,"symbol":"parser","kind":"constant","lang":"typescript","code":"const parser = compileFn(schema);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":703,"symbol":"validator","kind":"constant","lang":"typescript","code":"const validator = compileFn(schema, { assertOnly: true });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":734,"symbol":"rest","kind":"constant","lang":"typescript","doc":"Function.length reports 0 for rest and defaulted parameters alike, so arity cannot separate a user callback from the thunk `.catch(value)` synthesises. Provenance can.","code":"const rest = z.catch(z.string().min(5), ((...a: any[]) => `e:${a[0].error.issues.length}`) as never);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":735,"symbol":"dflt","kind":"constant","lang":"typescript","code":"const dflt = z.catch(\n z.string().min(5),\n ((ctx: any = { error: { issues: [] } }) => `e:${ctx.error.issues.length}`) as never\n );"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":780,"symbol":"makeRng","kind":"function","lang":"typescript","doc":"Generated corpus. The hand-written fixtures above pin the shapes we reasoned about; this covers the combinations nobody thought to write, which is where a codegen flag actually breaks. Seeded so a failure reproduces.","code":"function makeRng(seed: number): () => number {\n let a = seed;\n return () => {\n a = (a + 0x6d2b79f5) | 0;\n let t = Math.imul(a ^ (a >>> 15), 1 | a);\n t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":790,"symbol":"nonEmpty","kind":"function","lang":"typescript","code":"function nonEmpty(v: unknown): boolean {\n if (v === \"\") return false;\n if (Array.isArray(v)) return v.length > 0;\n if (v !== null && typeof v === \"object\" && !(v instanceof Date)) return Object.keys(v).length > 0;\n return true;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":797,"symbol":"Generated","kind":"interface","lang":"typescript","code":"interface Generated {\n schema: z.ZodType;\n ok: () => unknown;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":802,"symbol":"generate","kind":"function","lang":"typescript","code":"function generate(rnd: () => number, depth: number): Generated {\n const pick = <T>(xs: T[]): T => xs[Math.floor(rnd() * xs.length)];\n const leaves = [\"string\", \"number\", \"boolean\", \"literal\", \"enum\", \"bounded\", \"int\"];\n // Only object, array, optional and nullable consume `buildsValue`; every other generator calls the 4-arg `compileChild`, which defaults `needsValue` to true and puts the subtree back in full-value mode. Assert-mode-specific state only arises in chains of those four, so they are weighted to make such chains common rather than incidental.\n const nodes = [\n \"object\",\n \"looseObject\",\n \"strictObject\",\n \"array\",\n \"optional\",\n \"nullable\",\n \"object\",\n \"array\",\n \"optional\",\n \"nullable\",\n \"union\",\n \"tuple\",\n \"record\",\n \"default\",\n \"catch\",\n \"refine\",\n \"refine\",\n \"refine\",\n \"transform\",\n \"pipe\",\n ];\n switch (depth <= 0 ? pick(leaves) : pick(rnd() < 0.45 ? leaves : nodes)) {\n case \"string\":\n return { schema: z.string(), ok: () => pick([\"a\", \"\", \"hello\"]) };\n case \"bounded\":\n return { schema: z.string().min(2).max(6), ok: () => pick([\"ab\", \"abcdef\"]) };\n case \"number\":\n return { schema: z."} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":803,"symbol":"pick","kind":"constant","lang":"typescript","code":"const pick = <T>(xs: T[]): T => xs[Math.floor(rnd() * xs.length)];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":804,"symbol":"leaves","kind":"constant","lang":"typescript","code":"const leaves = [\"string\", \"number\", \"boolean\", \"literal\", \"enum\", \"bounded\", \"int\"];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":806,"symbol":"nodes","kind":"constant","lang":"typescript","doc":"Only object, array, optional and nullable consume `buildsValue`; every other generator calls the 4-arg `compileChild`, which defaults `needsValue` to true and puts the subtree back in full-value mode. Assert-mode-specific state only arises in chains of those four, so they are weighted to make such chains common rather than incidental.","code":"const nodes = [\n \"object\",\n \"looseObject\",\n \"strictObject\",\n \"array\",\n \"optional\",\n \"nullable\",\n \"object\",\n \"array\",\n \"optional\",\n \"nullable\",\n \"union\",\n \"tuple\",\n \"record\",\n \"default\",\n \"catch\",\n \"refine\",\n \"refine\",\n \"refine\",\n \"transform\",\n \"pipe\",\n ];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":846,"symbol":"kids","kind":"constant","lang":"typescript","code":"const kids: Record<string, Generated> = {};"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":847,"symbol":"shape","kind":"constant","lang":"typescript","code":"const shape: Record<string, z.ZodType> = {};"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":852,"symbol":"ctor","kind":"constant","lang":"typescript","code":"const ctor = pick([z.object, z.looseObject, z.strictObject]) as typeof z.object;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-differential.test.ts","line":859,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = generate(rnd, depth - 1);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":8,"symbol":"mulberry32","kind":"function","lang":"typescript","code":"function mulberry32(seed: number): () => number {\n return () => {\n seed = (seed + 0x6d2b79f5) | 0;\n let t = Math.imul(seed ^ (seed >>> 15), 1 | seed);\n t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":17,"symbol":"Gen","kind":"interface","lang":"typescript","code":"interface Gen {\n schema: z.ZodType;\n desc: string;\n valid: () => unknown;\n // one corruption of a valid value; not always rejected (a loose object absorbs an extra key), and both sides must agree either way\n corrupt: (v: unknown) => unknown;\n // this node itself has no fast emitter and compiles through the runtime\n island: boolean;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":27,"symbol":"Ctx","kind":"interface","lang":"typescript","code":"interface Ctx {\n rand: () => number;\n // runs per generated callback, so the two-run bound holds for each one rather than for the sum\n calls: Map<number, number>;\n nextCallback: number;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":34,"symbol":"count","kind":"function","lang":"typescript","code":"function count(c: Ctx, id: number): void {\n c.calls.set(id, (c.calls.get(id) ?? 0) + 1);\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":38,"symbol":"pick","kind":"constant","lang":"typescript","code":"const pick = <T>(c: Ctx, xs: readonly T[]): T => xs[Math.floor(c.rand() * xs.length)]!;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":39,"symbol":"int","kind":"constant","lang":"typescript","code":"const int = (c: Ctx, lo: number, hi: number): number => lo + Math.floor(c.rand() * (hi - lo + 1));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":40,"symbol":"JUNK","kind":"constant","lang":"typescript","code":"const JUNK = [42, \"x\", null, undefined, true, [], {}, -0, Number.NaN] as const;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":42,"symbol":"leaf","kind":"function","lang":"typescript","code":"function leaf(c: Ctx): Gen {\n switch (int(c, 0, 7)) {\n case 0: {\n const min = int(c, 0, 3);\n return {\n schema: z.string().min(min),\n desc: `string.min(${min})`,\n valid: () => \"x\".repeat(min + int(c, 0, 2)),\n corrupt: () => (c.rand() < 0.5 ? 42 : \"x\".repeat(Math.max(0, min - 1))),\n island: false,\n };\n }\n case 1:\n return {\n schema: z.email(),\n desc: \"email\",\n valid: () => \"a@b.co\",\n corrupt: () => (c.rand() < 0.5 ? \"nope\" : 1),\n island: false,\n };\n case 2: {\n const lo = int(c, -5, 0);\n const hi = int(c, 1, 5);\n return {\n schema: z.number().int().min(lo).max(hi),\n desc: `int[${lo},${hi}]`,\n valid: () => int(c, lo, hi),\n corrupt: () => pick(c, [hi + 1, lo - 1, 1.5, \"1\"]),\n island: false,\n };\n }\n case 3:\n return {\n schema: z.boolean(),\n desc: \"boolean\",\n valid: () => c.rand() < 0.5,\n corrupt: () => pick(c, [\"true\", 0, null]),\n island: false,\n };\n case 4: {\n const lit = pick(c, [\"a\", 1, true] as const);\n return {\n schema: z.literal(lit),\n desc: `liter"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":45,"symbol":"min","kind":"constant","lang":"typescript","code":"const min = int(c, 0, 3);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":63,"symbol":"lo","kind":"constant","lang":"typescript","code":"const lo = int(c, -5, 0);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":64,"symbol":"hi","kind":"constant","lang":"typescript","code":"const hi = int(c, 1, 5);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":82,"symbol":"lit","kind":"constant","lang":"typescript","code":"const lit = pick(c, [\"a\", 1, true] as const);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":100,"symbol":"id","kind":"constant","lang":"typescript","code":"const id = c.nextCallback++;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":113,"symbol":"id","kind":"constant","lang":"typescript","code":"const id = c.nextCallback++;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":128,"symbol":"wrap","kind":"function","lang":"typescript","code":"function wrap(c: Ctx, inner: Gen): Gen {\n switch (int(c, 0, 4)) {\n case 0:\n return {\n ...inner,\n schema: inner.schema.optional(),\n desc: `${inner.desc}.optional`,\n valid: () => (c.rand() < 0.3 ? undefined : inner.valid()),\n island: false,\n };\n case 1:\n return {\n ...inner,\n schema: inner.schema.nullable(),\n desc: `${inner.desc}.nullable`,\n valid: () => (c.rand() < 0.3 ? null : inner.valid()),\n island: false,\n };\n case 2: {\n const dflt = inner.valid();\n return {\n ...inner,\n schema: inner.schema.default(dflt as never),\n desc: `${inner.desc}.default`,\n valid: () => (c.rand() < 0.3 ? undefined : inner.valid()),\n island: false,\n };\n }\n case 3:\n return { ...inner, schema: inner.schema.readonly(), desc: `${inner.desc}.readonly`, island: false };\n default:\n return {\n ...inner,\n schema: inner.schema.optional().nonoptional(),\n desc: `${inner.desc}.optional.nonoptional`,\n corrupt: (v) => (c.rand() < 0.5 ? undefined : inner.corrupt(v)),\n island: false,\n };\n }\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":147,"symbol":"dflt","kind":"constant","lang":"typescript","code":"const dflt = inner.valid();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":169,"symbol":"container","kind":"function","lang":"typescript","code":"function container(c: Ctx, depth: number): Gen {\n const child = () => gen(c, depth - 1);\n switch (int(c, 0, 8)) {\n case 0:\n case 1: {\n const n = int(c, 1, 4);\n const entries = Array.from({ length: n }, (_, i) => [`k${i}`, child(), c.rand() < 0.3] as const);\n const shape = Object.fromEntries(entries.map(([k, g, opt]) => [k, opt ? g.schema.optional() : g.schema]));\n const mode = pick(c, [\"plain\", \"strict\", \"loose\", \"catchall\"] as const);\n const schema =\n mode === \"strict\"\n ? z.strictObject(shape)\n : mode === \"loose\"\n ? z.looseObject(shape)\n : mode === \"catchall\"\n ? z.object(shape).catchall(z.number())\n : z.object(shape);\n const valid = () => {\n const o: Record<string, unknown> = {};\n for (const [k, g, opt] of entries) if (!opt || c.rand() < 0.6) o[k] = g.valid();\n if (mode === \"catchall\" && c.rand() < 0.5) o.extra = 1;\n return o;\n };\n return {\n schema,\n desc: `${mode}{${entries.map(([k, g, opt]) => `${k}${opt ? \"?\" : \"\"}:${g.desc}`).join(\",\")}}`,\n valid,\n corrupt: (v) => {\n if (typeof v !== \"object\" |"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":170,"symbol":"child","kind":"constant","lang":"typescript","code":"const child = () => gen(c, depth - 1);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":174,"symbol":"n","kind":"constant","lang":"typescript","code":"const n = int(c, 1, 4);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":175,"symbol":"entries","kind":"constant","lang":"typescript","code":"const entries = Array.from({ length: n }, (_, i) => [`k${i}`, child(), c.rand() < 0.3] as const);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":176,"symbol":"shape","kind":"constant","lang":"typescript","code":"const shape = Object.fromEntries(entries.map(([k, g, opt]) => [k, opt ? g.schema.optional() : g.schema]));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":177,"symbol":"mode","kind":"constant","lang":"typescript","code":"const mode = pick(c, [\"plain\", \"strict\", \"loose\", \"catchall\"] as const);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":178,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema =\n mode === \"strict\"\n ? z.strictObject(shape)\n : mode === \"loose\"\n ? z.looseObject(shape)\n : mode === \"catchall\"\n ? z.object(shape).catchall(z.number())\n : z.object(shape);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":186,"symbol":"valid","kind":"constant","lang":"typescript","code":"const valid = () => {\n const o: Record<string, unknown> = {};\n for (const [k, g, opt] of entries) if (!opt || c.rand() < 0.6) o[k] = g.valid();\n if (mode === \"catchall\" && c.rand() < 0.5) o.extra = 1;\n return o;\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":187,"symbol":"o","kind":"constant","lang":"typescript","code":"const o: Record<string, unknown> = {};"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":198,"symbol":"o","kind":"constant","lang":"typescript","code":"const o = { ...(v as Record<string, unknown>) };"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":220,"symbol":"g","kind":"constant","lang":"typescript","code":"const g = child();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":221,"symbol":"min","kind":"constant","lang":"typescript","code":"const min = int(c, 0, 2);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":228,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = [...v];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":238,"symbol":"items","kind":"constant","lang":"typescript","code":"const items = Array.from({ length: int(c, 1, 3) }, child);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":239,"symbol":"rest","kind":"constant","lang":"typescript","code":"const rest = c.rand() < 0.4 ? child() : null;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":240,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = rest\n ? z.tuple(items.map((g) => g.schema) as [z.ZodType, ...z.ZodType[]], rest.schema)\n : z.tuple(items.map((g) => g.schema) as [z.ZodType, ...z.ZodType[]]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":252,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = [...v];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":253,"symbol":"i","kind":"constant","lang":"typescript","code":"const i = int(c, 0, items.length - 1);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":263,"symbol":"g","kind":"constant","lang":"typescript","code":"const g = child();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":264,"symbol":"enumKeys","kind":"constant","lang":"typescript","code":"const enumKeys = c.rand() < 0.4;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":265,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = enumKeys ? z.record(z.enum([\"a\", \"b\"]), g.schema) : z.record(z.string(), g.schema);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":275,"symbol":"o","kind":"constant","lang":"typescript","code":"const o = { ...(v as Record<string, unknown>) };"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":276,"symbol":"keys","kind":"constant","lang":"typescript","code":"const keys = Object.keys(o);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":286,"symbol":"options","kind":"constant","lang":"typescript","code":"const options = Array.from({ length: int(c, 2, 3) }, child);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":296,"symbol":"branches","kind":"constant","lang":"typescript","code":"const branches = Array.from({ length: int(c, 2, 3) }, (_, i) => [i, child()] as const);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":312,"symbol":"o","kind":"constant","lang":"typescript","code":"const o = { ...(v as { t: string; v: unknown }) };"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":313,"symbol":"branch","kind":"constant","lang":"typescript","code":"const branch = branches.find(([i]) => `b${i}` === o.t);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":322,"symbol":"min","kind":"constant","lang":"typescript","code":"const min = int(c, 1, 3);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":333,"symbol":"g","kind":"constant","lang":"typescript","doc":"map and set: the compiled result still has to agree","code":"const g = child();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":341,"symbol":"m","kind":"constant","lang":"typescript","code":"const m = new Map(v);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":355,"symbol":"s","kind":"constant","lang":"typescript","code":"const s = new Set(v);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":366,"symbol":"gen","kind":"function","lang":"typescript","code":"function gen(c: Ctx, depth: number): Gen {\n if (depth === 0) return leaf(c);\n const r = c.rand();\n if (r < 0.25) return leaf(c);\n if (r < 0.4) return wrap(c, gen(c, depth - 1));\n return container(c, depth);\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":368,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = c.rand();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":374,"symbol":"attempt","kind":"function","lang":"typescript","code":"function attempt<T>(fn: () => T): { value?: T; threw?: string } {\n try {\n return { value: fn() };\n } catch (err) {\n return { threw: (err as Error)?.constructor?.name || \"Error\" };\n }\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":382,"symbol":"describe","kind":"function","lang":"typescript","code":"function describe(value: unknown): string {\n return JSON.stringify(value, (_k, v) =>\n v instanceof Map ? { $map: [...v] } : v instanceof Set ? { $set: [...v] } : v === undefined ? \"$undefined\" : v\n );\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":389,"symbol":"shape","kind":"function","lang":"typescript","doc":"own-key order and undefined-valued-vs-absent keys, which toStrictEqual does not see","code":"function shape(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(shape);\n if (value && typeof value === \"object\" && Object.getPrototypeOf(value) === Object.prototype) {\n return Reflect.ownKeys(value).map((k) => [k, shape((value as Record<PropertyKey, unknown>)[k])]);\n }\n return value;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":397,"symbol":"SEEDS","kind":"constant","lang":"typescript","code":"const SEEDS = 400;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":401,"symbol":"failures","kind":"constant","lang":"typescript","doc":"every failing seed is collected, so one run names all of them","code":"const failures: string[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":412,"symbol":"checkSeed","kind":"function","lang":"typescript","code":"function checkSeed(seed: number): void {\n {\n const c: Ctx = { rand: mulberry32(seed), calls: new Map(), nextCallback: 0 };\n const g = gen(c, 3);\n const compiled = compile(g.schema);\n const inputs = [g.valid(), g.corrupt(g.valid()), g.corrupt(g.corrupt(g.valid())), pick(c, JUNK)];\n for (const input of inputs) {\n const label = `seed ${seed} ${g.desc} input ${describe(input)}`;\n c.calls.clear();\n const a = attempt(() => g.schema.safeParse(input));\n const runtimeCalls = new Map(c.calls);\n c.calls.clear();\n const b = attempt(() => compiled.safeParse(input));\n const compiledCalls = new Map(c.calls);\n expect(b.threw, `${label}: throw`).toBe(a.threw);\n if (a.threw) continue;\n expect(b.value!.success, `${label}: verdict`).toBe(a.value!.success);\n if (a.value!.success) {\n expect(b.value!.data, `${label}: data`).toStrictEqual(a.value!.data);\n expect(shape(b.value!.data), `${label}: key order`).toEqual(shape(a.value!.data));\n } else {\n expect(b.value!.error!.issues, `${label}: issues`).toEqual(a.value!.error!.issues);\n }\n // every callback the interpreter reaches, the compiled schema reac"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":414,"symbol":"c","kind":"constant","lang":"typescript","code":"const c: Ctx = { rand: mulberry32(seed), calls: new Map(), nextCallback: 0 };"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":415,"symbol":"g","kind":"constant","lang":"typescript","code":"const g = gen(c, 3);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":416,"symbol":"compiled","kind":"constant","lang":"typescript","code":"const compiled = compile(g.schema);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":417,"symbol":"inputs","kind":"constant","lang":"typescript","code":"const inputs = [g.valid(), g.corrupt(g.valid()), g.corrupt(g.corrupt(g.valid())), pick(c, JUNK)];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-generative.test.ts","line":419,"symbol":"label","kind":"constant","lang":"typescript","code":"const label = `seed ${seed} ${g.desc} input ${describe(input)}`;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-global.test.ts","line":14,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.compile(z.object({ name: z.string() }));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-global.test.ts","line":19,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ name: z.string(), age: z.number() });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-global.test.ts","line":22,"symbol":"r1","kind":"constant","lang":"typescript","doc":"First parse: shim fires, compiles, replaces self.","code":"const r1 = schema.safeParse({ name: \"ok\", age: 1 });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-global.test.ts","line":26,"symbol":"r2","kind":"constant","lang":"typescript","doc":"Second parse: directly through compiled wrapper.","code":"const r2 = schema.safeParse({ name: \"ok\", age: 2 });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-global.test.ts","line":29,"symbol":"bad","kind":"constant","lang":"typescript","code":"const bad = schema.safeParse({ name: 1, age: \"x\" });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-global.test.ts","line":35,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n a: z.string().refine((v) => {\n refines++;\n return v.length > 1;\n }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-global.test.ts","line":52,"symbol":"compiled","kind":"constant","lang":"typescript","doc":"Explicit z.compile of a shim-managed schema keeps the same contract.","code":"const compiled = z.compile(schema);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-global.test.ts","line":61,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-global.test.ts","line":71,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().refine(async () => true);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-global.test.ts","line":77,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.looseObject({ name: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-global.test.ts","line":81,"symbol":"bag","kind":"constant","lang":"typescript","doc":"Without this the shim leaves no validator behind, validate misses its fast path and answers from the runtime parser instead. Correct, so nothing else in the suite notices, and several times slower.","code":"const bag = schema._zod.bag as { validator?: (input: unknown) => unknown };"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-off-by-default.test.ts","line":7,"symbol":"compileMode","kind":"constant","lang":"typescript","doc":"Global compilation is opt-in through `import \"zod/compile\"`, and that opt-in mutates `globalThis.__zod_globalConfig` — process-global state, not module state. Two things therefore have to hold, and neither is evident from reading the module: importing zod must not install the post-processor, and the compile-mode vitest project must not leak its setup file into the default one. Both projects run this file and each asserts the state it is supposed to be in, so a leak in either direction fails here instead of silently turning the default suite into a second compiled run (or the compiled suite into a second uncompiled one).","code":"const compileMode = (globalThis as any).__zodCompileStats !== undefined;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-off-by-default.test.ts","line":18,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-off-by-default.test.ts","line":20,"symbol":"tagged","kind":"constant","lang":"typescript","doc":"The global shim replaces `_zod.run` at construction time and tags itself with `__originalRun` so a later compile can unwrap past it. An untagged `run` is proof the post-processor never touched this schema.","code":"const tagged = (schema._zod.run as { __originalRun?: unknown }).__originalRun !== undefined;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-stats.test.ts","line":8,"symbol":"CompileStats","kind":"interface","lang":"typescript","code":"interface CompileStats {\n attempts: number;\n successes: number;\n fallbacks: number;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-stats.test.ts","line":15,"symbol":"stats","kind":"constant","lang":"typescript","code":"const stats = (globalThis as any).__zodCompileStats as CompileStats | undefined;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-stats.test.ts","line":18,"symbol":"before","kind":"constant","lang":"typescript","code":"const before = { ...stats };"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile-stats.test.ts","line":21,"symbol":"cases","kind":"constant","lang":"typescript","doc":"Trigger compile via a handful of supported shapes","code":"const cases: Array<[z.ZodType, unknown]> = [\n [z.string(), \"hi\"],\n [z.number(), 1],\n [z.object({ name: z.string() }), { name: \"ok\" }],\n [z.array(z.number()), [1, 2, 3]],\n [z.union([z.string(), z.number()]), \"x\"],\n ];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":15,"symbol":"expectMatch","kind":"function","lang":"typescript","doc":"Differential helper: assert compiled schema matches the original on a value.","code":"function expectMatch(schema: z.ZodType, value: unknown) {\n const compiled = compile(schema);\n const original = schema.safeParse(value);\n const fast = compiled.safeParse(value);\n\n expect(fast.success).toBe(original.success);\n if (original.success && fast.success) {\n expect(fast.data).toEqual(original.data);\n } else if (!original.success && !fast.success) {\n expect(fast.error.issues).toEqual(original.error.issues);\n }\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":16,"symbol":"compiled","kind":"constant","lang":"typescript","code":"const compiled = compile(schema);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":17,"symbol":"original","kind":"constant","lang":"typescript","code":"const original = schema.safeParse(value);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":18,"symbol":"fast","kind":"constant","lang":"typescript","code":"const fast = compiled.safeParse(value);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":29,"symbol":"valid","kind":"function","lang":"typescript","doc":"Parse and assert success; return the parsed data for further assertions.","code":"function valid<T extends z.ZodType>(schema: T, value: unknown): z.output<T> {\n const result = schema.safeParse(value);\n if (!result.success) {\n throw new Error(`expected success, got issues: ${JSON.stringify(result.error.issues)}`);\n }\n return result.data;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":30,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(value);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":38,"symbol":"invalid","kind":"function","lang":"typescript","doc":"Parse and assert failure.","code":"function invalid(schema: z.ZodType, value: unknown) {\n const result = schema.safeParse(value);\n expect(result.success).toBe(false);\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":39,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(value);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":46,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.string());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":55,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.number());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":67,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.boolean());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":75,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.bigint());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":83,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.symbol());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":84,"symbol":"sym","kind":"constant","lang":"typescript","code":"const sym = Symbol();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":86,"symbol":"namedSym","kind":"constant","lang":"typescript","code":"const namedSym = Symbol.for(\"test\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":92,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.undefined());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":99,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.null());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":106,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.void());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":113,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.nan());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":122,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.date());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":123,"symbol":"d1","kind":"constant","lang":"typescript","code":"const d1 = new Date();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":125,"symbol":"d2","kind":"constant","lang":"typescript","code":"const d2 = new Date(0);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":135,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.any());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":143,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.unknown());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":150,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.never());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":159,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.literal(\"hello\"));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":166,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.literal(42));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":173,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.literal(true));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":179,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.literal(null));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":185,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.literal(100n));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":194,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.enum([\"a\", \"b\", \"c\"]));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":206,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.readonly(z.string()));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":212,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.string().default(\"hello\"));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":219,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.string().trim().prefault(\" hello \"));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":226,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.string().optional().nonoptional());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":234,"symbol":"caught","kind":"constant","lang":"typescript","doc":"An inner catch turns a *defined* input into undefined, which must still be rejected; an inner default turns an absent input into a value, which must be accepted. Testing the input alone got both backwards.","code":"const caught = z\n .string()\n .min(2)\n .max(8)\n .prefault(\"abc\")\n .catch(undefined as any)\n .optional()\n .nonoptional();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":256,"symbol":"prop","kind":"constant","lang":"typescript","doc":"The runtime separates an absent key from an explicit undefined here: absent fails, explicit undefined takes the default. The fast path has to as well.","code":"const prop = z\n .literal(\"lit\")\n .default(\"other\" as any)\n .optional()\n .nonoptional();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":261,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ k1: prop });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":269,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.success(z.string()));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":280,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.optional(z.string()));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":288,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.nullable(z.string()));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":298,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.array(z.string()));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":307,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.array(z.object({ id: z.number() })));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":316,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.object({ name: z.string(), age: z.number() }));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":326,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(\n z.object({\n user: z.object({\n name: z.string(),\n address: z.object({\n city: z.string(),\n }),\n }),\n })\n );"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":343,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.object({ name: z.string(), age: z.optional(z.number()) }));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":351,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases = [\n z.object({ value: z.undefined() }),\n z.object({ value: z.union([z.string(), z.undefined()]) }),\n z.object({ value: z.any() }),\n z.object({ value: z.unknown() }),\n ];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":359,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(schema);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":366,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.strictObject({ name: z.string() }));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":373,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.strictObject({ name: z.string(), age: z.optional(z.number()) }));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":380,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.looseObject({ name: z.string() }));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":387,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.object({ name: z.string() }).catchall(z.number()));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":415,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.strictObject({\n id: z.number(),\n name: z.string(),\n tags: z.array(z.string()),\n nested: z.object({\n active: z.boolean(),\n }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":432,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.number().min(0).max(100));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":441,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.number().gt(0).lt(100));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":450,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.number().int());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":457,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.number().multipleOf(5));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":465,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.string().min(3).max(10));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":473,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.string().length(5));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/compile.test.ts","line":480,"symbol":"aot","kind":"constant","lang":"typescript","code":"const aot = compile(z.string().regex(/^[a-z]+$/));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/email-regex.test.ts","line":6,"symbol":"legacy","kind":"constant","lang":"typescript","doc":"the lookahead form `regexes.email` had before this rewrite","code":"const legacy = /^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/email-regex.test.ts","line":8,"symbol":"table","kind":"constant","lang":"typescript","code":"const table: [string, boolean][] = [\n [\"a@b.cc\", true],\n [\"first.last@example.com\", true],\n [\"a.b.c.d@b.cc\", true],\n [\"'a@b.cc\", true],\n [\"a'b@b.cc\", true],\n [\"a+b@b.cc\", true],\n [\"a-@b.cc\", true],\n [\"a_@b.cc\", true],\n [\"a@0b.cc\", true],\n [\"a@b.c.dd\", true],\n [\"a@b-.cc\", true],\n [\".a@b.cc\", false],\n [\"a.@b.cc\", false],\n [\"a..b@b.cc\", false],\n [\"....@b.cc\", false],\n [\"a@b..cc\", false],\n [\"a@.b.cc\", false],\n [\"a@b.cc.\", false],\n [\"a'@b.cc\", false],\n [\"'@b.cc\", false],\n [\"@b.cc\", false],\n [\"a@b.c\", false],\n [\"a@b.c0\", false],\n [\"a@-b.cc\", false],\n [\"a@b.cc@d.ee\", false],\n [\"a b@b.cc\", false],\n [\"café@b.cc\", false],\n [\"😀@b.cc\", false],\n [\"a\\0@b.cc\", false],\n // `$` is not multiline, so no trailing terminator is tolerated\n [\"a@b.cc\\n\", false],\n [\"a@b.cc\\r\", false],\n [\"\\na@b.cc\", false],\n];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/email-regex.test.ts","line":52,"symbol":"classes","kind":"constant","lang":"typescript","doc":"one representative per character class the two grammars can tell apart","code":"const classes = [\"a\", \"0\", \"_\", \"'\", \"-\", \".\", \"@\", \"!\", \"\\n\"];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/email-regex.test.ts","line":55,"symbol":"idx","kind":"constant","lang":"typescript","code":"const idx: number[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/email-regex.test.ts","line":63,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = legacy.test(s);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/email-regex.test.ts","line":75,"symbol":"rng","kind":"function","lang":"typescript","code":"function rng(seed: number) {\n let s = seed >>> 0;\n return () => {\n s = (s + 0x6d2b79f5) >>> 0;\n let t = s;\n t = Math.imul(t ^ (t >>> 15), t | 1);\n t ^= t + Math.imul(t ^ (t >>> 7), t | 61);\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/email-regex.test.ts","line":86,"symbol":"local","kind":"constant","lang":"typescript","code":"const local = \"abZ09_'+-.\".split(\"\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/email-regex.test.ts","line":87,"symbol":"domain","kind":"constant","lang":"typescript","code":"const domain = \"abZ09-.\".split(\"\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/email-regex.test.ts","line":88,"symbol":"hostile","kind":"constant","lang":"typescript","code":"const hostile = [\"@\", \".\", \"..\", \"...\", \"\\n\", \"\\r\", \"\\0\", \"\\t\", \" \", '\"', \"é\", \"😀\", \"\\\\\", \"<\", \";\", \"/\", \"{\"];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/email-regex.test.ts","line":89,"symbol":"any","kind":"constant","lang":"typescript","code":"const any = [...local, ...domain, ...hostile];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/email-regex.test.ts","line":91,"symbol":"fuzz","kind":"function","lang":"typescript","code":"function fuzz(r: () => number): string {\n const pick = <T>(xs: T[]): T => xs[Math.floor(r() * xs.length)]!;\n const run = (xs: string[], max: number) => {\n let out = \"\";\n for (let i = Math.floor(r() * max); i > 0; i--) out += pick(xs);\n return out;\n };\n switch (Math.floor(r() * 8)) {\n case 0:\n return run(any, 40);\n case 1:\n return `${run(local, 24)}@${run(domain, 24)}`;\n case 2:\n return `${run(local, 8)}${\".\".repeat(1 + Math.floor(r() * 6))}${run(local, 8)}@${run(domain, 12)}`;\n case 3:\n return `${run(local, 8)}@${run(domain, 8)}${\".\".repeat(1 + Math.floor(r() * 6))}${run(domain, 8)}`;\n case 4: {\n // single-character mutation of a valid address\n const base = `${run(\"abZ09_'+-\".split(\"\"), 10)}@example.com`;\n const i = Math.floor(r() * base.length);\n return Math.floor(r() * 3) === 0\n ? base.slice(0, i) + pick(any) + base.slice(i)\n : base.slice(0, i) + (Math.floor(r() * 2) ? pick(any) : \"\") + base.slice(i + 1);\n }\n case 5:\n return (\n \"a\".repeat(1 + Math.floor(r() * 60)) +\n \".\".repeat(Math.floor(r() * 4)) +\n run(local, 4) +\n (r() < 0.5 ? \"@\" : \"\") +\n run(domain"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/email-regex.test.ts","line":92,"symbol":"pick","kind":"constant","lang":"typescript","code":"const pick = <T>(xs: T[]): T => xs[Math.floor(r() * xs.length)]!;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/email-regex.test.ts","line":93,"symbol":"run","kind":"constant","lang":"typescript","code":"const run = (xs: string[], max: number) => {\n let out = \"\";\n for (let i = Math.floor(r() * max); i > 0; i--) out += pick(xs);\n return out;\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/email-regex.test.ts","line":109,"symbol":"base","kind":"constant","lang":"typescript","doc":"single-character mutation of a valid address","code":"const base = `${run(\"abZ09_'+-\".split(\"\"), 10)}@example.com`;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/email-regex.test.ts","line":110,"symbol":"i","kind":"constant","lang":"typescript","code":"const i = Math.floor(r() * base.length);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/email-regex.test.ts","line":131,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = rng(0x5eed);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/email-regex.test.ts","line":134,"symbol":"s","kind":"constant","lang":"typescript","code":"const s = fuzz(r);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/email-regex.test.ts","line":135,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = legacy.test(s);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/extend.test.ts","line":5,"symbol":"schema1","kind":"constant","lang":"typescript","code":"const schema1 = z.object({\n email: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/extend.test.ts","line":9,"symbol":"schema2","kind":"constant","lang":"typescript","code":"const schema2 = schema1.safeExtend({\n email: schema1.shape.email.check(z.email()),\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/extend.test.ts","line":13,"symbol":"schema3","kind":"constant","lang":"typescript","code":"const schema3 = schema2.safeExtend({\n email: schema2.shape.email.or(z.literal(\"\")),\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/extend.test.ts","line":21,"symbol":"baseSchema","kind":"constant","lang":"typescript","code":"const baseSchema = z.object({\n name: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/extend.test.ts","line":25,"symbol":"extendedSchema","kind":"constant","lang":"typescript","code":"const extendedSchema = baseSchema.extend({\n constructor: z.string(),\n age: z.number(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/extend.test.ts","line":30,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = extendedSchema.parse({\n name: \"John\",\n constructor: \"Person\",\n age: 30,\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/extend.test.ts","line":42,"symbol":"testCases","kind":"constant","lang":"typescript","code":"const testCases = [\n { name: \"Test\", constructor: 123, age: 25 },\n { name: \"Test\", constructor: null, age: 25 },\n { name: \"Test\", constructor: true, age: 25 },\n { name: \"Test\", constructor: {}, age: 25 },\n ];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/extend.test.ts","line":50,"symbol":"anyConstructorSchema","kind":"constant","lang":"typescript","code":"const anyConstructorSchema = baseSchema.extend({\n constructor: z.any(),\n age: z.number(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/extend.test.ts","line":56,"symbol":"parsed","kind":"constant","lang":"typescript","code":"const parsed = anyConstructorSchema.parse(testCase);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/index.test.ts","line":23,"symbol":"testTuple","kind":"constant","lang":"typescript","code":"const testTuple = z\n .tuple([z.string().refine(async () => true), z.number().refine(async () => true)])\n .refine(async () => true);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/index.test.ts","line":28,"symbol":"val","kind":"constant","lang":"typescript","code":"const val = await testTuple.parseAsync([\"asdf\", 1234]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/index.test.ts","line":31,"symbol":"r1","kind":"constant","lang":"typescript","code":"const r1 = await testTuple.safeParseAsync([\"asdf\", \"asdf\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/be.test.ts","line":5,"symbol":"localeError","kind":"constant","lang":"typescript","code":"const localeError = be().localeError;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/be.test.ts","line":12,"symbol":"error","kind":"constant","lang":"typescript","code":"const error = localeError({\n code: \"too_small\",\n minimum: count,\n type: \"number\",\n inclusive: true,\n path: [],\n origin: type,\n input: count - 1,\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/be.test.ts","line":28,"symbol":"error","kind":"constant","lang":"typescript","code":"const error = localeError({\n code: \"too_small\",\n minimum: -2,\n type: \"number\",\n inclusive: true,\n path: [],\n origin: \"array\",\n input: -3,\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/be.test.ts","line":41,"symbol":"error","kind":"constant","lang":"typescript","code":"const error = localeError({\n code: \"too_small\",\n minimum: 0,\n type: \"number\",\n inclusive: true,\n path: [],\n origin: \"array\",\n input: -1,\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/be.test.ts","line":54,"symbol":"error","kind":"constant","lang":"typescript","code":"const error = localeError({\n code: \"too_small\",\n minimum: BigInt(21),\n type: \"number\",\n inclusive: true,\n path: [],\n origin: \"array\",\n input: BigInt(20),\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/be.test.ts","line":68,"symbol":"TEST_CASES","kind":"constant","lang":"typescript","code":"const TEST_CASES = [\n {\n type: \"array\",\n cases: [\n { count: 1, expected: \"1 элемент\" },\n { count: 2, expected: \"2 элементы\" },\n { count: 5, expected: \"5 элементаў\" },\n { count: 11, expected: \"11 элементаў\" },\n { count: 21, expected: \"21 элемент\" },\n { count: 22, expected: \"22 элементы\" },\n { count: 25, expected: \"25 элементаў\" },\n { count: 101, expected: \"101 элемент\" },\n { count: 111, expected: \"111 элементаў\" },\n ],\n },\n {\n type: \"set\",\n cases: [\n { count: 1, expected: \"1 элемент\" },\n { count: 2, expected: \"2 элементы\" },\n { count: 5, expected: \"5 элементаў\" },\n { count: 11, expected: \"11 элементаў\" },\n { count: 21, expected: \"21 элемент\" },\n { count: 22, expected: \"22 элементы\" },\n { count: 25, expected: \"25 элементаў\" },\n { count: 101, expected: \"101 элемент\" },\n { count: 111, expected: \"111 элементаў\" },\n ],\n },\n {\n type: \"string\",\n cases: [\n { count: 1, expected: \"1 сімвал\" },\n { count: 2, expected: \"2 сімвалы\" },\n { count: 5, expected: \"5 сімвалаў\" },\n { count: 11, expected: \"11 сімвалаў\" },\n { count: 21, expected: \"21 сімвал\" },\n "} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":9,"symbol":"stringSchema","kind":"constant","lang":"typescript","doc":"Test string type translation","code":"const stringSchema = z.string().min(5);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":10,"symbol":"stringResult","kind":"constant","lang":"typescript","code":"const stringResult = stringSchema.safeParse(\"abc\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":17,"symbol":"numberSchema","kind":"constant","lang":"typescript","doc":"Test number type translation","code":"const numberSchema = z.number().min(10);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":18,"symbol":"numberResult","kind":"constant","lang":"typescript","code":"const numberResult = numberSchema.safeParse(5);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":25,"symbol":"arraySchema","kind":"constant","lang":"typescript","doc":"Test array type translation","code":"const arraySchema = z.array(z.string()).min(3);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":26,"symbol":"arrayResult","kind":"constant","lang":"typescript","code":"const arrayResult = arraySchema.safeParse([\"a\", \"b\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":33,"symbol":"setSchema","kind":"constant","lang":"typescript","doc":"Test set type translation","code":"const setSchema = z.set(z.string()).min(2);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":34,"symbol":"setResult","kind":"constant","lang":"typescript","code":"const setResult = setSchema.safeParse(new Set([\"a\"]));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":45,"symbol":"stringSchema","kind":"constant","lang":"typescript","doc":"Test string type translation","code":"const stringSchema = z.string().max(3);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":46,"symbol":"stringResult","kind":"constant","lang":"typescript","code":"const stringResult = stringSchema.safeParse(\"abcde\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":53,"symbol":"numberSchema","kind":"constant","lang":"typescript","doc":"Test number type translation","code":"const numberSchema = z.number().max(10);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":54,"symbol":"numberResult","kind":"constant","lang":"typescript","code":"const numberResult = numberSchema.safeParse(15);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":61,"symbol":"arraySchema","kind":"constant","lang":"typescript","doc":"Test array type translation","code":"const arraySchema = z.array(z.string()).max(2);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":62,"symbol":"arrayResult","kind":"constant","lang":"typescript","code":"const arrayResult = arraySchema.safeParse([\"a\", \"b\", \"c\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":73,"symbol":"stringSchema","kind":"constant","lang":"typescript","doc":"Test string expected, number received","code":"const stringSchema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":74,"symbol":"stringResult","kind":"constant","lang":"typescript","code":"const stringResult = stringSchema.safeParse(123);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":81,"symbol":"numberSchema","kind":"constant","lang":"typescript","doc":"Test number expected, string received","code":"const numberSchema = z.number();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":82,"symbol":"numberResult","kind":"constant","lang":"typescript","code":"const numberResult = numberSchema.safeParse(\"abc\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":89,"symbol":"booleanSchema","kind":"constant","lang":"typescript","doc":"Test boolean expected, null received","code":"const booleanSchema = z.boolean();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":90,"symbol":"booleanResult","kind":"constant","lang":"typescript","code":"const booleanResult = booleanSchema.safeParse(null);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":97,"symbol":"arraySchema","kind":"constant","lang":"typescript","doc":"Test array expected, object received","code":"const arraySchema = z.array(z.string());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":98,"symbol":"arrayResult","kind":"constant","lang":"typescript","code":"const arrayResult = arraySchema.safeParse({});"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":109,"symbol":"mapSchema","kind":"constant","lang":"typescript","doc":"Test invalid_element with map (only \"map\" | \"set\" produce invalid_element)","code":"const mapSchema = z.map(z.bigint(), z.number());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":110,"symbol":"mapResult","kind":"constant","lang":"typescript","code":"const mapResult = mapSchema.safeParse(new Map([[BigInt(123), BigInt(123)]]));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":118,"symbol":"recordSchema","kind":"constant","lang":"typescript","doc":"Test invalid_key with record (only \"map\" | \"record\" produce invalid_key)","code":"const recordSchema = z.record(z.number(), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":119,"symbol":"recordResult","kind":"constant","lang":"typescript","code":"const recordResult = recordSchema.safeParse({ notANumber: \"value\" });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":127,"symbol":"enumSchema","kind":"constant","lang":"typescript","doc":"Test invalid_value with enum","code":"const enumSchema = z.enum([\"a\", \"b\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":128,"symbol":"enumResult","kind":"constant","lang":"typescript","code":"const enumResult = enumSchema.safeParse(\"c\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":135,"symbol":"multipleSchema","kind":"constant","lang":"typescript","doc":"Test not_multiple_of","code":"const multipleSchema = z.number().multipleOf(3);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":136,"symbol":"multipleResult","kind":"constant","lang":"typescript","code":"const multipleResult = multipleSchema.safeParse(10);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":143,"symbol":"strictSchema","kind":"constant","lang":"typescript","doc":"Test unrecognized_keys (single key)","code":"const strictSchema = z.object({ a: z.string() }).strict();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":144,"symbol":"strictResult","kind":"constant","lang":"typescript","code":"const strictResult = strictSchema.safeParse({ a: \"test\", b: \"extra\" });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":151,"symbol":"strictMultipleResult","kind":"constant","lang":"typescript","doc":"Test unrecognized_keys (multiple keys)","code":"const strictMultipleResult = strictSchema.safeParse({\n a: \"test\",\n b: \"extra\",\n c: \"another\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":162,"symbol":"unionSchema","kind":"constant","lang":"typescript","doc":"Test invalid_union","code":"const unionSchema = z.union([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":163,"symbol":"unionResult","kind":"constant","lang":"typescript","code":"const unionResult = unionSchema.safeParse(true);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":170,"symbol":"regexSchema","kind":"constant","lang":"typescript","doc":"Test invalid_format with regex","code":"const regexSchema = z.string().regex(/^[a-z]+$/);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":171,"symbol":"regexResult","kind":"constant","lang":"typescript","code":"const regexResult = regexSchema.safeParse(\"ABC123\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":180,"symbol":"startsWithSchema","kind":"constant","lang":"typescript","doc":"Test invalid_format with startsWith","code":"const startsWithSchema = z.string().startsWith(\"hello\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":181,"symbol":"startsWithResult","kind":"constant","lang":"typescript","code":"const startsWithResult = startsWithSchema.safeParse(\"world\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":188,"symbol":"endsWithSchema","kind":"constant","lang":"typescript","doc":"Test invalid_format with endsWith","code":"const endsWithSchema = z.string().endsWith(\"world\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":189,"symbol":"endsWithResult","kind":"constant","lang":"typescript","code":"const endsWithResult = endsWithSchema.safeParse(\"hello\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":196,"symbol":"includesSchema","kind":"constant","lang":"typescript","doc":"Test invalid_format with includes","code":"const includesSchema = z.string().includes(\"test\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":197,"symbol":"includesResult","kind":"constant","lang":"typescript","code":"const includesResult = includesSchema.safeParse(\"hello\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":208,"symbol":"dateSchema","kind":"constant","lang":"typescript","doc":"When `expected` starts with a capital letter, render an `instanceof` message, matching the convention used by most other locales (de, es, fr, it, etc.).","code":"const dateSchema = z.instanceof(Date);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/el.test.ts","line":209,"symbol":"dateResult","kind":"constant","lang":"typescript","code":"const dateResult = dateSchema.safeParse(\"not a date\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/en.test.ts","line":17,"symbol":"nullPrototype","kind":"constant","lang":"typescript","code":"const nullPrototype = Object.create(null);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/en.test.ts","line":20,"symbol":"doubleNullPrototype","kind":"constant","lang":"typescript","code":"const doubleNullPrototype = Object.create(Object.create(null));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":9,"symbol":"stringSchema","kind":"constant","lang":"typescript","doc":"Test string type translation","code":"const stringSchema = z.string().min(5);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":10,"symbol":"stringResult","kind":"constant","lang":"typescript","code":"const stringResult = stringSchema.safeParse(\"abc\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":19,"symbol":"numberSchema","kind":"constant","lang":"typescript","doc":"Test number type translation","code":"const numberSchema = z.number().min(10);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":20,"symbol":"numberResult","kind":"constant","lang":"typescript","code":"const numberResult = numberSchema.safeParse(5);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":27,"symbol":"arraySchema","kind":"constant","lang":"typescript","doc":"Test array type translation","code":"const arraySchema = z.array(z.string()).min(3);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":28,"symbol":"arrayResult","kind":"constant","lang":"typescript","code":"const arrayResult = arraySchema.safeParse([\"a\", \"b\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":37,"symbol":"setSchema","kind":"constant","lang":"typescript","doc":"Test set type translation","code":"const setSchema = z.set(z.string()).min(2);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":38,"symbol":"setResult","kind":"constant","lang":"typescript","code":"const setResult = setSchema.safeParse(new Set([\"a\"]));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":49,"symbol":"stringSchema","kind":"constant","lang":"typescript","doc":"Test string type translation","code":"const stringSchema = z.string().max(3);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":50,"symbol":"stringResult","kind":"constant","lang":"typescript","code":"const stringResult = stringSchema.safeParse(\"abcde\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":57,"symbol":"numberSchema","kind":"constant","lang":"typescript","doc":"Test number type translation","code":"const numberSchema = z.number().max(10);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":58,"symbol":"numberResult","kind":"constant","lang":"typescript","code":"const numberResult = numberSchema.safeParse(15);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":65,"symbol":"arraySchema","kind":"constant","lang":"typescript","doc":"Test array type translation","code":"const arraySchema = z.array(z.string()).max(2);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":66,"symbol":"arrayResult","kind":"constant","lang":"typescript","code":"const arrayResult = arraySchema.safeParse([\"a\", \"b\", \"c\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":77,"symbol":"stringSchema","kind":"constant","lang":"typescript","doc":"Test string expected, number received","code":"const stringSchema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":78,"symbol":"stringResult","kind":"constant","lang":"typescript","code":"const stringResult = stringSchema.safeParse(123);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":85,"symbol":"numberSchema","kind":"constant","lang":"typescript","doc":"Test number expected, string received","code":"const numberSchema = z.number();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":86,"symbol":"numberResult","kind":"constant","lang":"typescript","code":"const numberResult = numberSchema.safeParse(\"abc\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":93,"symbol":"booleanSchema","kind":"constant","lang":"typescript","doc":"Test boolean expected, null received","code":"const booleanSchema = z.boolean();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":94,"symbol":"booleanResult","kind":"constant","lang":"typescript","code":"const booleanResult = booleanSchema.safeParse(null);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":101,"symbol":"arraySchema","kind":"constant","lang":"typescript","doc":"Test array expected, object received","code":"const arraySchema = z.array(z.string());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":102,"symbol":"arrayResult","kind":"constant","lang":"typescript","code":"const arrayResult = arraySchema.safeParse({});"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":113,"symbol":"dateSchema","kind":"constant","lang":"typescript","doc":"Test with a type that's not in the TypeNames dictionary. This will test the fallback behavior","code":"const dateSchema = z.date().min(new Date(\"2025-01-01\"));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":114,"symbol":"dateResult","kind":"constant","lang":"typescript","code":"const dateResult = dateSchema.safeParse(new Date(\"2024-01-01\"));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":126,"symbol":"tupleSchema","kind":"constant","lang":"typescript","doc":"Test invalid_element with tuple","code":"const tupleSchema = z.tuple([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":127,"symbol":"tupleResult","kind":"constant","lang":"typescript","code":"const tupleResult = tupleSchema.safeParse([\"abc\", \"not a number\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":134,"symbol":"enumSchema","kind":"constant","lang":"typescript","doc":"Test invalid_value with enum","code":"const enumSchema = z.enum([\"a\", \"b\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":135,"symbol":"enumResult","kind":"constant","lang":"typescript","code":"const enumResult = enumSchema.safeParse(\"c\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":142,"symbol":"multipleSchema","kind":"constant","lang":"typescript","doc":"Test not_multiple_of","code":"const multipleSchema = z.number().multipleOf(3);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":143,"symbol":"multipleResult","kind":"constant","lang":"typescript","code":"const multipleResult = multipleSchema.safeParse(10);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":150,"symbol":"strictSchema","kind":"constant","lang":"typescript","doc":"Test unrecognized_keys","code":"const strictSchema = z.object({ a: z.string() }).strict();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":151,"symbol":"strictResult","kind":"constant","lang":"typescript","code":"const strictResult = strictSchema.safeParse({ a: \"test\", b: \"extra\" });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":158,"symbol":"unionSchema","kind":"constant","lang":"typescript","doc":"Test invalid_union","code":"const unionSchema = z.union([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":159,"symbol":"unionResult","kind":"constant","lang":"typescript","code":"const unionResult = unionSchema.safeParse(true);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":166,"symbol":"regexSchema","kind":"constant","lang":"typescript","doc":"Test invalid_format with regex","code":"const regexSchema = z.string().regex(/^[a-z]+$/);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":167,"symbol":"regexResult","kind":"constant","lang":"typescript","code":"const regexResult = regexSchema.safeParse(\"ABC123\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":174,"symbol":"startsWithSchema","kind":"constant","lang":"typescript","doc":"Test invalid_format with startsWith","code":"const startsWithSchema = z.string().startsWith(\"hello\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/es.test.ts","line":175,"symbol":"startsWithResult","kind":"constant","lang":"typescript","code":"const startsWithResult = startsWithSchema.safeParse(\"world\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/fr.test.ts","line":8,"symbol":"stringResult","kind":"constant","lang":"typescript","code":"const stringResult = z.string().min(5).safeParse(\"abc\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/fr.test.ts","line":14,"symbol":"numberResult","kind":"constant","lang":"typescript","code":"const numberResult = z.number().min(10).safeParse(5);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/fr.test.ts","line":20,"symbol":"arrayResult","kind":"constant","lang":"typescript","code":"const arrayResult = z.array(z.string()).min(3).safeParse([\"a\", \"b\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/fr.test.ts","line":26,"symbol":"setResult","kind":"constant","lang":"typescript","code":"const setResult = z\n .set(z.string())\n .min(2)\n .safeParse(new Set([\"a\"]));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/fr.test.ts","line":39,"symbol":"stringResult","kind":"constant","lang":"typescript","code":"const stringResult = z.string().max(3).safeParse(\"abcde\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/fr.test.ts","line":45,"symbol":"numberResult","kind":"constant","lang":"typescript","code":"const numberResult = z.number().max(10).safeParse(15);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/fr.test.ts","line":51,"symbol":"arrayResult","kind":"constant","lang":"typescript","code":"const arrayResult = z.array(z.string()).max(2).safeParse([\"a\", \"b\", \"c\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/fr.test.ts","line":61,"symbol":"stringResult","kind":"constant","lang":"typescript","code":"const stringResult = z.string().safeParse(123);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/fr.test.ts","line":67,"symbol":"arrayResult","kind":"constant","lang":"typescript","code":"const arrayResult = z.array(z.string()).safeParse({});"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":12,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().min(3);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":13,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"ab\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":21,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().min(10);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":22,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(5);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":30,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.array(z.string()).min(1);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":31,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse([]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":39,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.set(z.string()).min(2);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":40,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(new Set([\"a\"]));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":50,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().max(3);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":51,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"abcde\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":59,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().max(365);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":60,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(400);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":68,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.array(z.string()).max(2);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":69,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse([\"a\", \"b\", \"c\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":79,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":80,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(123);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":88,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":89,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"abc\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":97,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.boolean();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":98,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(null);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":106,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.array(z.string());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":107,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({});"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":115,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":116,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse([]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":124,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.function();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":125,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"not a function\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":135,"symbol":"feminineTypes","kind":"constant","lang":"typescript","code":"const feminineTypes = [\n { schema: z.string().min(5), input: \"abc\" },\n { schema: z.set(z.string()).min(2), input: new Set([\"a\"]) },\n ];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":141,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(input);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":150,"symbol":"masculineTypes","kind":"constant","lang":"typescript","code":"const masculineTypes = [\n { schema: z.number().min(10), input: 5 },\n { schema: z.array(z.string()).min(2), input: [\"a\"] },\n ];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":156,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(input);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":167,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.enum([\"a\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":168,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"b\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":176,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.enum([\"a\", \"b\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":177,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"c\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":185,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.enum([\"a\", \"b\", \"c\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":186,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"d\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":196,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.number().multipleOf(3);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":197,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(10);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":205,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string() }).strict();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":206,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({ a: \"test\", b: \"extra\" });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":214,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string() }).strict();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":215,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({ a: \"test\", b: \"extra\", c: \"more\" });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":223,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.union([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":224,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(true);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":232,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.number(), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":233,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse({ notANumber: \"value\" });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":243,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().startsWith(\"hello\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":244,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"world\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":252,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().endsWith(\"world\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":253,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"hello\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":261,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().includes(\"test\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":262,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"hello world\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":270,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().regex(/^[a-z]+$/);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":271,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"ABC123\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":281,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().email();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":282,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"not-an-email\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":290,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().url();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":291,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"not-a-url\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":299,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().uuid();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/he.test.ts","line":300,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(\"not-a-uuid\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":9,"symbol":"stringSchema","kind":"constant","lang":"typescript","doc":"Test string type translation","code":"const stringSchema = z.string().min(5);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":10,"symbol":"stringResult","kind":"constant","lang":"typescript","code":"const stringResult = stringSchema.safeParse(\"abc\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":17,"symbol":"numberSchema","kind":"constant","lang":"typescript","doc":"Test number type translation","code":"const numberSchema = z.number().min(10);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":18,"symbol":"numberResult","kind":"constant","lang":"typescript","code":"const numberResult = numberSchema.safeParse(5);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":25,"symbol":"arraySchema","kind":"constant","lang":"typescript","doc":"Test array type translation","code":"const arraySchema = z.array(z.string()).min(3);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":26,"symbol":"arrayResult","kind":"constant","lang":"typescript","code":"const arrayResult = arraySchema.safeParse([\"a\", \"b\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":33,"symbol":"setSchema","kind":"constant","lang":"typescript","doc":"Test set type translation","code":"const setSchema = z.set(z.string()).min(2);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":34,"symbol":"setResult","kind":"constant","lang":"typescript","code":"const setResult = setSchema.safeParse(new Set([\"a\"]));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":45,"symbol":"stringSchema","kind":"constant","lang":"typescript","doc":"Test string type translation","code":"const stringSchema = z.string().max(3);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":46,"symbol":"stringResult","kind":"constant","lang":"typescript","code":"const stringResult = stringSchema.safeParse(\"abcde\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":53,"symbol":"numberSchema","kind":"constant","lang":"typescript","doc":"Test number type translation","code":"const numberSchema = z.number().max(10);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":54,"symbol":"numberResult","kind":"constant","lang":"typescript","code":"const numberResult = numberSchema.safeParse(15);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":61,"symbol":"arraySchema","kind":"constant","lang":"typescript","doc":"Test array type translation","code":"const arraySchema = z.array(z.string()).max(2);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":62,"symbol":"arrayResult","kind":"constant","lang":"typescript","code":"const arrayResult = arraySchema.safeParse([\"a\", \"b\", \"c\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":73,"symbol":"stringSchema","kind":"constant","lang":"typescript","doc":"Test string expected, number received","code":"const stringSchema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":74,"symbol":"stringResult","kind":"constant","lang":"typescript","code":"const stringResult = stringSchema.safeParse(123);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":81,"symbol":"numberSchema","kind":"constant","lang":"typescript","doc":"Test number expected, string received","code":"const numberSchema = z.number();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":82,"symbol":"numberResult","kind":"constant","lang":"typescript","code":"const numberResult = numberSchema.safeParse(\"abc\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":89,"symbol":"booleanSchema","kind":"constant","lang":"typescript","doc":"Test boolean expected, null received","code":"const booleanSchema = z.boolean();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":90,"symbol":"booleanResult","kind":"constant","lang":"typescript","code":"const booleanResult = booleanSchema.safeParse(null);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":97,"symbol":"arraySchema","kind":"constant","lang":"typescript","doc":"Test array expected, object received","code":"const arraySchema = z.array(z.string());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":98,"symbol":"arrayResult","kind":"constant","lang":"typescript","code":"const arrayResult = arraySchema.safeParse({});"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":109,"symbol":"tupleSchema","kind":"constant","lang":"typescript","doc":"Test invalid_element with tuple","code":"const tupleSchema = z.tuple([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":110,"symbol":"tupleResult","kind":"constant","lang":"typescript","code":"const tupleResult = tupleSchema.safeParse([\"abc\", \"not a number\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":117,"symbol":"enumSchema","kind":"constant","lang":"typescript","doc":"Test invalid_value with enum","code":"const enumSchema = z.enum([\"a\", \"b\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":118,"symbol":"enumResult","kind":"constant","lang":"typescript","code":"const enumResult = enumSchema.safeParse(\"c\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":125,"symbol":"multipleSchema","kind":"constant","lang":"typescript","doc":"Test not_multiple_of","code":"const multipleSchema = z.number().multipleOf(3);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":126,"symbol":"multipleResult","kind":"constant","lang":"typescript","code":"const multipleResult = multipleSchema.safeParse(10);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":133,"symbol":"strictSchema","kind":"constant","lang":"typescript","doc":"Test unrecognized_keys","code":"const strictSchema = z.object({ a: z.string() }).strict();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":134,"symbol":"strictResult","kind":"constant","lang":"typescript","code":"const strictResult = strictSchema.safeParse({ a: \"test\", b: \"extra\" });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":141,"symbol":"unionSchema","kind":"constant","lang":"typescript","doc":"Test invalid_union","code":"const unionSchema = z.union([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":142,"symbol":"unionResult","kind":"constant","lang":"typescript","code":"const unionResult = unionSchema.safeParse(true);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":149,"symbol":"regexSchema","kind":"constant","lang":"typescript","doc":"Test invalid_format with regex","code":"const regexSchema = z.string().regex(/^[a-z]+$/);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":150,"symbol":"regexResult","kind":"constant","lang":"typescript","code":"const regexResult = regexSchema.safeParse(\"ABC123\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":157,"symbol":"startsWithSchema","kind":"constant","lang":"typescript","doc":"Test invalid_format with startsWith","code":"const startsWithSchema = z.string().startsWith(\"hello\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/hr.test.ts","line":158,"symbol":"startsWithResult","kind":"constant","lang":"typescript","code":"const startsWithResult = startsWithSchema.safeParse(\"world\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/parity.test.ts","line":10,"symbol":"enSource","kind":"constant","lang":"typescript","code":"const enSource = readFileSync(fileURLToPath(new URL(\"../../../locales/en.ts\", import.meta.url)), \"utf8\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/parity.test.ts","line":12,"symbol":"keysOf","kind":"function","lang":"typescript","code":"function keysOf(block: string): string[] {\n const body = enSource.match(new RegExp(`const ${block}[^=]*= \\\\{([\\\\s\\\\S]*?)\\\\n \\\\};`))?.[1];\n if (!body) throw new Error(`could not read ${block} out of en.ts`);\n return [...body.matchAll(/^\\s{4}([a-z_0-9]+):/gm)].map((m) => m[1]!);\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/parity.test.ts","line":13,"symbol":"body","kind":"constant","lang":"typescript","code":"const body = enSource.match(new RegExp(`const ${block}[^=]*= \\\\{([\\\\s\\\\S]*?)\\\\n \\\\};`))?.[1];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/parity.test.ts","line":18,"symbol":"locales","kind":"constant","lang":"typescript","code":"const locales = z.locales as unknown as Record<string, () => { localeError: z.core.$ZodErrorMap }>;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/parity.test.ts","line":19,"symbol":"names","kind":"constant","lang":"typescript","code":"const names = Object.keys(locales).filter((k) => typeof locales[k] === \"function\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/parity.test.ts","line":20,"symbol":"SENTINEL","kind":"constant","lang":"typescript","code":"const SENTINEL = \"zzsentinelzz\";"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/parity.test.ts","line":23,"symbol":"fallsThrough","kind":"function","lang":"typescript","doc":"True when the locale has no entry for `key`: the message is what the sentinel produces.","code":"function fallsThrough(locale: string, key: string, build: (k: string) => unknown): boolean {\n const map = locales[locale]!().localeError as (iss: unknown) => string | undefined;\n const real = String(map(build(key)) ?? \"\");\n const sentinel = String(map(build(SENTINEL)) ?? \"\");\n return real === sentinel.split(SENTINEL).join(key);\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/parity.test.ts","line":24,"symbol":"map","kind":"constant","lang":"typescript","code":"const map = locales[locale]!().localeError as (iss: unknown) => string | undefined;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/parity.test.ts","line":25,"symbol":"real","kind":"constant","lang":"typescript","code":"const real = String(map(build(key)) ?? \"\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/parity.test.ts","line":26,"symbol":"sentinel","kind":"constant","lang":"typescript","code":"const sentinel = String(map(build(SENTINEL)) ?? \"\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/parity.test.ts","line":30,"symbol":"asFormat","kind":"constant","lang":"typescript","code":"const asFormat = (k: string) => ({ code: \"invalid_format\", format: k, input: \"x\", path: [] });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/parity.test.ts","line":31,"symbol":"asSize","kind":"constant","lang":"typescript","code":"const asSize = (k: string) => ({ code: \"too_small\", origin: k, minimum: 2, inclusive: true, input: null, path: [] });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/parity.test.ts","line":38,"symbol":"required","kind":"constant","lang":"typescript","doc":"A key `en` maps to its own name (emoji, nanoid, cuid, cuid2) renders identically whether or not a locale defines it, so omitting it is not drift.","code":"const required = keys.filter((k) => !fallsThrough(\"en\", k, build));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/parity.test.ts","line":39,"symbol":"gaps","kind":"constant","lang":"typescript","code":"const gaps = required.flatMap((k) => names.filter((n) => fallsThrough(n, k, build)).map((n) => `${n}.${k}`));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/ru.test.ts","line":5,"symbol":"localeError","kind":"constant","lang":"typescript","code":"const localeError = ru().localeError;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/ru.test.ts","line":12,"symbol":"error","kind":"constant","lang":"typescript","code":"const error = localeError({\n code: \"too_small\",\n minimum: count,\n type: \"number\",\n inclusive: true,\n path: [],\n origin: type,\n input: count - 1,\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/ru.test.ts","line":29,"symbol":"error","kind":"constant","lang":"typescript","code":"const error = localeError({\n code: \"too_small\",\n minimum: -2,\n type: \"number\",\n inclusive: true,\n path: [],\n origin: \"array\",\n input: -3,\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/ru.test.ts","line":43,"symbol":"error","kind":"constant","lang":"typescript","code":"const error = localeError({\n code: \"too_small\",\n minimum: 0,\n type: \"number\",\n inclusive: true,\n path: [],\n origin: \"array\",\n input: -1,\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/ru.test.ts","line":57,"symbol":"error","kind":"constant","lang":"typescript","code":"const error = localeError({\n code: \"too_small\",\n minimum: BigInt(21),\n type: \"number\",\n inclusive: true,\n path: [],\n origin: \"array\",\n input: BigInt(20),\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/ru.test.ts","line":72,"symbol":"TEST_CASES","kind":"constant","lang":"typescript","code":"const TEST_CASES = [\n {\n type: \"array\",\n cases: [\n { count: 1, expected: \"1 элемент\" },\n { count: 2, expected: \"2 элемента\" },\n { count: 5, expected: \"5 элементов\" },\n { count: 11, expected: \"11 элементов\" },\n { count: 21, expected: \"21 элемент\" },\n { count: 22, expected: \"22 элемента\" },\n { count: 25, expected: \"25 элементов\" },\n { count: 101, expected: \"101 элемент\" },\n { count: 111, expected: \"111 элементов\" },\n ],\n },\n {\n type: \"set\",\n cases: [\n { count: 1, expected: \"1 элемент\" },\n { count: 2, expected: \"2 элемента\" },\n { count: 5, expected: \"5 элементов\" },\n { count: 11, expected: \"11 элементов\" },\n { count: 21, expected: \"21 элемент\" },\n { count: 22, expected: \"22 элемента\" },\n { count: 25, expected: \"25 элементов\" },\n { count: 101, expected: \"101 элемент\" },\n { count: 111, expected: \"111 элементов\" },\n ],\n },\n {\n type: \"string\",\n cases: [\n { count: 1, expected: \"1 символ\" },\n { count: 2, expected: \"2 символа\" },\n { count: 5, expected: \"5 символов\" },\n { count: 11, expected: \"11 символов\" },\n { count: 21, expected: \"21 символ\" },\n "} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tg.test.ts","line":7,"symbol":"invalidType","kind":"constant","lang":"typescript","code":"const invalidType = z.number().safeParse(\"a\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tg.test.ts","line":11,"symbol":"invalidType2","kind":"constant","lang":"typescript","code":"const invalidType2 = z.string().safeParse(1);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tg.test.ts","line":15,"symbol":"invalidValue","kind":"constant","lang":"typescript","code":"const invalidValue = z.enum([\"a\", \"b\"]).safeParse(1);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tg.test.ts","line":19,"symbol":"tooBig","kind":"constant","lang":"typescript","code":"const tooBig = z.number().max(10).safeParse(15);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tg.test.ts","line":23,"symbol":"tooSmall","kind":"constant","lang":"typescript","code":"const tooSmall = z.number().min(10).safeParse(5);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tg.test.ts","line":28,"symbol":"tooShort","kind":"constant","lang":"typescript","doc":"singular units after numerals in Tajik","code":"const tooShort = z.string().min(5).safeParse(\"hi\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tg.test.ts","line":31,"symbol":"tooFewItems","kind":"constant","lang":"typescript","code":"const tooFewItems = z.array(z.number()).min(2).safeParse([1]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tg.test.ts","line":34,"symbol":"invalidEmail","kind":"constant","lang":"typescript","code":"const invalidEmail = z.string().email().safeParse(\"nope\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tg.test.ts","line":38,"symbol":"invalidStart","kind":"constant","lang":"typescript","code":"const invalidStart = z.string().startsWith(\"ab\").safeParse(\"xy\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tg.test.ts","line":41,"symbol":"invalidRegex","kind":"constant","lang":"typescript","code":"const invalidRegex = z.string().regex(/abcd/).safeParse(\"xy\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tg.test.ts","line":44,"symbol":"notMultipleOf","kind":"constant","lang":"typescript","code":"const notMultipleOf = z.number().multipleOf(5).safeParse(7);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tg.test.ts","line":47,"symbol":"oneUnknownKey","kind":"constant","lang":"typescript","code":"const oneUnknownKey = z.strictObject({ a: z.string() }).safeParse({ a: \"x\", b: 1 });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tg.test.ts","line":50,"symbol":"twoUnknownKeys","kind":"constant","lang":"typescript","code":"const twoUnknownKeys = z.strictObject({ a: z.string() }).safeParse({ a: \"x\", b: 1, c: 2 });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tg.test.ts","line":53,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases: [z.ZodType, unknown, string][] = [\n [z.literal(\"a\"), \"b\", 'Вуруди нодуруст: \"a\" интизор мерафт'],\n [z.boolean(), null, \"Вуруди нодуруст: boolean интизор мерафт, null гирифта шуд\"],\n [z.number(), Number.NaN, \"Вуруди нодуруст: рақам интизор мерафт, NaN гирифта шуд\"],\n [z.number().lt(10), 10, \"Хеле калон: number бояд <10 бошад\"],\n [z.number().gt(10), 10, \"Хеле хурд: number бояд >10 бошад\"],\n [z.string().max(1), \"ab\", \"Хеле калон: string бояд <=1 аломат дошта бошад\"],\n [z.set(z.string()).min(1), new Set(), \"Хеле хурд: set бояд >=1 унсур дошта бошад\"],\n [z.map(z.string(), z.number()).min(1), new Map(), \"Хеле хурд: map бояд >=1 сабт дошта бошад\"],\n [z.file().min(1), new File([], \"empty\"), \"Хеле хурд: file бояд >=1 байт дошта бошад\"],\n [z.string().endsWith(\"ab\"), \"xy\", 'Сатри нодуруст: бояд бо \"ab\" анҷом ёбад'],\n [z.string().includes(\"ab\"), \"xy\", 'Сатри нодуруст: бояд \"ab\"-ро дар бар гирад'],\n [z.stringFormat(\"custom\", () => false), \"xy\", \"custom-и нодуруст\"],\n [z.union([z.string(), z.number()]), null, \"Вуруди нодуруст\"],\n [\n z.discriminatedUnion(\"kind\", [z.object({ kind: z.literal(\"a\") }), z.object({ kind: z.literal(\"b\") })]),\n "} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tk.test.ts","line":18,"symbol":"nullPrototype","kind":"constant","lang":"typescript","code":"const nullPrototype = Object.create(null);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tk.test.ts","line":21,"symbol":"doubleNullPrototype","kind":"constant","lang":"typescript","code":"const doubleNullPrototype = Object.create(Object.create(null));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tk.test.ts","line":30,"symbol":"invalidType","kind":"constant","lang":"typescript","code":"const invalidType = z.number().safeParse(\"a\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tk.test.ts","line":34,"symbol":"invalidType2","kind":"constant","lang":"typescript","code":"const invalidType2 = z.string().safeParse(1);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tk.test.ts","line":38,"symbol":"invalidValue","kind":"constant","lang":"typescript","code":"const invalidValue = z.enum([\"a\", \"b\"]).safeParse(1);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tk.test.ts","line":42,"symbol":"tooBig","kind":"constant","lang":"typescript","code":"const tooBig = z.number().max(10).safeParse(15);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tk.test.ts","line":46,"symbol":"tooSmall","kind":"constant","lang":"typescript","code":"const tooSmall = z.number().min(10).safeParse(5);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tk.test.ts","line":50,"symbol":"invalidFormatRegex","kind":"constant","lang":"typescript","code":"const invalidFormatRegex = z.string().regex(/abcd/).safeParse(\"invalid-string\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tk.test.ts","line":54,"symbol":"invalidFormatStartsWith","kind":"constant","lang":"typescript","code":"const invalidFormatStartsWith = z.string().startsWith(\"abcd\").safeParse(\"invalid-string\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tk.test.ts","line":58,"symbol":"notMultipleOf","kind":"constant","lang":"typescript","code":"const notMultipleOf = z.number().multipleOf(3).safeParse(10);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tk.test.ts","line":62,"symbol":"unrecognizedKeys","kind":"constant","lang":"typescript","code":"const unrecognizedKeys = z.object({ a: z.string(), b: z.number() }).strict().safeParse({ a: \"a\", b: 1, c: 2 });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tk.test.ts","line":66,"symbol":"invalidUnion","kind":"constant","lang":"typescript","code":"const invalidUnion = z.union([z.string(), z.number()]).safeParse(true);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tr.test.ts","line":18,"symbol":"nullPrototype","kind":"constant","lang":"typescript","code":"const nullPrototype = Object.create(null);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tr.test.ts","line":21,"symbol":"doubleNullPrototype","kind":"constant","lang":"typescript","code":"const doubleNullPrototype = Object.create(Object.create(null));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tr.test.ts","line":30,"symbol":"invalidType","kind":"constant","lang":"typescript","code":"const invalidType = z.number().safeParse(\"a\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tr.test.ts","line":34,"symbol":"invalidType2","kind":"constant","lang":"typescript","code":"const invalidType2 = z.string().safeParse(1);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tr.test.ts","line":38,"symbol":"invalidValue","kind":"constant","lang":"typescript","code":"const invalidValue = z.enum([\"a\", \"b\"]).safeParse(1);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tr.test.ts","line":42,"symbol":"tooBig","kind":"constant","lang":"typescript","code":"const tooBig = z.number().max(10).safeParse(15);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tr.test.ts","line":46,"symbol":"tooSmall","kind":"constant","lang":"typescript","code":"const tooSmall = z.number().min(10).safeParse(5);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tr.test.ts","line":50,"symbol":"invalidFormatRegex","kind":"constant","lang":"typescript","code":"const invalidFormatRegex = z.string().regex(/abcd/).safeParse(\"invalid-string\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tr.test.ts","line":54,"symbol":"invalidFormatStartsWith","kind":"constant","lang":"typescript","code":"const invalidFormatStartsWith = z.string().startsWith(\"abcd\").safeParse(\"invalid-string\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tr.test.ts","line":58,"symbol":"notMultipleOf","kind":"constant","lang":"typescript","code":"const notMultipleOf = z.number().multipleOf(3).safeParse(10);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tr.test.ts","line":62,"symbol":"unrecognizedKeys","kind":"constant","lang":"typescript","code":"const unrecognizedKeys = z.object({ a: z.string(), b: z.number() }).strict().safeParse({ a: \"a\", b: 1, c: 2 });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/tr.test.ts","line":66,"symbol":"invalidUnion","kind":"constant","lang":"typescript","code":"const invalidUnion = z.union([z.string(), z.number()]).safeParse(true);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":7,"symbol":"invalidType","kind":"constant","lang":"typescript","code":"const invalidType = z.number().safeParse(\"a\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":11,"symbol":"invalidType2","kind":"constant","lang":"typescript","code":"const invalidType2 = z.string().safeParse(1);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":15,"symbol":"invalidValue","kind":"constant","lang":"typescript","code":"const invalidValue = z.enum([\"a\", \"b\"]).safeParse(1);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":19,"symbol":"tooBig","kind":"constant","lang":"typescript","code":"const tooBig = z.number().max(10).safeParse(15);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":23,"symbol":"tooSmall","kind":"constant","lang":"typescript","code":"const tooSmall = z.number().min(10).safeParse(5);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":27,"symbol":"invalidFormatRegex","kind":"constant","lang":"typescript","code":"const invalidFormatRegex = z.string().regex(/abcd/).safeParse(\"invalid-string\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":31,"symbol":"invalidFormatStartsWith","kind":"constant","lang":"typescript","code":"const invalidFormatStartsWith = z.string().startsWith(\"abcd\").safeParse(\"invalid-string\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":35,"symbol":"notMultipleOf","kind":"constant","lang":"typescript","code":"const notMultipleOf = z.number().multipleOf(3).safeParse(10);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":39,"symbol":"unrecognizedKeys","kind":"constant","lang":"typescript","code":"const unrecognizedKeys = z.object({ a: z.string(), b: z.number() }).strict().safeParse({ a: \"a\", b: 1, c: 2 });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":43,"symbol":"invalidUnion","kind":"constant","lang":"typescript","code":"const invalidUnion = z.union([z.string(), z.number()]).safeParse(true);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":47,"symbol":"tooBigString","kind":"constant","lang":"typescript","code":"const tooBigString = z.string().max(5).safeParse(\"too long string\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":52,"symbol":"tooSmallArray","kind":"constant","lang":"typescript","code":"const tooSmallArray = z.array(z.string()).min(3).safeParse([\"a\", \"b\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":57,"symbol":"invalidFormatEndsWith","kind":"constant","lang":"typescript","code":"const invalidFormatEndsWith = z.string().endsWith(\"xyz\").safeParse(\"invalid-string\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":61,"symbol":"invalidFormatIncludes","kind":"constant","lang":"typescript","code":"const invalidFormatIncludes = z.string().includes(\"test\").safeParse(\"invalid-string\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":65,"symbol":"invalidFormatEmail","kind":"constant","lang":"typescript","code":"const invalidFormatEmail = z.string().email().safeParse(\"invalid-email\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":69,"symbol":"invalidFormatUrl","kind":"constant","lang":"typescript","code":"const invalidFormatUrl = z.string().url().safeParse(\"invalid-url\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":73,"symbol":"unrecognizedKeysMultiple","kind":"constant","lang":"typescript","code":"const unrecognizedKeysMultiple = z\n .object({ a: z.string(), b: z.number() })\n .strict()\n .safeParse({ a: \"a\", b: 1, c: 2, d: 3 });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":80,"symbol":"invalidElement","kind":"constant","lang":"typescript","code":"const invalidElement = z.array(z.string()).safeParse([1, 2, 3]);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":84,"symbol":"tooSmallMap","kind":"constant","lang":"typescript","code":"const tooSmallMap = z\n .map(z.string(), z.string())\n .min(3)\n .safeParse(new Map([[\"a\", \"b\"]]));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/locales/uz.test.ts","line":92,"symbol":"tooBigMap","kind":"constant","lang":"typescript","code":"const tooBigMap = z\n .map(z.string(), z.string())\n .max(2)\n .safeParse(\n new Map([\n [\"a\", \"b\"],\n [\"c\", \"d\"],\n [\"e\", \"f\"],\n ])\n );"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/polyfill-collision.test.ts","line":8,"symbol":"INJECTED","kind":"constant","lang":"typescript","doc":"Browser polyfills for node globals land as raw text in the bundle's top scope — an esbuild `banner`, a scope-unaware injector — so the bundler never sees the collision and the browser is the first thing to read both declarations. zod must therefore declare none of these names at module scope. The JSON Schema pass shipped an `export function process` for three minors before #6397 reported the white screen it caused.","code":"const INJECTED = [\"process\", \"Buffer\", \"global\", \"__dirname\", \"__filename\"];"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/polyfill-collision.test.ts","line":10,"symbol":"here","kind":"constant","lang":"typescript","code":"const here = path.dirname(fileURLToPath(import.meta.url));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/polyfill-collision.test.ts","line":11,"symbol":"CLASSIC","kind":"constant","lang":"typescript","code":"const CLASSIC = path.resolve(here, \"../../../index.ts\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/polyfill-collision.test.ts","line":12,"symbol":"MINI","kind":"constant","lang":"typescript","code":"const MINI = path.resolve(here, \"../../../mini/index.ts\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/polyfill-collision.test.ts","line":14,"symbol":"polyfills","kind":"constant","lang":"typescript","code":"const polyfills = INJECTED.map((name) => `const ${name} = {};`).join(\"\\n\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/polyfill-collision.test.ts","line":17,"symbol":"ENTRY","kind":"constant","lang":"typescript","doc":"toJSONSchema has to be reachable: a bundle that only parses a schema tree-shakes the offending module away and would pass no matter what it declares. `z.core.process` is the pre-rename export name, read as a namespace property so the entry itself declares no `process` binding.","code":"const ENTRY = `import * as z from \"%ENTRY%\";\\nglobalThis.__out = [z.toJSONSchema(z.string()), z.core.process];`;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/polyfill-collision.test.ts","line":25,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await build({\n stdin: { contents: ENTRY.replace(\"%ENTRY%\", entrypoint), loader: \"ts\", resolveDir: here },\n bundle: true,\n format: \"esm\",\n target: \"es2020\",\n write: false,\n logLevel: \"silent\",\n banner: { js: polyfills },\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/polyfill-collision.test.ts","line":34,"symbol":"out","kind":"constant","lang":"typescript","code":"const out = result.outputFiles[0]!.text;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":5,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.string(), z.any());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":9,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = schema.parse({ constructor: \"string\", key: \"value\" });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":14,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = schema.parse({ constructor: 123, key: \"value\" });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":19,"symbol":"result3","kind":"constant","lang":"typescript","code":"const result3 = schema.parse({ constructor: null, key: \"value\" });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":24,"symbol":"result4","kind":"constant","lang":"typescript","code":"const result4 = schema.parse({ constructor: {}, key: \"value\" });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":29,"symbol":"result5","kind":"constant","lang":"typescript","code":"const result5 = schema.parse({ constructor: [], key: \"value\" });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":34,"symbol":"result6","kind":"constant","lang":"typescript","code":"const result6 = schema.parse({ constructor: true, key: \"value\" });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":39,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.string(), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":43,"symbol":"result1","kind":"constant","lang":"typescript","code":"const result1 = schema.parse({ normalKey: \"value\" });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":48,"symbol":"result2","kind":"constant","lang":"typescript","code":"const result2 = schema.parse({ key1: \"value1\", key2: \"value2\" });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":53,"symbol":"stringSchema","kind":"constant","lang":"typescript","code":"const stringSchema = z.record(z.string(), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":61,"symbol":"enumSchema","kind":"constant","lang":"typescript","code":"const enumSchema = z.record(z.enum([\"constructor\", \"key\"]), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":65,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = enumSchema.parse({ constructor: \"value1\", key: \"value2\" });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":70,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.string(), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":72,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = { key: \"value\" };"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":80,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(input);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":89,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.string(), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":91,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = { key: \"value\", bad: 123 };"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":97,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(input);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":102,"symbol":"enumerableSym","kind":"constant","lang":"typescript","code":"const enumerableSym = Symbol.for(\"included\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":103,"symbol":"nonEnumerableSym","kind":"constant","lang":"typescript","code":"const nonEnumerableSym = Symbol.for(\"hidden\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":104,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.record(z.symbol(), z.string());"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":106,"symbol":"input","kind":"constant","lang":"typescript","code":"const input: Record<symbol, unknown> = { [enumerableSym]: \"value\" };"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":112,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.safeParse(input);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":121,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ name: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/record-constructor.test.ts","line":122,"symbol":"jsonSchema","kind":"constant","lang":"typescript","code":"const jsonSchema = z.toJSONSchema(schema);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/recursive-tuples.test.ts","line":7,"symbol":"y","kind":"constant","lang":"typescript","code":"const y = z.lazy((): any => z.tuple([y, y]).or(z.string()));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/recursive-tuples.test.ts","line":12,"symbol":"y","kind":"constant","lang":"typescript","code":"const y = z.lazy((): any => z.tuple([y, y]).or(z.string()));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/recursive-tuples.test.ts","line":25,"symbol":"y","kind":"constant","lang":"typescript","code":"const y = z.lazy((): any => z.tuple([y, y]).or(z.string()));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/recursive-tuples.test.ts","line":33,"symbol":"y","kind":"constant","lang":"typescript","code":"const y = z.lazy((): any => z.string().or(z.lazy(() => z.tuple([y, y]))));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/recursive-tuples.test.ts","line":39,"symbol":"y","kind":"constant","lang":"typescript","code":"const y = z.lazy((): any => z.array(y).or(z.string()));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/treeshake.test.ts","line":10,"symbol":"here","kind":"constant","lang":"typescript","code":"const here = path.dirname(fileURLToPath(import.meta.url));"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/treeshake.test.ts","line":11,"symbol":"MINI","kind":"constant","lang":"typescript","code":"const MINI = path.resolve(here, \"../../../mini/index.ts\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/treeshake.test.ts","line":12,"symbol":"CLASSIC","kind":"constant","lang":"typescript","code":"const CLASSIC = path.resolve(here, \"../../../index.ts\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/treeshake.test.ts","line":14,"symbol":"bundle","kind":"function","lang":"typescript","code":"async function bundle(entrypoint: string, source: string): Promise<string> {\n const result = await build({\n stdin: {\n contents: source.replace(\"%ENTRY%\", entrypoint),\n loader: \"ts\",\n resolveDir: here,\n },\n bundle: true,\n minify: true,\n format: \"esm\",\n target: \"es2020\",\n treeShaking: true,\n write: false,\n logLevel: \"silent\",\n });\n return result.outputFiles[0]!.text;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/treeshake.test.ts","line":15,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = await build({\n stdin: {\n contents: source.replace(\"%ENTRY%\", entrypoint),\n loader: \"ts\",\n resolveDir: here,\n },\n bundle: true,\n minify: true,\n format: \"esm\",\n target: \"es2020\",\n treeShaking: true,\n write: false,\n logLevel: \"silent\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/treeshake.test.ts","line":33,"symbol":"out","kind":"constant","lang":"typescript","code":"const out = await bundle(MINI, `import * as z from \"%ENTRY%\";\\nconsole.log(z.boolean().parse(true));`);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/treeshake.test.ts","line":45,"symbol":"out","kind":"constant","lang":"typescript","code":"const out = await bundle(CLASSIC, `import * as z from \"%ENTRY%\";\\nconsole.log(z.boolean().parse(true));`);"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":3,"symbol":"URLDescriptor","kind":"constant","lang":"typescript","code":"const URLDescriptor = Object.getOwnPropertyDescriptor(globalThis, \"URL\")!;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":4,"symbol":"NativeURL","kind":"constant","lang":"typescript","code":"const NativeURL = globalThis.URL;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":5,"symbol":"canParseDescriptor","kind":"constant","lang":"typescript","code":"const canParseDescriptor = Object.getOwnPropertyDescriptor(NativeURL, \"canParse\")!;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":6,"symbol":"parseDescriptor","kind":"constant","lang":"typescript","code":"const parseDescriptor = Object.getOwnPropertyDescriptor(NativeURL, \"parse\")!;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":8,"symbol":"restoreURL","kind":"function","lang":"typescript","code":"function restoreURL() {\n Object.defineProperty(globalThis, \"URL\", URLDescriptor);\n Object.defineProperty(NativeURL, \"canParse\", canParseDescriptor);\n Object.defineProperty(NativeURL, \"parse\", parseDescriptor);\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":23,"symbol":"canParse","kind":"constant","lang":"typescript","code":"const canParse = vi.spyOn(NativeURL, \"canParse\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":24,"symbol":"URLStatic","kind":"constant","lang":"typescript","code":"const URLStatic = NativeURL as typeof URL & { parse: (input: string) => URL | null };"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":25,"symbol":"parse","kind":"constant","lang":"typescript","code":"const parse = vi.spyOn(URLStatic, \"parse\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":26,"symbol":"z","kind":"constant","lang":"typescript","code":"const z = await import(\"../../index.js\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":44,"symbol":"z","kind":"constant","lang":"typescript","code":"const z = await import(\"../../index.js\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":45,"symbol":"postProcessor","kind":"constant","lang":"typescript","code":"const postProcessor = z.core.globalConfig.postProcessor;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":49,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.url();"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":50,"symbol":"target","kind":"constant","lang":"typescript","code":"const target = inherited ? Object.create(Object.getPrototypeOf(schema.def)) : schema.def;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":69,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = parseURLObject(\"https://example.com\", {});"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":78,"symbol":"z","kind":"constant","lang":"typescript","code":"const z = await import(\"../../index.js\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":79,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases = [\n [z.url(), \"https://example.com\", \"not a url\"],\n [z.ipv6(), \"2001:db8::1\", \"not-an-ip\"],\n [z.cidrv6(), \"2001:db8::/32\", \"not-an-ip/32\"],\n ] as const;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":97,"symbol":"z","kind":"constant","lang":"typescript","code":"const z = await import(\"../../index.js\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":98,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases = [\n [z.url({ normalize: true }), \"https://example.com\", \"not a url\"],\n [z.url({ hostname: /^example\\.com$/ }), \"https://example.com\", \"https://other.com\"],\n [z.httpUrl(), \"https://example.com\", \"mailto:a@example.com\"],\n ] as const;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":115,"symbol":"z","kind":"constant","lang":"typescript","code":"const z = await import(\"../../index.js\");"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":116,"symbol":"cases","kind":"constant","lang":"typescript","code":"const cases = [\n [z.url(), \"https://example.com\"],\n [z.url({ normalize: true }), \"https://example.com\"],\n [z.ipv6(), \"2001:db8::1\"],\n [z.cidrv6(), \"2001:db8::/32\"],\n ] as const;"} {"repo":"zod","file":"packages/zod/src/v4/core/tests/url-no-canparse.test.ts","line":122,"symbol":"subjects","kind":"constant","lang":"typescript","code":"const subjects = cases.flatMap(([schema, input]) => [\n [schema, input] as const,\n [z.compile(schema), input] as const,\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":8,"symbol":"assignProps","kind":"function","lang":"typescript","code":"function assignProps<T extends object>(target: T, ...sources: object[]): T {\n for (const source of sources) {\n for (const key of Reflect.ownKeys(source)) {\n if (Object.prototype.propertyIsEnumerable.call(source, key)) {\n assignProp(target, key, (source as any)[key]);\n }\n }\n }\n return target;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":19,"symbol":"Processor","kind":"type","lang":"typescript","code":"type Processor<T extends schemas.$ZodType = schemas.$ZodType> = (\n schema: T,\n ctx: ToJSONSchemaContext,\n json: JSONSchema.BaseSchema,\n params: ProcessParams\n) => void;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":31,"symbol":"UnrepresentableHandler","kind":"type","lang":"typescript","doc":"Called for each schema that has no JSON Schema equivalent. Return a JSON Schema to use in its place, `\"any\"` to fall back to the `unrepresentable: \"any\"` behavior, or `\"throw\"`/`undefined` to throw the default error. Throwing from the handler propagates, so custom errors work too.","code":"type UnrepresentableHandler<T extends schemas.$ZodType = schemas.$ZodType> = (ctx: {\n zodSchema: T;\n path: (string | number)[];\n /** The error Zod would throw. Distinguishes sites that share a `zodSchema`, e.g. an `undefined`\n * vs a `bigint` member of the same literal. */\n message: string;\n}) => JSONSchema.BaseSchema | \"throw\" | \"any\" | undefined;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":39,"symbol":"JSONSchemaGeneratorParams","kind":"interface","lang":"typescript","code":"interface JSONSchemaGeneratorParams {\n processors: Record<string, Processor>;\n /** A registry used to look up metadata for each schema. Any schema with an `id` property will be extracted as a $def.\n * @default globalRegistry */\n metadata?: $ZodRegistry<Record<string, any>>;\n /** The JSON Schema version to target.\n * - `\"draft-2020-12\"` — Default. JSON Schema Draft 2020-12\n * - `\"draft-07\"` — JSON Schema Draft 7\n * - `\"draft-04\"` — JSON Schema Draft 4\n * - `\"openapi-3.0\"` — OpenAPI 3.0 Schema Object */\n target?: \"draft-04\" | \"draft-07\" | \"draft-2020-12\" | \"openapi-3.0\" | ({} & string) | undefined;\n /** How to handle unrepresentable types.\n * - `\"throw\"` — Default. Unrepresentable types throw an error\n * - `\"any\"` — Unrepresentable types become `{}`\n * - A function — called once per unrepresentable schema; see {@link UnrepresentableHandler}. */\n unrepresentable?: \"throw\" | \"any\" | UnrepresentableHandler<schemas.$ZodTypes>;\n /** Arbitrary custom logic that can be used to modify the generated JSON Schema. */\n override?: (ctx: {\n zodSchema: schemas.$ZodTypes;\n jsonSchema: JSONSchema.BaseSchema;\n path: (string | number)[];\n }) => void;\n /** Whether to"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":79,"symbol":"ToJSONSchemaParams","kind":"type","lang":"typescript","doc":"Parameters for the toJSONSchema function.","code":"type ToJSONSchemaParams = Omit<JSONSchemaGeneratorParams, \"processors\" | \"external\">;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":84,"symbol":"RegistryToJSONSchemaParams","kind":"interface","lang":"typescript","doc":"Parameters for the toJSONSchema function when passing a registry.","code":"interface RegistryToJSONSchemaParams extends ToJSONSchemaParams {\n uri?: (id: string) => string;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":88,"symbol":"ProcessParams","kind":"interface","lang":"typescript","code":"interface ProcessParams {\n schemaPath: schemas.$ZodType[];\n path: (string | number)[];\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":93,"symbol":"Seen","kind":"interface","lang":"typescript","code":"interface Seen {\n /** JSON Schema result for this Zod schema */\n schema: JSONSchema.BaseSchema;\n /** A cached version of the schema that doesn't get overwritten during ref resolution */\n def?: JSONSchema.BaseSchema;\n defId?: string | undefined;\n /** Number of times this schema was encountered during traversal */\n count: number;\n /** Cycle path */\n cycle?: (string | number)[] | undefined;\n isParent?: boolean | undefined;\n /** Schema to inherit JSON Schema properties from (set by processor for wrappers) */\n ref?: schemas.$ZodType | null;\n /** JSON Schema property path for this schema */\n path?: (string | number)[] | undefined;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":110,"symbol":"ToJSONSchemaContext","kind":"interface","lang":"typescript","code":"interface ToJSONSchemaContext {\n processors: Record<string, Processor>;\n metadataRegistry: $ZodRegistry<Record<string, any>>;\n target: \"draft-04\" | \"draft-07\" | \"draft-2020-12\" | \"openapi-3.0\" | ({} & string);\n // must be schemas.$ZodType to prevent recursive type resolution error\n unrepresentable: \"throw\" | \"any\" | UnrepresentableHandler;\n override: (ctx: {\n // must be schemas.$ZodType to prevent recursive type resolution error\n zodSchema: schemas.$ZodType;\n jsonSchema: JSONSchema.BaseSchema;\n path: (string | number)[];\n }) => void;\n io: \"input\" | \"output\";\n counter: number;\n seen: Map<schemas.$ZodType, Seen>;\n /** Registry conversions share one `seen` map across every emitted schema. These hold the\n * `external` the whole-map passes below last ran for, so the passes are not repeated once per\n * schema — and still re-run if the map grows or `external` is swapped. `sharedEmitDoneFor`\n * covers both passes in `finalize`: the ref flattening and the `$defs` build.\n *\n * The passes are valid only while nothing they read has changed, so both are cleared in\n * `processSchema()` when the map grows, and in `JSONSchemaGenerator.emit()`, which can also chan"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":165,"symbol":"initializeContext","kind":"function","lang":"typescript","code":"function initializeContext(params: JSONSchemaGeneratorParams): ToJSONSchemaContext {\n // Normalize target: convert old non-hyphenated versions to hyphenated versions\n let target: ToJSONSchemaContext[\"target\"] = params?.target ?? \"draft-2020-12\";\n if (target === \"draft-4\") target = \"draft-04\";\n if (target === \"draft-7\") target = \"draft-07\";\n\n return {\n processors: params.processors ?? {},\n metadataRegistry: params?.metadata ?? globalRegistry,\n target,\n unrepresentable: (params?.unrepresentable as ToJSONSchemaContext[\"unrepresentable\"]) ?? \"throw\",\n override: (params?.override as any) ?? (() => {}),\n io: params?.io ?? \"output\",\n counter: 0,\n seen: new Map(),\n sharedDefsExtractedFor: undefined,\n sharedEmitDoneFor: undefined,\n cycles: params?.cycles ?? \"ref\",\n reused: params?.reused ?? \"inline\",\n intersections: [],\n deferred: [],\n external: params?.external ?? undefined,\n };\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":195,"symbol":"handleUnrepresentable","kind":"function","lang":"typescript","doc":"Applies the `unrepresentable` setting at a site that has no JSON Schema equivalent. Throws `message` unless the setting (or the handler's return value) says otherwise. Returns `true` if a custom JSON Schema was written into `json`, in which case the caller must not write its own.","code":"function handleUnrepresentable(\n schema: schemas.$ZodType,\n ctx: ToJSONSchemaContext,\n json: JSONSchema.BaseSchema,\n params: ProcessParams,\n message: string\n): boolean {\n const result =\n typeof ctx.unrepresentable === \"function\"\n ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message })\n : ctx.unrepresentable;\n if (result === \"any\") return false;\n if (result === undefined || result === \"throw\") throw new Error(message);\n Object.assign(json, result);\n return true;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":202,"symbol":"result","kind":"constant","lang":"typescript","code":"const result =\n typeof ctx.unrepresentable === \"function\"\n ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message })\n : ctx.unrepresentable;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":213,"symbol":"processSchema","kind":"function","lang":"typescript","doc":"never rename this back to `process`: bundler polyfills inject a top-level `const process` that a lexical declaration of the same name collides with (#6397)","code":"function processSchema<T extends schemas.$ZodType>(\n schema: T,\n ctx: ToJSONSchemaContext,\n _params: ProcessParams = { path: [], schemaPath: [] }\n): JSONSchema.BaseSchema {\n const def = schema._zod.def as schemas.$ZodTypes[\"_zod\"][\"def\"];\n\n // check for schema in seens\n const seen = ctx.seen.get(schema);\n\n if (seen) {\n seen.count++;\n\n // check if cycle\n const isCycle = _params.schemaPath.includes(schema);\n if (isCycle) {\n seen.cycle = _params.path;\n }\n\n return seen.schema;\n }\n\n // initialize\n const result: Seen = { schema: {}, count: 1, cycle: undefined, path: _params.path };\n ctx.seen.set(schema, result);\n ctx.sharedDefsExtractedFor = undefined;\n ctx.sharedEmitDoneFor = undefined;\n\n // custom method overrides default behavior\n const overrideSchema = schema._zod.toJSONSchema?.();\n if (overrideSchema) {\n result.schema = overrideSchema as any;\n } else {\n const params = {\n ..._params,\n schemaPath: [..._params.schemaPath, schema],\n path: _params.path,\n };\n\n if (schema._zod.processJSONSchema) {\n schema._zod.processJSONSchema(ctx, result.schema, params);\n } else {\n const _json = result.schema;\n const pro"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":218,"symbol":"def","kind":"constant","lang":"typescript","code":"const def = schema._zod.def as schemas.$ZodTypes[\"_zod\"][\"def\"];"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":221,"symbol":"seen","kind":"constant","lang":"typescript","doc":"check for schema in seens","code":"const seen = ctx.seen.get(schema);"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":227,"symbol":"isCycle","kind":"constant","lang":"typescript","doc":"check if cycle","code":"const isCycle = _params.schemaPath.includes(schema);"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":236,"symbol":"result","kind":"constant","lang":"typescript","doc":"initialize","code":"const result: Seen = { schema: {}, count: 1, cycle: undefined, path: _params.path };"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":242,"symbol":"overrideSchema","kind":"constant","lang":"typescript","doc":"custom method overrides default behavior","code":"const overrideSchema = schema._zod.toJSONSchema?.();"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":246,"symbol":"params","kind":"constant","lang":"typescript","code":"const params = {\n ..._params,\n schemaPath: [..._params.schemaPath, schema],\n path: _params.path,\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":255,"symbol":"_json","kind":"constant","lang":"typescript","code":"const _json = result.schema;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":256,"symbol":"processor","kind":"constant","lang":"typescript","code":"const processor = ctx.processors[def.type];"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":263,"symbol":"parent","kind":"constant","lang":"typescript","code":"const parent = schema._zod.parent as T;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":274,"symbol":"meta","kind":"constant","lang":"typescript","doc":"metadata","code":"const meta = ctx.metadataRegistry.get(schema);"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":288,"symbol":"_result","kind":"constant","lang":"typescript","doc":"pulling fresh from ctx.seen in case it was overwritten","code":"const _result = ctx.seen.get(schema)!;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":297,"symbol":"encodeJSONPointerSegment","kind":"function","lang":"typescript","doc":"Escape a reference token for use in a JSON Pointer fragment (RFC 6901): `~` becomes `~0` and `/` becomes `~1`. The `~` replacement must run first.","code":"function encodeJSONPointerSegment(segment: string): string {\n return segment.replace(/~/g, \"~0\").replace(/\\//g, \"~1\");\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":301,"symbol":"extractDefs","kind":"function","lang":"typescript","code":"function extractDefs<T extends schemas.$ZodType>(\n ctx: ToJSONSchemaContext,\n schema: T\n // params: EmitParams\n): void {\n // iterate over seen map;\n const root = ctx.seen.get(schema);\n\n if (!root) throw new Error(\"Unprocessed schema. This is a bug in Zod.\");\n\n // With `external` set, every registered schema resolves through the external branch of `makeURI`, so the root branch below produces the same ref the external branch would — this pass is identical whichever schema it is called with, and only needs to run once.\n if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external) return;\n\n // Track ids to detect duplicates across different schemas\n const idToSchema = new Map<string, schemas.$ZodType>();\n for (const entry of ctx.seen.entries()) {\n const id = ctx.metadataRegistry.get(entry[0])?.id;\n if (id) {\n const existing = idToSchema.get(id);\n if (existing && existing !== entry[0]) {\n throw new Error(\n `Duplicate schema id \"${id}\" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`\n );\n }\n idToSchema.set(id, entry[0]);\n }\n }\n\n // returns a ref to the sche"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":307,"symbol":"root","kind":"constant","lang":"typescript","doc":"iterate over seen map;","code":"const root = ctx.seen.get(schema);"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":315,"symbol":"idToSchema","kind":"constant","lang":"typescript","doc":"Track ids to detect duplicates across different schemas","code":"const idToSchema = new Map<string, schemas.$ZodType>();"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":317,"symbol":"id","kind":"constant","lang":"typescript","code":"const id = ctx.metadataRegistry.get(entry[0])?.id;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":319,"symbol":"existing","kind":"constant","lang":"typescript","code":"const existing = idToSchema.get(id);"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":330,"symbol":"makeURI","kind":"constant","lang":"typescript","doc":"returns a ref to the schema defId will be empty if the ref points to an external schema (or #)","code":"const makeURI = (entry: [schemas.$ZodType<unknown, unknown>, Seen]): { ref: string; defId?: string } => {\n // comparing the seen objects because sometimes multiple schemas map to the same seen object. e.g. lazy\n\n // external is configured\n const defsSegment = ctx.target === \"draft-2020-12\" ? \"$defs\" : \"definitions\";\n if (ctx.external) {\n const externalId = ctx.external.registry.get(entry[0])?.id; // ?? \"__shared\";// `__schema${ctx.counter++}`;\n\n // check if schema is in the external registry\n const uriGenerator = ctx.external.uri ?? ((id: string) => id);\n if (externalId) {\n return { ref: uriGenerator(externalId) };\n }\n\n // otherwise, add to __shared\n const id: string = entry[1].defId ?? (entry[1].schema.id as string) ?? `schema${ctx.counter++}`;\n entry[1].defId = id; // set defId so it will be reused if needed\n return { defId: id, ref: `${uriGenerator(\"__shared\")}#/${defsSegment}/${encodeJSONPointerSegment(id)}` };\n }\n\n const uriPrefix = `#`;\n const defUriPrefix = `${uriPrefix}/${defsSegment}/`;\n\n // an id-less root has nowhere to be extracted to, so it stays inline and self-references as `#`\n if (entry["} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":334,"symbol":"defsSegment","kind":"constant","lang":"typescript","doc":"external is configured","code":"const defsSegment = ctx.target === \"draft-2020-12\" ? \"$defs\" : \"definitions\";"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":336,"symbol":"externalId","kind":"constant","lang":"typescript","code":"const externalId = ctx.external.registry.get(entry[0])?.id;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":339,"symbol":"uriGenerator","kind":"constant","lang":"typescript","doc":"check if schema is in the external registry","code":"const uriGenerator = ctx.external.uri ?? ((id: string) => id);"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":345,"symbol":"id","kind":"constant","lang":"typescript","doc":"otherwise, add to __shared","code":"const id: string = entry[1].defId ?? (entry[1].schema.id as string) ?? `schema${ctx.counter++}`;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":350,"symbol":"uriPrefix","kind":"constant","lang":"typescript","code":"const uriPrefix = `#`;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":351,"symbol":"defUriPrefix","kind":"constant","lang":"typescript","code":"const defUriPrefix = `${uriPrefix}/${defsSegment}/`;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":359,"symbol":"defId","kind":"constant","lang":"typescript","doc":"self-contained schema","code":"const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":364,"symbol":"extractToDef","kind":"constant","lang":"typescript","doc":"stored cached version in `def` property remove all properties, set $ref","code":"const extractToDef = (entry: [schemas.$ZodType<unknown, unknown>, Seen]): void => {\n // if the schema is already a reference, do not extract it\n if (entry[1].schema.$ref) {\n return;\n }\n const seen = entry[1];\n const { ref, defId } = makeURI(entry);\n\n seen.def = { ...seen.schema };\n // defId won't be set if the schema is a reference to an external schema or if the schema is the root schema\n if (defId) seen.defId = defId;\n // wipe away all properties except $ref\n const schema = seen.schema;\n for (const key in schema) {\n delete schema[key];\n }\n schema.$ref = ref;\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":369,"symbol":"seen","kind":"constant","lang":"typescript","code":"const seen = entry[1];"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":376,"symbol":"schema","kind":"constant","lang":"typescript","doc":"wipe away all properties except $ref","code":"const schema = seen.schema;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":388,"symbol":"seen","kind":"constant","lang":"typescript","code":"const seen = entry[1];"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":401,"symbol":"seen","kind":"constant","lang":"typescript","code":"const seen = entry[1];"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":411,"symbol":"ext","kind":"constant","lang":"typescript","code":"const ext = ctx.external.registry.get(entry[0])?.id;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":419,"symbol":"id","kind":"constant","lang":"typescript","doc":"extract schemas with `id` meta","code":"const id = ctx.metadataRegistry.get(entry[0])?.id;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":444,"symbol":"compactTypeUnion","kind":"function","lang":"typescript","doc":"Rewrites `anyOf: [{type: \"a\"}, {type: \"b\"}]` to `type: [\"a\", \"b\"]`, which every JSON Schema draft treats as equivalent and most consumers render far better for the nullable case. Only branches that are a bare type assertion qualify — anything carrying a constraint, `$ref`, `const` or metadata is left alone. Runs after `flattenRef`, so a branch an override decorated or `$defs` extraction turned into a `$ref` is no longer bare and correctly stays in `anyOf`. `oneOf` is excluded: `integer` and `number` overlap, so \"exactly one\" and \"at least one\" are not the same there. OpenAPI 3.0 is excluded: its `type` must be a single string.","code":"function compactTypeUnion(schema: JSONSchema.BaseSchema): void {\n const options = schema.anyOf;\n if (!Array.isArray(options) || options.length === 0 || schema.type !== undefined) return;\n\n const types: JSONSchema.SchemaType[] = [];\n for (const option of options) {\n if (!option || typeof option !== \"object\") return;\n // A branch that is itself a compactible union folds into this one — nested `anyOf` and a flat `type` array say the same thing. Compacting it first also makes the result independent of the order this pass walks the seen map in.\n compactTypeUnion(option as JSONSchema.BaseSchema);\n const keys = Object.keys(option);\n if (keys.length !== 1 || keys[0] !== \"type\") return;\n const type = (option as JSONSchema.BaseSchema).type;\n for (const member of Array.isArray(type) ? type : [type]) {\n if (typeof member !== \"string\") return;\n if (!types.includes(member)) types.push(member);\n }\n }\n\n delete schema.anyOf;\n // A `type` array must be non-empty and unique (metaschema); a single member is spelled as a bare string.\n schema.type = types.length === 1 ? types[0] : types;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":445,"symbol":"options","kind":"constant","lang":"typescript","code":"const options = schema.anyOf;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":448,"symbol":"types","kind":"constant","lang":"typescript","code":"const types: JSONSchema.SchemaType[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":453,"symbol":"keys","kind":"constant","lang":"typescript","code":"const keys = Object.keys(option);"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":455,"symbol":"type","kind":"constant","lang":"typescript","code":"const type = (option as JSONSchema.BaseSchema).type;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":470,"symbol":"FOLDABLE_KEYS","kind":"constant","lang":"typescript","doc":"Keywords `foldIntersection` knows how to combine. Anything else — `$ref`, `patternProperties`, an annotation like `description` — makes a member unfoldable, so a constraint this does not understand leaves the `allOf` alone instead of being silently dropped or misattributed.","code":"const FOLDABLE_KEYS = new Set([\"type\", \"properties\", \"required\", \"additionalProperties\"]);"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":471,"symbol":"UNION_KEYS","kind":"constant","lang":"typescript","code":"const UNION_KEYS = [\"oneOf\", \"anyOf\"] as const;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":474,"symbol":"undeclaredConstraint","kind":"function","lang":"typescript","doc":"A member's constraint on a key it does not declare itself. A `catchall` states one; `false`, an absent `additionalProperties`, and the empty schema a loose object emits state nothing.","code":"function undeclaredConstraint(member: JSONSchema.ObjectSchema): JSONSchema.BaseSchema | null {\n const extra = member.additionalProperties;\n if (extra === undefined || extra === false || typeof extra !== \"object\" || extra === null) return null;\n return Object.keys(extra).length ? (extra as JSONSchema.BaseSchema) : null;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":475,"symbol":"extra","kind":"constant","lang":"typescript","code":"const extra = member.additionalProperties;"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":481,"symbol":"foldObjects","kind":"function","lang":"typescript","doc":"Combines object members into the single object they describe together, or returns `null` if any of them carries a keyword outside {@link FOLDABLE_KEYS}.","code":"function foldObjects(members: JSONSchema._JSONSchema[]): JSONSchema.ObjectSchema | null {\n const objects: JSONSchema.ObjectSchema[] = [];\n for (const member of members) {\n // A boolean subschema is legal JSON Schema and carries no keywords to fold.\n if (typeof member !== \"object\" || member.type !== \"object\") return null;\n for (const key in member) {\n if (!FOLDABLE_KEYS.has(key)) return null;\n }\n objects.push(member as JSONSchema.ObjectSchema);\n }\n\n const properties: Record<string, JSONSchema._JSONSchema> = {};\n const required = new Set<string>();\n for (const object of objects) {\n for (const key in object.properties) {\n // `in` would report a `__proto__` key as already present via the prototype chain and skip it.\n if (Object.prototype.hasOwnProperty.call(properties, key)) continue;\n // Every member constrains this key: the ones that declare it say how, and a `catchall` member constrains it too even though it does not name it. The key has to satisfy all of them, which is the same intersection one level down.\n const parts: JSONSchema._JSONSchema[] = [];\n for (const other of objects) {\n const part = other.properties?.[key] ??"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":482,"symbol":"objects","kind":"constant","lang":"typescript","code":"const objects: JSONSchema.ObjectSchema[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":492,"symbol":"properties","kind":"constant","lang":"typescript","code":"const properties: Record<string, JSONSchema._JSONSchema> = {};"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":493,"symbol":"required","kind":"constant","lang":"typescript","code":"const required = new Set<string>();"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":499,"symbol":"parts","kind":"constant","lang":"typescript","doc":"Every member constrains this key: the ones that declare it say how, and a `catchall` member constrains it too even though it does not name it. The key has to satisfy all of them, which is the same intersection one level down.","code":"const parts: JSONSchema._JSONSchema[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/core/to-json-schema.ts","line":501,"symbol":"part","kind":"constant","lang":"typescript","code":"const part = other.properties?.[key] ?? undeclaredConstraint(other);"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":8,"symbol":"JSONType","kind":"type","lang":"typescript","doc":"json","code":"type JSONType = string | number | boolean | null | JSONType[] | { [key: string]: JSONType };"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":9,"symbol":"JWTAlgorithm","kind":"type","lang":"typescript","code":"type JWTAlgorithm =\n | \"HS256\"\n | \"HS384\"\n | \"HS512\"\n | \"RS256\"\n | \"RS384\"\n | \"RS512\"\n | \"ES256\"\n | \"ES384\"\n | \"ES512\"\n | \"PS256\"\n | \"PS384\"\n | \"PS512\"\n | \"EdDSA\"\n | (string & {});"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":25,"symbol":"HashAlgorithm","kind":"type","lang":"typescript","code":"type HashAlgorithm = \"md5\" | \"sha1\" | \"sha256\" | \"sha384\" | \"sha512\";"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":26,"symbol":"HashEncoding","kind":"type","lang":"typescript","code":"type HashEncoding = \"hex\" | \"base64\" | \"base64url\";"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":27,"symbol":"HashFormat","kind":"type","lang":"typescript","code":"type HashFormat = `${HashAlgorithm}_${HashEncoding}`;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":28,"symbol":"IPVersion","kind":"type","lang":"typescript","code":"type IPVersion = \"v4\" | \"v6\";"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":29,"symbol":"MimeTypes","kind":"type","lang":"typescript","code":"type MimeTypes =\n | \"application/json\"\n | \"application/xml\"\n | \"application/x-www-form-urlencoded\"\n | \"application/javascript\"\n | \"application/pdf\"\n | \"application/zip\"\n | \"application/vnd.ms-excel\"\n | \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"\n | \"application/msword\"\n | \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\"\n | \"application/vnd.ms-powerpoint\"\n | \"application/vnd.openxmlformats-officedocument.presentationml.presentation\"\n | \"application/octet-stream\"\n | \"application/graphql\"\n | \"text/html\"\n | \"text/plain\"\n | \"text/css\"\n | \"text/javascript\"\n | \"text/csv\"\n | \"image/png\"\n | \"image/jpeg\"\n | \"image/gif\"\n | \"image/svg+xml\"\n | \"image/webp\"\n | \"audio/mpeg\"\n | \"audio/ogg\"\n | \"audio/wav\"\n | \"audio/webm\"\n | \"video/mp4\"\n | \"video/webm\"\n | \"video/ogg\"\n | \"font/woff\"\n | \"font/woff2\"\n | \"font/ttf\"\n | \"font/otf\"\n | \"multipart/form-data\"\n | (string & {});"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":67,"symbol":"ParsedTypes","kind":"type","lang":"typescript","code":"type ParsedTypes =\n | \"string\"\n | \"number\"\n | \"bigint\"\n | \"boolean\"\n | \"symbol\"\n | \"undefined\"\n | \"object\"\n | \"function\"\n | \"file\"\n | \"date\"\n | \"array\"\n | \"map\"\n | \"set\"\n | \"nan\"\n | \"null\"\n | \"promise\";"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":86,"symbol":"AssertEqual","kind":"type","lang":"typescript","doc":"utils","code":"type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? true : false;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":87,"symbol":"AssertNotEqual","kind":"type","lang":"typescript","code":"type AssertNotEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? false : true;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":88,"symbol":"AssertExtends","kind":"type","lang":"typescript","code":"type AssertExtends<T, U> = T extends U ? T : never;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":89,"symbol":"ToZodMismatch","kind":"type","lang":"typescript","code":"type ToZodMismatch<T, S extends schemas.$ZodType> = {\n \"types do not match\": {\n expected: T;\n received: S[\"_zod\"][\"output\"];\n };\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":97,"symbol":"ToZodKeyMismatch","kind":"type","lang":"typescript","doc":"Stays a `$ZodType` so it still satisfies the shape constraint, and carries a brand no real schema has so the offending property is the one TypeScript reports as unassignable.","code":"type ToZodKeyMismatch<Expected, Received> = schemas.$ZodType & {\n \"types do not match\": { expected: Expected; received: Received };\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":102,"symbol":"toZodDummy","kind":"constant","lang":"typescript","doc":"An enum reference and the union of exactly its members are mutually assignable but not identical, so `AssertEqual` alone rejects `z.enum(SomeEnum)` against a `SomeEnum` target. Unioning each side with a private dummy forces the union to be rebuilt, which collapses that one difference and nothing else — plain literals against an enum, member subsets, brands and `any` all still fail. The symbol is not exported, so no user type can smuggle it in and cancel a real difference.","code":"const toZodDummy: unique symbol;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":105,"symbol":"ToZodNormalize","kind":"type","lang":"typescript","doc":"Homomorphic, so `readonly` and optional modifiers survive the rebuild and only leaves are normalized. An intersection flattens here, which is why an intersection target and the flat object with the same keys match each other. A callable stops the walk because `keyof` a function is `never`, so mapping one would erase its signature and make every function compare equal.","code":"type ToZodNormalize<T> = [T] extends [(...args: any[]) => any]\n ? T\n : [T] extends [object]\n ? { [K in keyof T]: ToZodNormalize<T[K]> }\n : T | typeof toZodDummy;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":111,"symbol":"ToZodEqual","kind":"type","lang":"typescript","code":"type ToZodEqual<Output, T> = AssertEqual<Output, T> extends true\n ? true\n : IsAny<Output> extends true\n ? false\n : IsAny<T> extends true\n ? false\n : AssertEqual<ToZodNormalize<Output>, ToZodNormalize<T>>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":120,"symbol":"ToZodShape","kind":"type","lang":"typescript","doc":"Rebuilds the shape with a marker on each key that disagrees, so the diagnostic names the key instead of failing the whole schema at the top level. A key the target lacks reports `expected: never`; a key the schema lacks reports `received: never`.","code":"type ToZodShape<Shape, T> = {\n [K in keyof Shape]: Shape[K] extends schemas.$ZodType\n ? K extends keyof T\n ? ToZodEqual<Shape[K][\"_zod\"][\"output\"], T[K]> extends true\n ? Shape[K]\n : ToZodKeyMismatch<T[K], Shape[K][\"_zod\"][\"output\"]>\n : ToZodKeyMismatch<never, Shape[K][\"_zod\"][\"output\"]>\n : Shape[K];\n} & { [K in Exclude<keyof T, keyof Shape>]: ToZodKeyMismatch<T[K], never> };"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":131,"symbol":"ToZodExpand","kind":"type","lang":"typescript","doc":"Forces the mapped type to display expanded, so the error prints the keys rather than the alias name.","code":"type ToZodExpand<X> = { [K in keyof X]: X[K] } & {};"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":134,"symbol":"ToZodTarget","kind":"type","lang":"typescript","doc":"Only localizes when a key is genuinely at fault. A whole-type difference the per-key walk cannot see — a `readonly` modifier, an intersection versus the flat object with the same keys — leaves every key agreeing, and reporting nothing there would silently accept what the top-level check rejected.","code":"type ToZodTarget<S extends schemas.$ZodType, T> = S extends schemas.$ZodObject<infer Shape, infer Config>\n ? T extends object\n ? AssertEqual<ToZodExpand<ToZodShape<Shape, T>>, ToZodExpand<Shape>> extends true\n ? S & ToZodMismatch<T, S>\n : schemas.$ZodObject<ToZodExpand<ToZodShape<Shape, T>>, Config>\n : S & ToZodMismatch<T, S>\n : S & ToZodMismatch<T, S>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":141,"symbol":"IsAny","kind":"type","lang":"typescript","code":"type IsAny<T> = 0 extends 1 & T ? true : false;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":142,"symbol":"Omit","kind":"type","lang":"typescript","code":"type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":143,"symbol":"OmitKeys","kind":"type","lang":"typescript","code":"type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":144,"symbol":"MakePartial","kind":"type","lang":"typescript","code":"type MakePartial<T, K extends keyof T> = Omit<T, K> & InexactPartial<Pick<T, K>>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":145,"symbol":"MakeRequired","kind":"type","lang":"typescript","code":"type MakeRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":147,"symbol":"Exactly","kind":"type","lang":"typescript","code":"type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":148,"symbol":"NoUndefined","kind":"type","lang":"typescript","code":"type NoUndefined<T> = T extends undefined ? never : T;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":149,"symbol":"Whatever","kind":"type","lang":"typescript","code":"type Whatever = {} | undefined | null;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":151,"symbol":"Widen","kind":"type","lang":"typescript","doc":"literal inputs widen to their primitive so a property check over `\"https:\"` accepts a `string` property","code":"type Widen<T> = T extends string\n ? string\n : T extends number\n ? number\n : T extends boolean\n ? boolean\n : T extends bigint\n ? bigint\n : T;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":161,"symbol":"LoosePartial","kind":"type","lang":"typescript","code":"type LoosePartial<T extends object> = InexactPartial<T> & {\n [k: string]: unknown;\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":164,"symbol":"Mask","kind":"type","lang":"typescript","code":"type Mask<Keys extends PropertyKey> = { [K in Keys]?: true };"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":165,"symbol":"Writeable","kind":"type","lang":"typescript","code":"type Writeable<T> = { -readonly [P in keyof T]: T[P] } & {};"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":166,"symbol":"InexactPartial","kind":"type","lang":"typescript","code":"type InexactPartial<T> = {\n [P in keyof T]?: T[P] | undefined;\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":169,"symbol":"EmptyObject","kind":"type","lang":"typescript","code":"type EmptyObject = Record<string, never>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":170,"symbol":"BuiltIn","kind":"type","lang":"typescript","code":"type BuiltIn =\n | (((...args: any[]) => any) | (new (...args: any[]) => any))\n | { readonly [Symbol.toStringTag]: string }\n | Date\n | Error\n | Generator\n | Promise<unknown>\n | RegExp;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":178,"symbol":"MakeReadonly","kind":"type","lang":"typescript","code":"type MakeReadonly<T> = T extends Map<infer K, infer V>\n ? ReadonlyMap<K, V>\n : T extends Set<infer V>\n ? ReadonlySet<V>\n : T extends [infer Head, ...infer Tail]\n ? readonly [Head, ...Tail]\n : T extends Array<infer V>\n ? ReadonlyArray<V>\n : T extends BuiltIn\n ? T\n : Readonly<T>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":189,"symbol":"SomeObject","kind":"type","lang":"typescript","code":"type SomeObject = Record<PropertyKey, any>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":190,"symbol":"Identity","kind":"type","lang":"typescript","code":"type Identity<T> = T;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":191,"symbol":"Flatten","kind":"type","lang":"typescript","code":"type Flatten<T> = Identity<{ [k in keyof T]: T[k] }>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":192,"symbol":"Mapped","kind":"type","lang":"typescript","code":"type Mapped<T> = { [k in keyof T]: T[k] };"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":193,"symbol":"Prettify","kind":"type","lang":"typescript","code":"type Prettify<T> = {\n // @ts-ignore\n [K in keyof T]: T[K];\n} & {};"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":198,"symbol":"NoNeverKeys","kind":"type","lang":"typescript","code":"type NoNeverKeys<T> = {\n [k in keyof T]: [T[k]] extends [never] ? never : k;\n}[keyof T];"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":201,"symbol":"NoNever","kind":"type","lang":"typescript","code":"type NoNever<T> = Identity<{\n [k in NoNeverKeys<T>]: k extends keyof T ? T[k] : never;\n}>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":204,"symbol":"Extend","kind":"type","lang":"typescript","code":"type Extend<A extends SomeObject, B extends SomeObject> = Flatten<\n // fast path when there is no keys overlap\n keyof A & keyof B extends never\n ? A & B\n : {\n [K in keyof A as K extends keyof B ? never : K]: A[K];\n } & {\n [K in keyof B]: B[K];\n }\n>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":215,"symbol":"TupleItems","kind":"type","lang":"typescript","code":"type TupleItems = ReadonlyArray<schemas.SomeType>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":216,"symbol":"AnyFunc","kind":"type","lang":"typescript","code":"type AnyFunc = (...args: any[]) => any;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":217,"symbol":"IsProp","kind":"type","lang":"typescript","code":"type IsProp<T, K extends keyof T> = T[K] extends AnyFunc ? never : K;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":218,"symbol":"MaybeAsync","kind":"type","lang":"typescript","code":"type MaybeAsync<T> = T | Promise<T>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":219,"symbol":"KeyOf","kind":"type","lang":"typescript","code":"type KeyOf<T> = keyof OmitIndexSignature<T>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":220,"symbol":"OmitIndexSignature","kind":"type","lang":"typescript","code":"type OmitIndexSignature<T> = {\n [K in keyof T as string extends K ? never : K extends string ? K : never]: T[K];\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":223,"symbol":"ExtractIndexSignature","kind":"type","lang":"typescript","code":"type ExtractIndexSignature<T> = {\n [K in keyof T as string extends K ? K : K extends string ? never : K]: T[K];\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":226,"symbol":"Keys","kind":"type","lang":"typescript","code":"type Keys<T extends object> = keyof OmitIndexSignature<T>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":228,"symbol":"SchemaClass","kind":"type","lang":"typescript","code":"type SchemaClass<T extends schemas.SomeType> = {\n new (def: T[\"_zod\"][\"def\"]): T;\n};"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":231,"symbol":"EnumValue","kind":"type","lang":"typescript","code":"type EnumValue = string | number;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":232,"symbol":"EnumLike","kind":"type","lang":"typescript","code":"type EnumLike = Readonly<Record<string, EnumValue>>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":233,"symbol":"ToEnum","kind":"type","lang":"typescript","code":"type ToEnum<T extends EnumValue> = Flatten<{ [k in T]: k }>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":234,"symbol":"KeysEnum","kind":"type","lang":"typescript","code":"type KeysEnum<T extends object> = ToEnum<Exclude<keyof T, symbol>>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":235,"symbol":"KeysArray","kind":"type","lang":"typescript","code":"type KeysArray<T extends object> = Flatten<(keyof T & string)[]>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":236,"symbol":"Literal","kind":"type","lang":"typescript","code":"type Literal = string | number | bigint | boolean | null | undefined;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":237,"symbol":"LiteralArray","kind":"type","lang":"typescript","code":"type LiteralArray = Array<Literal>;"} {"repo":"zod","file":"packages/zod/src/v4/core/util.ts","line":238,"symbol":"Primitive","kind":"type","lang":"typescript","code":"type Primitive = string | number | symbol | bigint | boolean | null | undefined;"} {"repo":"zod","file":"packages/zod/src/v4/core/versions.ts","line":1,"symbol":"version","kind":"constant","lang":"typescript","code":"const version = {\n major: 4,\n minor: 6,\n patch: 5 as number,\n} as const;"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":6,"symbol":"RESOLVING","kind":"constant","lang":"typescript","code":"const RESOLVING: unique symbol = Symbol(\"z.visit/resolving\");"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":7,"symbol":"Resolving","kind":"type","lang":"typescript","code":"type Resolving = typeof RESOLVING;"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":9,"symbol":"AnyZod","kind":"type","lang":"typescript","code":"type AnyZod = schemas.$ZodType;"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":10,"symbol":"Kind","kind":"type","lang":"typescript","code":"type Kind = schemas.$ZodTypeDef[\"type\"];"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":13,"symbol":"SchemaOfKind","kind":"type","lang":"typescript","doc":"The concrete schema class for a `def.type`, or `$ZodType` for kinds with no dedicated class.","code":"type SchemaOfKind<K extends Kind> = [Extract<schemas.$ZodTypes, { _zod: { def: { type: K } } }>] extends [never]\n ? AnyZod\n : Extract<schemas.$ZodTypes, { _zod: { def: { type: K } } }>;"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":17,"symbol":"VisitFn","kind":"type","lang":"typescript","code":"type VisitFn = (node: AnyZod, rewritten: boolean) => AnyZod;"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":18,"symbol":"VisitHandlers","kind":"type","lang":"typescript","code":"type VisitHandlers = { [K in Kind]?: (node: SchemaOfKind<K>, rewritten: boolean) => AnyZod };"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":28,"symbol":"visit","kind":"function","lang":"typescript","code":"function visit(schema: schemas.SomeType, fnOrHandlers: VisitFn | VisitHandlers): AnyZod {\n const fn: VisitFn =\n typeof fnOrHandlers === \"function\"\n ? fnOrHandlers\n : (node, rewritten) => {\n // A union of handlers isn't callable with one argument; handler `K` only ever sees kind `K`.\n const h = (fnOrHandlers as VisitHandlers)[node._zod.def.type] as\n | ((n: AnyZod, rewritten: boolean) => AnyZod)\n | undefined;\n return h ? h(node, rewritten) : node;\n };\n\n const cache = new Map<AnyZod, AnyZod | Resolving>();\n\n function run(s: AnyZod): AnyZod {\n const cached = cache.get(s);\n if (cached === RESOLVING) {\n // Non-lazy cycle. Defer to parse time, when the cache holds the finished node.\n return new schemas.$ZodLazy({\n type: \"lazy\",\n getter: () => cache.get(s) as AnyZod,\n });\n }\n if (cached !== undefined) return cached;\n cache.set(s, RESOLVING);\n const inner = mapInner(s);\n const mapped = fn(inner, inner !== s);\n cache.set(s, mapped);\n return mapped;\n }\n\n function mapInner(s: AnyZod): AnyZod {\n const def = s._zod.def as any;\n const kind = def.type as Kind;\n "} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":29,"symbol":"fn","kind":"constant","lang":"typescript","code":"const fn: VisitFn =\n typeof fnOrHandlers === \"function\"\n ? fnOrHandlers\n : (node, rewritten) => {\n // A union of handlers isn't callable with one argument; handler `K` only ever sees kind `K`.\n const h = (fnOrHandlers as VisitHandlers)[node._zod.def.type] as\n | ((n: AnyZod, rewritten: boolean) => AnyZod)\n | undefined;\n return h ? h(node, rewritten) : node;\n };"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":34,"symbol":"h","kind":"constant","lang":"typescript","doc":"A union of handlers isn't callable with one argument; handler `K` only ever sees kind `K`.","code":"const h = (fnOrHandlers as VisitHandlers)[node._zod.def.type] as\n | ((n: AnyZod, rewritten: boolean) => AnyZod)\n | undefined;"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":40,"symbol":"cache","kind":"constant","lang":"typescript","code":"const cache = new Map<AnyZod, AnyZod | Resolving>();"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":42,"symbol":"run","kind":"function","lang":"typescript","code":"function run(s: AnyZod): AnyZod {\n const cached = cache.get(s);\n if (cached === RESOLVING) {\n // Non-lazy cycle. Defer to parse time, when the cache holds the finished node.\n return new schemas.$ZodLazy({\n type: \"lazy\",\n getter: () => cache.get(s) as AnyZod,\n });\n }\n if (cached !== undefined) return cached;\n cache.set(s, RESOLVING);\n const inner = mapInner(s);\n const mapped = fn(inner, inner !== s);\n cache.set(s, mapped);\n return mapped;\n }"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":43,"symbol":"cached","kind":"constant","lang":"typescript","code":"const cached = cache.get(s);"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":53,"symbol":"inner","kind":"constant","lang":"typescript","code":"const inner = mapInner(s);"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":54,"symbol":"mapped","kind":"constant","lang":"typescript","code":"const mapped = fn(inner, inner !== s);"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":59,"symbol":"mapInner","kind":"function","lang":"typescript","code":"function mapInner(s: AnyZod): AnyZod {\n const def = s._zod.def as any;\n const kind = def.type as Kind;\n switch (kind) {\n case \"object\": {\n const oldShape = def.shape as Record<string, AnyZod>;\n const keys = Object.keys(oldShape);\n let changed = false;\n const newShape: Record<string, AnyZod> = {};\n for (const k of keys) {\n const mapped = run(oldShape[k]!);\n if (mapped !== oldShape[k]) changed = true;\n newShape[k] = mapped;\n }\n let newCatchall = def.catchall;\n if (def.catchall) {\n newCatchall = run(def.catchall);\n if (newCatchall !== def.catchall) changed = true;\n }\n return changed ? clone(s, { ...def, shape: newShape, catchall: newCatchall }) : s;\n }\n case \"array\": {\n const mapped = run(def.element);\n return mapped === def.element ? s : clone(s, { ...def, element: mapped });\n }\n case \"tuple\": {\n const oldItems = def.items as AnyZod[];\n let changed = false;\n const newItems: AnyZod[] = [];\n for (const item of oldItems) {\n const mapped = run(item);\n if (mapped !== item) changed = "} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":60,"symbol":"def","kind":"constant","lang":"typescript","code":"const def = s._zod.def as any;"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":61,"symbol":"kind","kind":"constant","lang":"typescript","code":"const kind = def.type as Kind;"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":64,"symbol":"oldShape","kind":"constant","lang":"typescript","code":"const oldShape = def.shape as Record<string, AnyZod>;"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":65,"symbol":"keys","kind":"constant","lang":"typescript","code":"const keys = Object.keys(oldShape);"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":67,"symbol":"newShape","kind":"constant","lang":"typescript","code":"const newShape: Record<string, AnyZod> = {};"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":69,"symbol":"mapped","kind":"constant","lang":"typescript","code":"const mapped = run(oldShape[k]!);"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":81,"symbol":"mapped","kind":"constant","lang":"typescript","code":"const mapped = run(def.element);"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":85,"symbol":"oldItems","kind":"constant","lang":"typescript","code":"const oldItems = def.items as AnyZod[];"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":87,"symbol":"newItems","kind":"constant","lang":"typescript","code":"const newItems: AnyZod[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":89,"symbol":"mapped","kind":"constant","lang":"typescript","code":"const mapped = run(item);"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":102,"symbol":"newKey","kind":"constant","lang":"typescript","code":"const newKey = run(def.keyType);"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":103,"symbol":"newVal","kind":"constant","lang":"typescript","code":"const newVal = run(def.valueType);"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":109,"symbol":"newVal","kind":"constant","lang":"typescript","code":"const newVal = run(def.valueType);"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":113,"symbol":"oldOptions","kind":"constant","lang":"typescript","code":"const oldOptions = def.options as AnyZod[];"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":115,"symbol":"newOptions","kind":"constant","lang":"typescript","code":"const newOptions: AnyZod[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":117,"symbol":"mapped","kind":"constant","lang":"typescript","code":"const mapped = run(opt);"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":124,"symbol":"newLeft","kind":"constant","lang":"typescript","code":"const newLeft = run(def.left);"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":125,"symbol":"newRight","kind":"constant","lang":"typescript","code":"const newRight = run(def.right);"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":139,"symbol":"newInner","kind":"constant","lang":"typescript","code":"const newInner = run(def.innerType);"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":143,"symbol":"newIn","kind":"constant","lang":"typescript","code":"const newIn = run(def.in);"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":144,"symbol":"newOut","kind":"constant","lang":"typescript","code":"const newOut = run(def.out);"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":148,"symbol":"newInput","kind":"constant","lang":"typescript","code":"const newInput = run(def.input);"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":149,"symbol":"newOutput","kind":"constant","lang":"typescript","code":"const newOutput = run(def.output);"} {"repo":"zod","file":"packages/zod/src/v4/core/visit.ts","line":156,"symbol":"original","kind":"constant","lang":"typescript","doc":"Invoking the getter here would trip the cycle check, so lazy nodes always re-clone.","code":"const original = def.getter as () => AnyZod;"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":5,"symbol":"$ZSF","kind":"interface","lang":"typescript","code":"interface $ZSF {\n $zsf: { version: number };\n type: string;\n // default value if not defined\n default: unknown;\n // fallback value if validation fails\n fallback: unknown;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":14,"symbol":"$ZSFString","kind":"interface","lang":"typescript","code":"interface $ZSFString extends $ZSF {\n type: \"string\";\n min_length?: number;\n max_length?: number;\n pattern?: string;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":21,"symbol":"NumberTypes","kind":"type","lang":"typescript","code":"type NumberTypes = \"float32\" | \"int32\" | \"uint32\" | \"float64\" | \"int64\" | \"uint64\" | \"bigint\" | \"bigdecimal\";"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":23,"symbol":"$ZSFNumber","kind":"interface","lang":"typescript","code":"interface $ZSFNumber extends $ZSF {\n type: \"number\";\n format?: NumberTypes;\n minimum?: number;\n maximum?: number;\n multiple_of?: number;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":31,"symbol":"$ZSFBoolean","kind":"interface","lang":"typescript","code":"interface $ZSFBoolean extends $ZSF {\n type: \"boolean\";\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":35,"symbol":"$ZSFNull","kind":"interface","lang":"typescript","code":"interface $ZSFNull extends $ZSF {\n type: \"null\";\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":39,"symbol":"$ZSFUndefined","kind":"interface","lang":"typescript","code":"interface $ZSFUndefined extends $ZSF {\n type: \"undefined\";\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":43,"symbol":"$ZSFOptional","kind":"interface","lang":"typescript","code":"interface $ZSFOptional<T extends $ZSF = $ZSF> extends $ZSF {\n type: \"optional\";\n inner: T;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":48,"symbol":"$ZSFNever","kind":"interface","lang":"typescript","code":"interface $ZSFNever extends $ZSF {\n type: \"never\";\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":52,"symbol":"$ZSFAny","kind":"interface","lang":"typescript","code":"interface $ZSFAny extends $ZSF {\n type: \"any\";\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":57,"symbol":"$ZSFEnum","kind":"interface","lang":"typescript","doc":"Supports","code":"interface $ZSFEnum<Elements extends { [k: string]: $ZSFLiteral } = { [k: string]: $ZSFLiteral }> extends $ZSF {\n type: \"enum\";\n elements: Elements;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":62,"symbol":"$ZSFArray","kind":"interface","lang":"typescript","code":"interface $ZSFArray<PrefixItems extends $ZSF[] = $ZSF[], Items extends $ZSF = $ZSF> extends $ZSF {\n type: \"array\";\n prefixItems: PrefixItems;\n items: Items;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":69,"symbol":"$ZSFObjectProperties","kind":"type","lang":"typescript","doc":"type $ZSFObjectProperties = { [k: string]: $ZSF };","code":"type $ZSFObjectProperties = Array<{\n key: string;\n value: $ZSF;\n format?: \"literal\" | \"pattern\";\n ordering?: number;\n}>;"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":75,"symbol":"$ZSFObject","kind":"interface","lang":"typescript","code":"interface $ZSFObject<Properties extends $ZSFObjectProperties = $ZSFObjectProperties> extends $ZSF {\n type: \"object\";\n properties: Properties;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":90,"symbol":"$ZSFLiteral","kind":"interface","lang":"typescript","doc":"Supports arbitrary literal values","code":"interface $ZSFLiteral<T extends $ZSF = $ZSF> extends $ZSF {\n type: \"literal\";\n schema: T;\n value: unknown;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":96,"symbol":"$ZSFUnion","kind":"interface","lang":"typescript","code":"interface $ZSFUnion<Elements extends $ZSF[] = $ZSF[]> extends $ZSF {\n type: \"union\";\n elements: Elements;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":101,"symbol":"$ZSFIntersection","kind":"interface","lang":"typescript","code":"interface $ZSFIntersection extends $ZSF {\n type: \"intersection\";\n elements: $ZSF[];\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":106,"symbol":"$ZSFMap","kind":"interface","lang":"typescript","code":"interface $ZSFMap<K extends $ZSF = $ZSF, V extends $ZSF = $ZSF> extends $ZSF {\n type: \"map\";\n keys: K;\n values: V;\n}"} {"repo":"zod","file":"packages/zod/src/v4/core/zsf.ts","line":112,"symbol":"$ZSFConditional","kind":"interface","lang":"typescript","code":"interface $ZSFConditional<If extends $ZSF, Then extends $ZSF, Else extends $ZSF> extends $ZSF {\n type: \"conditional\";\n if: If;\n then: Then;\n else: Else;\n}"} {"repo":"zod","file":"packages/zod/src/v4/locales/ar.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"حرف\", verb: \"أن يحوي\" },\n file: { unit: \"بايت\", verb: \"أن يحوي\" },\n array: { unit: \"عنصر\", verb: \"أن يحوي\" },\n set: { unit: \"عنصر\", verb: \"أن يحوي\" },\n map: { unit: \"عنصر\", verb: \"أن يحوي\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"مدخل\",\n email: \"بريد إلكتروني\",\n url: \"رابط\",\n emoji: \"إيموجي\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"تاريخ ووقت بمعيار ISO\",\n date: \"تاريخ بمعيار ISO\",\n time: \"وقت بمعيار ISO\",\n duration: \"مدة بمعيار ISO\",\n ipv4: \"عنوان IPv4\",\n ipv6: \"عنوان IPv6\",\n mac: \"عنوان MAC\",\n cidrv4: \"مدى عناوين بصيغة IPv4\",\n cidrv6: \"مدى عناوين بصيغة IPv6\",\n base64: \"نَص بترميز base64-encoded\",\n base64url: \"نَص بترميز base64url-encoded\",\n "} {"repo":"zod","file":"packages/zod/src/v4/locales/ar.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"حرف\", verb: \"أن يحوي\" },\n file: { unit: \"بايت\", verb: \"أن يحوي\" },\n array: { unit: \"عنصر\", verb: \"أن يحوي\" },\n set: { unit: \"عنصر\", verb: \"أن يحوي\" },\n map: { unit: \"عنصر\", verb: \"أن يحوي\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ar.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/ar.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"مدخل\",\n email: \"بريد إلكتروني\",\n url: \"رابط\",\n emoji: \"إيموجي\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"تاريخ ووقت بمعيار ISO\",\n date: \"تاريخ بمعيار ISO\",\n time: \"وقت بمعيار ISO\",\n duration: \"مدة بمعيار ISO\",\n ipv4: \"عنوان IPv4\",\n ipv6: \"عنوان IPv6\",\n mac: \"عنوان MAC\",\n cidrv4: \"مدى عناوين بصيغة IPv4\",\n cidrv6: \"مدى عناوين بصيغة IPv6\",\n base64: \"نَص بترميز base64-encoded\",\n base64url: \"نَص بترميز base64url-encoded\",\n json_string: \"نَص على هيئة JSON\",\n e164: \"رقم هاتف بمعيار E.164\",\n credit_card: \"رقم بطاقة الائتمان\",\n currency_code: \"رمز العملة\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"مدخل\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ar.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ar.ts","line":64,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ar.ts","line":65,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ar.ts","line":66,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ar.ts","line":77,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ar.ts","line":78,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ar.ts","line":84,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ar.ts","line":85,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ar.ts","line":93,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/az.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"simvol\", verb: \"olmalıdır\" },\n file: { unit: \"bayt\", verb: \"olmalıdır\" },\n array: { unit: \"element\", verb: \"olmalıdır\" },\n set: { unit: \"element\", verb: \"olmalıdır\" },\n map: { unit: \"element\", verb: \"olmalıdır\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"input\",\n email: \"email address\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO datetime\",\n date: \"ISO date\",\n time: \"ISO time\",\n duration: \"ISO duration\",\n ipv4: \"IPv4 address\",\n ipv6: \"IPv6 address\",\n mac: \"MAC address\",\n cidrv4: \"IPv4 range\",\n cidrv6: \"IPv6 range\",\n base64: \"base64-encoded string\",\n base64url: \"base64url-encoded string\",\n json_string: \"JSON string\""} {"repo":"zod","file":"packages/zod/src/v4/locales/az.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"simvol\", verb: \"olmalıdır\" },\n file: { unit: \"bayt\", verb: \"olmalıdır\" },\n array: { unit: \"element\", verb: \"olmalıdır\" },\n set: { unit: \"element\", verb: \"olmalıdır\" },\n map: { unit: \"element\", verb: \"olmalıdır\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/az.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/az.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"input\",\n email: \"email address\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO datetime\",\n date: \"ISO date\",\n time: \"ISO time\",\n duration: \"ISO duration\",\n ipv4: \"IPv4 address\",\n ipv6: \"IPv6 address\",\n mac: \"MAC address\",\n cidrv4: \"IPv4 range\",\n cidrv6: \"IPv6 range\",\n base64: \"base64-encoded string\",\n base64url: \"base64url-encoded string\",\n json_string: \"JSON string\",\n e164: \"E.164 number\",\n credit_card: \"kredit kartı nömrəsi\",\n currency_code: \"valyuta kodu\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"input\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/az.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/az.ts","line":64,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/az.ts","line":65,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/az.ts","line":66,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/az.ts","line":76,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/az.ts","line":77,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/az.ts","line":83,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/az.ts","line":84,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/az.ts","line":89,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":5,"symbol":"getBelarusianPlural","kind":"function","lang":"typescript","code":"function getBelarusianPlural(count: number, one: string, few: string, many: string): string {\n const absCount = Math.abs(count);\n const lastDigit = absCount % 10;\n const lastTwoDigits = absCount % 100;\n\n if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {\n return many;\n }\n\n if (lastDigit === 1) {\n return one;\n }\n\n if (lastDigit >= 2 && lastDigit <= 4) {\n return few;\n }\n\n return many;\n}"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":6,"symbol":"absCount","kind":"constant","lang":"typescript","code":"const absCount = Math.abs(count);"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":7,"symbol":"lastDigit","kind":"constant","lang":"typescript","code":"const lastDigit = absCount % 10;"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":8,"symbol":"lastTwoDigits","kind":"constant","lang":"typescript","code":"const lastTwoDigits = absCount % 100;"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":25,"symbol":"BelarusianSizable","kind":"interface","lang":"typescript","code":"interface BelarusianSizable {\n unit: {\n one: string;\n few: string;\n many: string;\n };\n verb: string;\n}"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":33,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, BelarusianSizable> = {\n string: {\n unit: {\n one: \"сімвал\",\n few: \"сімвалы\",\n many: \"сімвалаў\",\n },\n verb: \"мець\",\n },\n array: {\n unit: {\n one: \"элемент\",\n few: \"элементы\",\n many: \"элементаў\",\n },\n verb: \"мець\",\n },\n set: {\n unit: {\n one: \"элемент\",\n few: \"элементы\",\n many: \"элементаў\",\n },\n verb: \"мець\",\n },\n map: {\n unit: {\n one: \"элемент\",\n few: \"элементы\",\n many: \"элементаў\",\n },\n verb: \"мець\",\n },\n file: {\n unit: {\n one: \"байт\",\n few: \"байты\",\n many: \"байтаў\",\n },\n verb: \"мець\",\n },\n };\n\n function getSizing(origin: string): BelarusianSizable | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"увод\",\n email: \"email адрас\",\n url: \"URL\",\n emoji: \"эмодзі\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \""} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":34,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, BelarusianSizable> = {\n string: {\n unit: {\n one: \"сімвал\",\n few: \"сімвалы\",\n many: \"сімвалаў\",\n },\n verb: \"мець\",\n },\n array: {\n unit: {\n one: \"элемент\",\n few: \"элементы\",\n many: \"элементаў\",\n },\n verb: \"мець\",\n },\n set: {\n unit: {\n one: \"элемент\",\n few: \"элементы\",\n many: \"элементаў\",\n },\n verb: \"мець\",\n },\n map: {\n unit: {\n one: \"элемент\",\n few: \"элементы\",\n many: \"элементаў\",\n },\n verb: \"мець\",\n },\n file: {\n unit: {\n one: \"байт\",\n few: \"байты\",\n many: \"байтаў\",\n },\n verb: \"мець\",\n },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":77,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): BelarusianSizable | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":81,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"увод\",\n email: \"email адрас\",\n url: \"URL\",\n emoji: \"эмодзі\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO дата і час\",\n date: \"ISO дата\",\n time: \"ISO час\",\n duration: \"ISO працягласць\",\n ipv4: \"IPv4 адрас\",\n ipv6: \"IPv6 адрас\",\n mac: \"MAC адрас\",\n cidrv4: \"IPv4 дыяпазон\",\n cidrv6: \"IPv6 дыяпазон\",\n base64: \"радок у фармаце base64\",\n base64url: \"радок у фармаце base64url\",\n json_string: \"JSON радок\",\n e164: \"нумар E.164\",\n credit_card: \"нумар крэдытнай карты\",\n currency_code: \"код валюты\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"увод\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":118,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"лік\",\n array: \"масіў\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":129,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":130,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":131,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":141,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":142,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":144,"symbol":"maxValue","kind":"constant","lang":"typescript","code":"const maxValue = Number(issue.maximum);"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":145,"symbol":"unit","kind":"constant","lang":"typescript","code":"const unit = getBelarusianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":151,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":152,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":154,"symbol":"minValue","kind":"constant","lang":"typescript","code":"const minValue = Number(issue.minimum);"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":155,"symbol":"unit","kind":"constant","lang":"typescript","code":"const unit = getBelarusianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);"} {"repo":"zod","file":"packages/zod/src/v4/locales/be.ts","line":161,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/bg.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"символа\", verb: \"да съдържа\" },\n file: { unit: \"байта\", verb: \"да съдържа\" },\n array: { unit: \"елемента\", verb: \"да съдържа\" },\n set: { unit: \"елемента\", verb: \"да съдържа\" },\n map: { unit: \"елемента\", verb: \"да съдържа\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"вход\",\n email: \"имейл адрес\",\n url: \"URL\",\n emoji: \"емоджи\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO време\",\n date: \"ISO дата\",\n time: \"ISO време\",\n duration: \"ISO продължителност\",\n ipv4: \"IPv4 адрес\",\n ipv6: \"IPv6 адрес\",\n mac: \"MAC адрес\",\n cidrv4: \"IPv4 диапазон\",\n cidrv6: \"IPv6 диапазон\",\n base64: \"base64-кодиран низ\",\n base64url: \"base64url-кодиран низ\",\n json_string: \"JSON "} {"repo":"zod","file":"packages/zod/src/v4/locales/bg.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"символа\", verb: \"да съдържа\" },\n file: { unit: \"байта\", verb: \"да съдържа\" },\n array: { unit: \"елемента\", verb: \"да съдържа\" },\n set: { unit: \"елемента\", verb: \"да съдържа\" },\n map: { unit: \"елемента\", verb: \"да съдържа\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/bg.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/bg.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"вход\",\n email: \"имейл адрес\",\n url: \"URL\",\n emoji: \"емоджи\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO време\",\n date: \"ISO дата\",\n time: \"ISO време\",\n duration: \"ISO продължителност\",\n ipv4: \"IPv4 адрес\",\n ipv6: \"IPv6 адрес\",\n mac: \"MAC адрес\",\n cidrv4: \"IPv4 диапазон\",\n cidrv6: \"IPv6 диапазон\",\n base64: \"base64-кодиран низ\",\n base64url: \"base64url-кодиран низ\",\n json_string: \"JSON низ\",\n e164: \"E.164 номер\",\n credit_card: \"номер на кредитна карта\",\n currency_code: \"код на валута\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"вход\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/bg.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"число\",\n array: \"масив\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/bg.ts","line":66,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/bg.ts","line":67,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/bg.ts","line":68,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/bg.ts","line":79,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/bg.ts","line":80,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/bg.ts","line":86,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/bg.ts","line":87,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/bg.ts","line":95,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/bn.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"অক্ষর\", verb: \"থাকতে হবে\" },\n file: { unit: \"বাইট\", verb: \"থাকতে হবে\" },\n array: { unit: \"আইটেম\", verb: \"থাকতে হবে\" },\n set: { unit: \"আইটেম\", verb: \"থাকতে হবে\" },\n map: { unit: \"এন্ট্রি\", verb: \"থাকতে হবে\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ইনপুট\",\n email: \"ইমেইল ঠিকানা\",\n url: \"URL\",\n emoji: \"ইমোজি\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO তারিখ ও সময়\",\n date: \"ISO তারিখ\",\n time: \"ISO সময়\",\n duration: \"ISO সময়কাল\",\n ipv4: \"IPv4 ঠিকানা\",\n ipv6: \"IPv6 ঠিকানা\",\n mac: \"MAC ঠিকানা\",\n cidrv4: \"IPv4 রেঞ্জ\",\n cidrv6: \"IPv6 রেঞ্জ\",\n base64: \"base64-এনকোডেড স্ট্রিং\",\n base64url: \"base64url-এনকোডেড স্ট্রিং\",\n json_string: \"JSON স্ট্রিং\",\n"} {"repo":"zod","file":"packages/zod/src/v4/locales/bn.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"অক্ষর\", verb: \"থাকতে হবে\" },\n file: { unit: \"বাইট\", verb: \"থাকতে হবে\" },\n array: { unit: \"আইটেম\", verb: \"থাকতে হবে\" },\n set: { unit: \"আইটেম\", verb: \"থাকতে হবে\" },\n map: { unit: \"এন্ট্রি\", verb: \"থাকতে হবে\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/bn.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/bn.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ইনপুট\",\n email: \"ইমেইল ঠিকানা\",\n url: \"URL\",\n emoji: \"ইমোজি\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO তারিখ ও সময়\",\n date: \"ISO তারিখ\",\n time: \"ISO সময়\",\n duration: \"ISO সময়কাল\",\n ipv4: \"IPv4 ঠিকানা\",\n ipv6: \"IPv6 ঠিকানা\",\n mac: \"MAC ঠিকানা\",\n cidrv4: \"IPv4 রেঞ্জ\",\n cidrv6: \"IPv6 রেঞ্জ\",\n base64: \"base64-এনকোডেড স্ট্রিং\",\n base64url: \"base64url-এনকোডেড স্ট্রিং\",\n json_string: \"JSON স্ট্রিং\",\n e164: \"E.164 নম্বর\",\n credit_card: \"ক্রেডিট কার্ড নম্বর\",\n currency_code: \"মুদ্রা কোড\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"ইনপুট\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/bn.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/bn.ts","line":64,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/bn.ts","line":65,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/bn.ts","line":66,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/bn.ts","line":74,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/bn.ts","line":75,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/bn.ts","line":81,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/bn.ts","line":82,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/bn.ts","line":90,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/bn.ts","line":107,"symbol":"opts","kind":"constant","lang":"typescript","code":"const opts = issue.options.map((o) => `'${o}'`).join(\" | \");"} {"repo":"zod","file":"packages/zod/src/v4/locales/ca.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"caràcters\", verb: \"contenir\" },\n file: { unit: \"bytes\", verb: \"contenir\" },\n array: { unit: \"elements\", verb: \"contenir\" },\n set: { unit: \"elements\", verb: \"contenir\" },\n map: { unit: \"elements\", verb: \"contenir\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"entrada\",\n email: \"adreça electrònica\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"data i hora ISO\",\n date: \"data ISO\",\n time: \"hora ISO\",\n duration: \"durada ISO\",\n ipv4: \"adreça IPv4\",\n ipv6: \"adreça IPv6\",\n mac: \"adreça MAC\",\n cidrv4: \"rang IPv4\",\n cidrv6: \"rang IPv6\",\n base64: \"cadena codificada en base64\",\n base64url: \"cadena codificada en base64url\",\n json_stri"} {"repo":"zod","file":"packages/zod/src/v4/locales/ca.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"caràcters\", verb: \"contenir\" },\n file: { unit: \"bytes\", verb: \"contenir\" },\n array: { unit: \"elements\", verb: \"contenir\" },\n set: { unit: \"elements\", verb: \"contenir\" },\n map: { unit: \"elements\", verb: \"contenir\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ca.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/ca.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"entrada\",\n email: \"adreça electrònica\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"data i hora ISO\",\n date: \"data ISO\",\n time: \"hora ISO\",\n duration: \"durada ISO\",\n ipv4: \"adreça IPv4\",\n ipv6: \"adreça IPv6\",\n mac: \"adreça MAC\",\n cidrv4: \"rang IPv4\",\n cidrv6: \"rang IPv6\",\n base64: \"cadena codificada en base64\",\n base64url: \"cadena codificada en base64url\",\n json_string: \"cadena JSON\",\n e164: \"número E.164\",\n credit_card: \"número de targeta de crèdit\",\n currency_code: \"codi de moneda\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"entrada\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ca.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ca.ts","line":64,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ca.ts","line":65,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ca.ts","line":66,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ca.ts","line":76,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"com a màxim\" : \"menys de\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ca.ts","line":77,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ca.ts","line":83,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"com a mínim\" : \"més de\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ca.ts","line":84,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ca.ts","line":92,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ckb.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"پیت\", verb: \"بێت\" },\n file: { unit: \"بایت\", verb: \"بێت\" },\n array: { unit: \"دانە\", verb: \"بێت\" },\n set: { unit: \"دانە\", verb: \"بێت\" },\n map: { unit: \"دانە\", verb: \"بێت\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"regex\",\n email: \"ئیمەیڵ\",\n url: \"بەستەر (URL)\",\n emoji: \"ئیمۆجی\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ڕێکەوت و کات\",\n date: \"ڕێکەوت\",\n time: \"کات\",\n duration: \"ماوە\",\n ipv4: \"ناونیشانی IPv4\",\n ipv6: \"ناونیشانی IPv6\",\n mac: \"ناونیشانی MAC\",\n cidrv4: \"مەودای IPv4\",\n cidrv6: \"مەودای IPv6\",\n base64: \"دەقی base64\",\n base64url: \"دەقی base64url\",\n json_string: \"دەقی JSON\",\n e164: \"ژمارەی E.164\",\n credit_card: \"ژمارەی کارتی کرێدیت\",\n"} {"repo":"zod","file":"packages/zod/src/v4/locales/ckb.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"پیت\", verb: \"بێت\" },\n file: { unit: \"بایت\", verb: \"بێت\" },\n array: { unit: \"دانە\", verb: \"بێت\" },\n set: { unit: \"دانە\", verb: \"بێت\" },\n map: { unit: \"دانە\", verb: \"بێت\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ckb.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/ckb.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"regex\",\n email: \"ئیمەیڵ\",\n url: \"بەستەر (URL)\",\n emoji: \"ئیمۆجی\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ڕێکەوت و کات\",\n date: \"ڕێکەوت\",\n time: \"کات\",\n duration: \"ماوە\",\n ipv4: \"ناونیشانی IPv4\",\n ipv6: \"ناونیشانی IPv6\",\n mac: \"ناونیشانی MAC\",\n cidrv4: \"مەودای IPv4\",\n cidrv6: \"مەودای IPv6\",\n base64: \"دەقی base64\",\n base64url: \"دەقی base64url\",\n json_string: \"دەقی JSON\",\n e164: \"ژمارەی E.164\",\n credit_card: \"ژمارەی کارتی کرێدیت\",\n currency_code: \"کۆدی دراو\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"تێکردە\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ckb.ts","line":56,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","doc":"type names: missing keys = do not translate (use raw value via ?? fallback)","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n string: \"نووسین\",\n number: \"ژمارە\",\n boolean: \"boolean\",\n array: \"array\",\n object: \"object\",\n date: \"ڕێکەوت\",\n integer: \"ژمارە\",\n float: \"ژمارە\",\n null: \"null\",\n undefined: \"undefined\",\n function: \"function\",\n symbol: \"symbol\",\n unknown: \"unknown\",\n promise: \"promise\",\n void: \"void\",\n never: \"never\",\n map: \"map\",\n set: \"set\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ckb.ts","line":83,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ckb.ts","line":84,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ckb.ts","line":85,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ckb.ts","line":86,"symbol":"postfix","kind":"constant","lang":"typescript","code":"const postfix = [\"ا\", \"و\", \"ۆ\", \"وو\", \"ە\", \"ی\", \"ێ\"].some((p) => received.endsWith(p)) ? \"یە\" : \"ە\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ckb.ts","line":87,"symbol":"isEnglish","kind":"constant","lang":"typescript","code":"const isEnglish = /^[a-zA-Z]+$/.test(received);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ckb.ts","line":97,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ckb.ts","line":102,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ckb.ts","line":107,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ckb.ts","line":124,"symbol":"opts","kind":"constant","lang":"typescript","code":"const opts = issue.options.map((o) => `'${o}'`).join(\" | \");"} {"repo":"zod","file":"packages/zod/src/v4/locales/cs.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"znaků\", verb: \"mít\" },\n file: { unit: \"bajtů\", verb: \"mít\" },\n array: { unit: \"prvků\", verb: \"mít\" },\n set: { unit: \"prvků\", verb: \"mít\" },\n map: { unit: \"prvků\", verb: \"mít\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"regulární výraz\",\n email: \"e-mailová adresa\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"datum a čas ve formátu ISO\",\n date: \"datum ve formátu ISO\",\n time: \"čas ve formátu ISO\",\n duration: \"doba trvání ISO\",\n ipv4: \"IPv4 adresa\",\n ipv6: \"IPv6 adresa\",\n mac: \"MAC adresa\",\n cidrv4: \"rozsah IPv4\",\n cidrv6: \"rozsah IPv6\",\n base64: \"řetězec zakódovaný ve formátu base64\",\n base64url: \"řetězec zakódovaný ve formá"} {"repo":"zod","file":"packages/zod/src/v4/locales/cs.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"znaků\", verb: \"mít\" },\n file: { unit: \"bajtů\", verb: \"mít\" },\n array: { unit: \"prvků\", verb: \"mít\" },\n set: { unit: \"prvků\", verb: \"mít\" },\n map: { unit: \"prvků\", verb: \"mít\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/cs.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/cs.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"regulární výraz\",\n email: \"e-mailová adresa\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"datum a čas ve formátu ISO\",\n date: \"datum ve formátu ISO\",\n time: \"čas ve formátu ISO\",\n duration: \"doba trvání ISO\",\n ipv4: \"IPv4 adresa\",\n ipv6: \"IPv6 adresa\",\n mac: \"MAC adresa\",\n cidrv4: \"rozsah IPv4\",\n cidrv6: \"rozsah IPv6\",\n base64: \"řetězec zakódovaný ve formátu base64\",\n base64url: \"řetězec zakódovaný ve formátu base64url\",\n json_string: \"řetězec ve formátu JSON\",\n e164: \"číslo E.164\",\n credit_card: \"číslo kreditní karty\",\n currency_code: \"kód měny\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"vstup\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/cs.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"číslo\",\n string: \"řetězec\",\n function: \"funkce\",\n array: \"pole\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/cs.ts","line":68,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/cs.ts","line":69,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/cs.ts","line":70,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/cs.ts","line":80,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/cs.ts","line":81,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/cs.ts","line":88,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/cs.ts","line":89,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/cs.ts","line":96,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/da.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"tegn\", verb: \"havde\" },\n file: { unit: \"bytes\", verb: \"havde\" },\n array: { unit: \"elementer\", verb: \"indeholdt\" },\n set: { unit: \"elementer\", verb: \"indeholdt\" },\n map: { unit: \"elementer\", verb: \"indeholdt\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"input\",\n email: \"e-mailadresse\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO dato- og klokkeslæt\",\n date: \"ISO-dato\",\n time: \"ISO-klokkeslæt\",\n duration: \"ISO-varighed\",\n ipv4: \"IPv4-adresse\",\n ipv6: \"IPv6-adresse\",\n mac: \"MAC-adresse\",\n cidrv4: \"IPv4-spektrum\",\n cidrv6: \"IPv6-spektrum\",\n base64: \"base64-kodet streng\",\n base64url: \"base64url-kodet streng\",\n json_strin"} {"repo":"zod","file":"packages/zod/src/v4/locales/da.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"tegn\", verb: \"havde\" },\n file: { unit: \"bytes\", verb: \"havde\" },\n array: { unit: \"elementer\", verb: \"indeholdt\" },\n set: { unit: \"elementer\", verb: \"indeholdt\" },\n map: { unit: \"elementer\", verb: \"indeholdt\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/da.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/da.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"input\",\n email: \"e-mailadresse\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO dato- og klokkeslæt\",\n date: \"ISO-dato\",\n time: \"ISO-klokkeslæt\",\n duration: \"ISO-varighed\",\n ipv4: \"IPv4-adresse\",\n ipv6: \"IPv6-adresse\",\n mac: \"MAC-adresse\",\n cidrv4: \"IPv4-spektrum\",\n cidrv6: \"IPv6-spektrum\",\n base64: \"base64-kodet streng\",\n base64url: \"base64url-kodet streng\",\n json_string: \"JSON-streng\",\n e164: \"E.164-nummer\",\n credit_card: \"kreditkortnummer\",\n currency_code: \"valutakode\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"input\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/da.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n string: \"streng\",\n number: \"tal\",\n boolean: \"boolean\",\n array: \"liste\",\n object: \"objekt\",\n set: \"sæt\",\n file: \"fil\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/da.ts","line":71,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/da.ts","line":72,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/da.ts","line":73,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/da.ts","line":83,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/da.ts","line":84,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/da.ts","line":85,"symbol":"origin","kind":"constant","lang":"typescript","code":"const origin = TypeDictionary[issue.origin] ?? issue.origin;"} {"repo":"zod","file":"packages/zod/src/v4/locales/da.ts","line":91,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/da.ts","line":92,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/da.ts","line":93,"symbol":"origin","kind":"constant","lang":"typescript","code":"const origin = TypeDictionary[issue.origin] ?? issue.origin;"} {"repo":"zod","file":"packages/zod/src/v4/locales/da.ts","line":101,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/de.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"Zeichen\", verb: \"zu haben\" },\n file: { unit: \"Bytes\", verb: \"zu haben\" },\n array: { unit: \"Elemente\", verb: \"zu haben\" },\n set: { unit: \"Elemente\", verb: \"zu haben\" },\n map: { unit: \"Elemente\", verb: \"zu haben\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"Eingabe\",\n email: \"E-Mail-Adresse\",\n url: \"URL\",\n emoji: \"Emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO-Datum und -Uhrzeit\",\n date: \"ISO-Datum\",\n time: \"ISO-Uhrzeit\",\n duration: \"ISO-Dauer\",\n ipv4: \"IPv4-Adresse\",\n ipv6: \"IPv6-Adresse\",\n mac: \"MAC-Adresse\",\n cidrv4: \"IPv4-Bereich\",\n cidrv6: \"IPv6-Bereich\",\n base64: \"Base64-codierter String\",\n base64url: \"Base64-URL-codierter String\",\n jso"} {"repo":"zod","file":"packages/zod/src/v4/locales/de.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"Zeichen\", verb: \"zu haben\" },\n file: { unit: \"Bytes\", verb: \"zu haben\" },\n array: { unit: \"Elemente\", verb: \"zu haben\" },\n set: { unit: \"Elemente\", verb: \"zu haben\" },\n map: { unit: \"Elemente\", verb: \"zu haben\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/de.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/de.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"Eingabe\",\n email: \"E-Mail-Adresse\",\n url: \"URL\",\n emoji: \"Emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO-Datum und -Uhrzeit\",\n date: \"ISO-Datum\",\n time: \"ISO-Uhrzeit\",\n duration: \"ISO-Dauer\",\n ipv4: \"IPv4-Adresse\",\n ipv6: \"IPv6-Adresse\",\n mac: \"MAC-Adresse\",\n cidrv4: \"IPv4-Bereich\",\n cidrv6: \"IPv6-Bereich\",\n base64: \"Base64-codierter String\",\n base64url: \"Base64-URL-codierter String\",\n json_string: \"JSON-String\",\n e164: \"E.164-Nummer\",\n credit_card: \"Kreditkartennummer\",\n currency_code: \"Währungscode\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"Eingabe\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/de.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"Zahl\",\n array: \"Array\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/de.ts","line":66,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/de.ts","line":67,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/de.ts","line":68,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/de.ts","line":78,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/de.ts","line":79,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/de.ts","line":85,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/de.ts","line":86,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/de.ts","line":94,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/el.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"χαρακτήρες\", verb: \"να έχει\" },\n file: { unit: \"bytes\", verb: \"να έχει\" },\n array: { unit: \"στοιχεία\", verb: \"να έχει\" },\n set: { unit: \"στοιχεία\", verb: \"να έχει\" },\n map: { unit: \"καταχωρήσεις\", verb: \"να έχει\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"είσοδος\",\n email: \"διεύθυνση email\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO ημερομηνία και ώρα\",\n date: \"ISO ημερομηνία\",\n time: \"ISO ώρα\",\n duration: \"ISO διάρκεια\",\n ipv4: \"διεύθυνση IPv4\",\n ipv6: \"διεύθυνση IPv6\",\n mac: \"διεύθυνση MAC\",\n cidrv4: \"εύρος IPv4\",\n cidrv6: \"εύρος IPv6\",\n base64: \"συμβολοσειρά κωδικοποιημένη σε base64\",\n base64url: \"συμβολοσειρά κ"} {"repo":"zod","file":"packages/zod/src/v4/locales/el.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"χαρακτήρες\", verb: \"να έχει\" },\n file: { unit: \"bytes\", verb: \"να έχει\" },\n array: { unit: \"στοιχεία\", verb: \"να έχει\" },\n set: { unit: \"στοιχεία\", verb: \"να έχει\" },\n map: { unit: \"καταχωρήσεις\", verb: \"να έχει\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/el.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/el.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"είσοδος\",\n email: \"διεύθυνση email\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO ημερομηνία και ώρα\",\n date: \"ISO ημερομηνία\",\n time: \"ISO ώρα\",\n duration: \"ISO διάρκεια\",\n ipv4: \"διεύθυνση IPv4\",\n ipv6: \"διεύθυνση IPv6\",\n mac: \"διεύθυνση MAC\",\n cidrv4: \"εύρος IPv4\",\n cidrv6: \"εύρος IPv6\",\n base64: \"συμβολοσειρά κωδικοποιημένη σε base64\",\n base64url: \"συμβολοσειρά κωδικοποιημένη σε base64url\",\n json_string: \"συμβολοσειρά JSON\",\n e164: \"αριθμός E.164\",\n credit_card: \"αριθμός πιστωτικής κάρτας\",\n currency_code: \"κωδικός νομίσματος\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"είσοδος\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/el.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/el.ts","line":64,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/el.ts","line":65,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/el.ts","line":66,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/el.ts","line":78,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/el.ts","line":79,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/el.ts","line":85,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/el.ts","line":86,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/el.ts","line":94,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/en.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"characters\", verb: \"to have\" },\n file: { unit: \"bytes\", verb: \"to have\" },\n array: { unit: \"items\", verb: \"to have\" },\n set: { unit: \"items\", verb: \"to have\" },\n map: { unit: \"entries\", verb: \"to have\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"input\",\n email: \"email address\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO datetime\",\n date: \"ISO date\",\n time: \"ISO time\",\n duration: \"ISO duration\",\n ipv4: \"IPv4 address\",\n ipv6: \"IPv6 address\",\n mac: \"MAC address\",\n cidrv4: \"IPv4 range\",\n cidrv6: \"IPv6 range\",\n base64: \"base64-encoded string\",\n base64url: \"base64url-encoded string\",\n json_string: \"JSON string\",\n e16"} {"repo":"zod","file":"packages/zod/src/v4/locales/en.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"characters\", verb: \"to have\" },\n file: { unit: \"bytes\", verb: \"to have\" },\n array: { unit: \"items\", verb: \"to have\" },\n set: { unit: \"items\", verb: \"to have\" },\n map: { unit: \"entries\", verb: \"to have\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/en.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/en.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"input\",\n email: \"email address\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO datetime\",\n date: \"ISO date\",\n time: \"ISO time\",\n duration: \"ISO duration\",\n ipv4: \"IPv4 address\",\n ipv6: \"IPv6 address\",\n mac: \"MAC address\",\n cidrv4: \"IPv4 range\",\n cidrv6: \"IPv6 range\",\n base64: \"base64-encoded string\",\n base64url: \"base64url-encoded string\",\n json_string: \"JSON string\",\n e164: \"E.164 number\",\n currency_code: \"currency code\",\n credit_card: \"credit card number\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"input\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/en.ts","line":56,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","doc":"type names: missing keys = do not translate (use raw value via ?? fallback)","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n // Compatibility: \"nan\" -> \"NaN\" for display\n nan: \"NaN\",\n // All other type names omitted - they fall back to raw values via ?? operator\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/en.ts","line":64,"symbol":"getTypeName","kind":"function","lang":"typescript","code":"function getTypeName(type: errors.$ZodInvalidTypeExpected, input?: unknown): string {\n if (type === \"number\" && typeof input === \"number\" && !Number.isFinite(input)) {\n return String(input);\n }\n return TypeDictionary[type] ?? type;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/en.ts","line":74,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = getTypeName(issue.expected);"} {"repo":"zod","file":"packages/zod/src/v4/locales/en.ts","line":75,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/en.ts","line":76,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = getTypeName(receivedType, issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/en.ts","line":84,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.exact ? \"exactly \" : issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/en.ts","line":85,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/en.ts","line":91,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.exact ? \"exactly \" : issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/en.ts","line":92,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/en.ts","line":100,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/en.ts","line":117,"symbol":"opts","kind":"constant","lang":"typescript","code":"const opts = issue.options.map((o) => `'${o}'`).join(\" | \");"} {"repo":"zod","file":"packages/zod/src/v4/locales/eo.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"karaktrojn\", verb: \"havi\" },\n file: { unit: \"bajtojn\", verb: \"havi\" },\n array: { unit: \"elementojn\", verb: \"havi\" },\n set: { unit: \"elementojn\", verb: \"havi\" },\n map: { unit: \"elementojn\", verb: \"havi\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"enigo\",\n email: \"retadreso\",\n url: \"URL\",\n emoji: \"emoĝio\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO-datotempo\",\n date: \"ISO-dato\",\n time: \"ISO-tempo\",\n duration: \"ISO-daŭro\",\n ipv4: \"IPv4-adreso\",\n ipv6: \"IPv6-adreso\",\n mac: \"MAC-adreso\",\n cidrv4: \"IPv4-rango\",\n cidrv6: \"IPv6-rango\",\n base64: \"64-ume kodita karaktraro\",\n base64url: \"URL-64-ume kodita karaktraro\",\n json_string: \"JSON-karaktraro\",\n "} {"repo":"zod","file":"packages/zod/src/v4/locales/eo.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"karaktrojn\", verb: \"havi\" },\n file: { unit: \"bajtojn\", verb: \"havi\" },\n array: { unit: \"elementojn\", verb: \"havi\" },\n set: { unit: \"elementojn\", verb: \"havi\" },\n map: { unit: \"elementojn\", verb: \"havi\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/eo.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/eo.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"enigo\",\n email: \"retadreso\",\n url: \"URL\",\n emoji: \"emoĝio\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO-datotempo\",\n date: \"ISO-dato\",\n time: \"ISO-tempo\",\n duration: \"ISO-daŭro\",\n ipv4: \"IPv4-adreso\",\n ipv6: \"IPv6-adreso\",\n mac: \"MAC-adreso\",\n cidrv4: \"IPv4-rango\",\n cidrv6: \"IPv6-rango\",\n base64: \"64-ume kodita karaktraro\",\n base64url: \"URL-64-ume kodita karaktraro\",\n json_string: \"JSON-karaktraro\",\n e164: \"E.164-nombro\",\n credit_card: \"kreditkarta numero\",\n currency_code: \"valuta kodo\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"enigo\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/eo.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"nombro\",\n array: \"tabelo\",\n null: \"senvalora\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/eo.ts","line":67,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/eo.ts","line":68,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/eo.ts","line":69,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/eo.ts","line":80,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/eo.ts","line":81,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/eo.ts","line":87,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/eo.ts","line":88,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/eo.ts","line":96,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/es.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"caracteres\", verb: \"tener\" },\n file: { unit: \"bytes\", verb: \"tener\" },\n array: { unit: \"elementos\", verb: \"tener\" },\n set: { unit: \"elementos\", verb: \"tener\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"entrada\",\n email: \"dirección de correo electrónico\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"fecha y hora ISO\",\n date: \"fecha ISO\",\n time: \"hora ISO\",\n duration: \"duración ISO\",\n ipv4: \"dirección IPv4\",\n ipv6: \"dirección IPv6\",\n mac: \"dirección MAC\",\n cidrv4: \"rango IPv4\",\n cidrv6: \"rango IPv6\",\n base64: \"cadena codificada en base64\",\n base64url: \"URL codificada en base64\",\n json_string: \"cadena JSON\",\n e164: \"número"} {"repo":"zod","file":"packages/zod/src/v4/locales/es.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"caracteres\", verb: \"tener\" },\n file: { unit: \"bytes\", verb: \"tener\" },\n array: { unit: \"elementos\", verb: \"tener\" },\n set: { unit: \"elementos\", verb: \"tener\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/es.ts","line":13,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/es.ts","line":17,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"entrada\",\n email: \"dirección de correo electrónico\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"fecha y hora ISO\",\n date: \"fecha ISO\",\n time: \"hora ISO\",\n duration: \"duración ISO\",\n ipv4: \"dirección IPv4\",\n ipv6: \"dirección IPv6\",\n mac: \"dirección MAC\",\n cidrv4: \"rango IPv4\",\n cidrv6: \"rango IPv6\",\n base64: \"cadena codificada en base64\",\n base64url: \"URL codificada en base64\",\n json_string: \"cadena JSON\",\n e164: \"número E.164\",\n credit_card: \"número de tarjeta de crédito\",\n currency_code: \"código de moneda\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"entrada\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/es.ts","line":54,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n string: \"texto\",\n number: \"número\",\n boolean: \"booleano\",\n array: \"arreglo\",\n object: \"objeto\",\n set: \"conjunto\",\n file: \"archivo\",\n date: \"fecha\",\n bigint: \"número grande\",\n symbol: \"símbolo\",\n undefined: \"indefinido\",\n null: \"nulo\",\n function: \"función\",\n map: \"mapa\",\n record: \"registro\",\n tuple: \"tupla\",\n enum: \"enumeración\",\n union: \"unión\",\n literal: \"literal\",\n promise: \"promesa\",\n void: \"vacío\",\n never: \"nunca\",\n unknown: \"desconocido\",\n any: \"cualquiera\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/es.ts","line":87,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/es.ts","line":88,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/es.ts","line":89,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/es.ts","line":100,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/es.ts","line":101,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/es.ts","line":102,"symbol":"origin","kind":"constant","lang":"typescript","code":"const origin = TypeDictionary[issue.origin] ?? issue.origin;"} {"repo":"zod","file":"packages/zod/src/v4/locales/es.ts","line":108,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/es.ts","line":109,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/es.ts","line":110,"symbol":"origin","kind":"constant","lang":"typescript","code":"const origin = TypeDictionary[issue.origin] ?? issue.origin;"} {"repo":"zod","file":"packages/zod/src/v4/locales/es.ts","line":118,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/fa.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"کاراکتر\", verb: \"داشته باشد\" },\n file: { unit: \"بایت\", verb: \"داشته باشد\" },\n array: { unit: \"آیتم\", verb: \"داشته باشد\" },\n set: { unit: \"آیتم\", verb: \"داشته باشد\" },\n map: { unit: \"آیتم\", verb: \"داشته باشد\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ورودی\",\n email: \"آدرس ایمیل\",\n url: \"URL\",\n emoji: \"ایموجی\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"تاریخ و زمان ایزو\",\n date: \"تاریخ ایزو\",\n time: \"زمان ایزو\",\n duration: \"مدت زمان ایزو\",\n ipv4: \"IPv4 آدرس\",\n ipv6: \"IPv6 آدرس\",\n mac: \"MAC آدرس\",\n cidrv4: \"IPv4 دامنه\",\n cidrv6: \"IPv6 دامنه\",\n base64: \"base64-encoded رشته\",\n base64url: \"base64url-encoded رشته\",\n json_string: \"JSON رشته\",\n e164:"} {"repo":"zod","file":"packages/zod/src/v4/locales/fa.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"کاراکتر\", verb: \"داشته باشد\" },\n file: { unit: \"بایت\", verb: \"داشته باشد\" },\n array: { unit: \"آیتم\", verb: \"داشته باشد\" },\n set: { unit: \"آیتم\", verb: \"داشته باشد\" },\n map: { unit: \"آیتم\", verb: \"داشته باشد\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/fa.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/fa.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ورودی\",\n email: \"آدرس ایمیل\",\n url: \"URL\",\n emoji: \"ایموجی\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"تاریخ و زمان ایزو\",\n date: \"تاریخ ایزو\",\n time: \"زمان ایزو\",\n duration: \"مدت زمان ایزو\",\n ipv4: \"IPv4 آدرس\",\n ipv6: \"IPv6 آدرس\",\n mac: \"MAC آدرس\",\n cidrv4: \"IPv4 دامنه\",\n cidrv6: \"IPv6 دامنه\",\n base64: \"base64-encoded رشته\",\n base64url: \"base64url-encoded رشته\",\n json_string: \"JSON رشته\",\n e164: \"E.164 عدد\",\n credit_card: \"شماره کارت اعتباری\",\n currency_code: \"کد ارز\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"ورودی\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/fa.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"عدد\",\n array: \"آرایه\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/fa.ts","line":66,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/fa.ts","line":67,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/fa.ts","line":68,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/fa.ts","line":80,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/fa.ts","line":81,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/fa.ts","line":88,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/fa.ts","line":89,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/fa.ts","line":96,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/fi.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; subject: string }> = {\n string: { unit: \"merkkiä\", subject: \"merkkijonon\" },\n file: { unit: \"tavua\", subject: \"tiedoston\" },\n array: { unit: \"alkiota\", subject: \"listan\" },\n set: { unit: \"alkiota\", subject: \"joukon\" },\n map: { unit: \"alkiota\", subject: \"kuvauksen\" },\n number: { unit: \"\", subject: \"luvun\" },\n bigint: { unit: \"\", subject: \"suuren kokonaisluvun\" },\n int: { unit: \"\", subject: \"kokonaisluvun\" },\n date: { unit: \"\", subject: \"päivämäärän\" },\n };\n\n function getSizing(origin: string): { unit: string; subject: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"säännöllinen lauseke\",\n email: \"sähköpostiosoite\",\n url: \"URL-osoite\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO-aikaleima\",\n date: \"ISO-päivämäärä\",\n time: \"ISO-aika\",\n duration: \"IS"} {"repo":"zod","file":"packages/zod/src/v4/locales/fi.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; subject: string }> = {\n string: { unit: \"merkkiä\", subject: \"merkkijonon\" },\n file: { unit: \"tavua\", subject: \"tiedoston\" },\n array: { unit: \"alkiota\", subject: \"listan\" },\n set: { unit: \"alkiota\", subject: \"joukon\" },\n map: { unit: \"alkiota\", subject: \"kuvauksen\" },\n number: { unit: \"\", subject: \"luvun\" },\n bigint: { unit: \"\", subject: \"suuren kokonaisluvun\" },\n int: { unit: \"\", subject: \"kokonaisluvun\" },\n date: { unit: \"\", subject: \"päivämäärän\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/fi.ts","line":18,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; subject: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/fi.ts","line":22,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"säännöllinen lauseke\",\n email: \"sähköpostiosoite\",\n url: \"URL-osoite\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO-aikaleima\",\n date: \"ISO-päivämäärä\",\n time: \"ISO-aika\",\n duration: \"ISO-kesto\",\n ipv4: \"IPv4-osoite\",\n ipv6: \"IPv6-osoite\",\n mac: \"MAC-osoite\",\n cidrv4: \"IPv4-alue\",\n cidrv6: \"IPv6-alue\",\n base64: \"base64-koodattu merkkijono\",\n base64url: \"base64url-koodattu merkkijono\",\n json_string: \"JSON-merkkijono\",\n e164: \"E.164-luku\",\n credit_card: \"luottokortin numero\",\n currency_code: \"valuuttakoodi\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"templaattimerkkijono\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/fi.ts","line":59,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/fi.ts","line":68,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/fi.ts","line":69,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/fi.ts","line":70,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/fi.ts","line":81,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/fi.ts","line":82,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/fi.ts","line":89,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/fi.ts","line":90,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/fi.ts","line":97,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr-CA.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"caractères\", verb: \"avoir\" },\n file: { unit: \"octets\", verb: \"avoir\" },\n array: { unit: \"éléments\", verb: \"avoir\" },\n set: { unit: \"éléments\", verb: \"avoir\" },\n map: { unit: \"éléments\", verb: \"avoir\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"entrée\",\n email: \"adresse courriel\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"date-heure ISO\",\n date: \"date ISO\",\n time: \"heure ISO\",\n duration: \"durée ISO\",\n ipv4: \"adresse IPv4\",\n ipv6: \"adresse IPv6\",\n mac: \"adresse MAC\",\n cidrv4: \"plage IPv4\",\n cidrv6: \"plage IPv6\",\n base64: \"chaîne encodée en base64\",\n base64url: \"chaîne encodée en base64url\",\n json_string: \"chaîne JSON\","} {"repo":"zod","file":"packages/zod/src/v4/locales/fr-CA.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"caractères\", verb: \"avoir\" },\n file: { unit: \"octets\", verb: \"avoir\" },\n array: { unit: \"éléments\", verb: \"avoir\" },\n set: { unit: \"éléments\", verb: \"avoir\" },\n map: { unit: \"éléments\", verb: \"avoir\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr-CA.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr-CA.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"entrée\",\n email: \"adresse courriel\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"date-heure ISO\",\n date: \"date ISO\",\n time: \"heure ISO\",\n duration: \"durée ISO\",\n ipv4: \"adresse IPv4\",\n ipv6: \"adresse IPv6\",\n mac: \"adresse MAC\",\n cidrv4: \"plage IPv4\",\n cidrv6: \"plage IPv6\",\n base64: \"chaîne encodée en base64\",\n base64url: \"chaîne encodée en base64url\",\n json_string: \"chaîne JSON\",\n e164: \"numéro E.164\",\n credit_card: \"numéro de carte de crédit\",\n currency_code: \"code de devise\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"entrée\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr-CA.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr-CA.ts","line":64,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr-CA.ts","line":65,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr-CA.ts","line":66,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr-CA.ts","line":76,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"≤\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr-CA.ts","line":77,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr-CA.ts","line":83,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"≥\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr-CA.ts","line":84,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr-CA.ts","line":92,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"caractères\", verb: \"avoir\" },\n file: { unit: \"octets\", verb: \"avoir\" },\n array: { unit: \"éléments\", verb: \"avoir\" },\n set: { unit: \"éléments\", verb: \"avoir\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"expression régulière\",\n email: \"adresse e-mail\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"date et heure ISO\",\n date: \"date ISO\",\n time: \"heure ISO\",\n duration: \"durée ISO\",\n ipv4: \"adresse IPv4\",\n ipv6: \"adresse IPv6\",\n mac: \"adresse MAC\",\n cidrv4: \"plage IPv4\",\n cidrv6: \"plage IPv6\",\n base64: \"chaîne de caractères encodée en base64\",\n base64url: \"chaîne de caractères encodée en base64url\",\n json_string: \"chaîne de caract"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"caractères\", verb: \"avoir\" },\n file: { unit: \"octets\", verb: \"avoir\" },\n array: { unit: \"éléments\", verb: \"avoir\" },\n set: { unit: \"éléments\", verb: \"avoir\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr.ts","line":13,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr.ts","line":17,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"expression régulière\",\n email: \"adresse e-mail\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"date et heure ISO\",\n date: \"date ISO\",\n time: \"heure ISO\",\n duration: \"durée ISO\",\n ipv4: \"adresse IPv4\",\n ipv6: \"adresse IPv6\",\n mac: \"adresse MAC\",\n cidrv4: \"plage IPv4\",\n cidrv6: \"plage IPv6\",\n base64: \"chaîne de caractères encodée en base64\",\n base64url: \"chaîne de caractères encodée en base64url\",\n json_string: \"chaîne de caractères JSON\",\n e164: \"numéro au format E.164\",\n credit_card: \"numéro de carte de crédit\",\n currency_code: \"code de devise\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"entrée\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr.ts","line":54,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n string: \"chaîne de caractères\",\n number: \"nombre\",\n int: \"entier\",\n boolean: \"booléen\",\n bigint: \"grand entier\",\n symbol: \"symbole\",\n undefined: \"indéfini\",\n null: \"null\",\n never: \"jamais\",\n void: \"vide\",\n date: \"date\",\n array: \"tableau\",\n object: \"objet\",\n tuple: \"tuple\",\n record: \"record\",\n map: \"map\",\n set: \"ensemble\",\n file: \"fichier\",\n nonoptional: \"non optionnel\",\n nan: \"NaN\",\n function: \"fonction\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr.ts","line":83,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr.ts","line":84,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr.ts","line":85,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr.ts","line":95,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr.ts","line":96,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr.ts","line":102,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr.ts","line":103,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/fr.ts","line":109,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/gu.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"અક્ષર\", verb: \"હોવા જોઈએ\" },\n file: { unit: \"બાયટ\", verb: \"હોવા જોઈએ\" },\n array: { unit: \"આઇટમ\", verb: \"હોવા જોઈએ\" },\n set: { unit: \"આઇટમ\", verb: \"હોવા જોઈએ\" },\n map: { unit: \"એન્ટ્રી\", verb: \"હોવા જોઈએ\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ઇનપુટ\",\n email: \"ઈમેઇલ એડ્રેસ\",\n url: \"URL\",\n emoji: \"ઇમોજી\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO તારીખ અને સમય\",\n date: \"ISO તારીખ\",\n time: \"ISO સમય\",\n duration: \"ISO અવધિ\",\n ipv4: \"IPv4 એડ્રેસ\",\n ipv6: \"IPv6 એડ્રેસ\",\n mac: \"MAC એડ્રેસ\",\n cidrv4: \"IPv4 શ્રેણી\",\n cidrv6: \"IPv6 શ્રેણી\",\n base64: \"base64-એન્કોડેડ સ્ટ્રિંગ\",\n base64url: \"base64url-એન્કોડેડ સ્ટ્રિંગ\",\n json_string: \"JSON સ્ટ્રિંગ\""} {"repo":"zod","file":"packages/zod/src/v4/locales/gu.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"અક્ષર\", verb: \"હોવા જોઈએ\" },\n file: { unit: \"બાયટ\", verb: \"હોવા જોઈએ\" },\n array: { unit: \"આઇટમ\", verb: \"હોવા જોઈએ\" },\n set: { unit: \"આઇટમ\", verb: \"હોવા જોઈએ\" },\n map: { unit: \"એન્ટ્રી\", verb: \"હોવા જોઈએ\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/gu.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/gu.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ઇનપુટ\",\n email: \"ઈમેઇલ એડ્રેસ\",\n url: \"URL\",\n emoji: \"ઇમોજી\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO તારીખ અને સમય\",\n date: \"ISO તારીખ\",\n time: \"ISO સમય\",\n duration: \"ISO અવધિ\",\n ipv4: \"IPv4 એડ્રેસ\",\n ipv6: \"IPv6 એડ્રેસ\",\n mac: \"MAC એડ્રેસ\",\n cidrv4: \"IPv4 શ્રેણી\",\n cidrv6: \"IPv6 શ્રેણી\",\n base64: \"base64-એન્કોડેડ સ્ટ્રિંગ\",\n base64url: \"base64url-એન્કોડેડ સ્ટ્રિંગ\",\n json_string: \"JSON સ્ટ્રિંગ\",\n e164: \"E.164 નંબર\",\n credit_card: \"ક્રેડિટ કાર્ડ નંબર\",\n currency_code: \"ચલણ કોડ\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"ઇનપુટ\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/gu.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/gu.ts","line":64,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/gu.ts","line":65,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/gu.ts","line":66,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/gu.ts","line":74,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/gu.ts","line":75,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/gu.ts","line":81,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/gu.ts","line":82,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/gu.ts","line":90,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/gu.ts","line":107,"symbol":"opts","kind":"constant","lang":"typescript","code":"const opts = issue.options.map((o) => `'${o}'`).join(\" | \");"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n // Hebrew labels + grammatical gender\n const TypeNames: Record<string, { label: string; gender: \"m\" | \"f\" }> = {\n string: { label: \"מחרוזת\", gender: \"f\" },\n number: { label: \"מספר\", gender: \"m\" },\n boolean: { label: \"ערך בוליאני\", gender: \"m\" },\n bigint: { label: \"BigInt\", gender: \"m\" },\n date: { label: \"תאריך\", gender: \"m\" },\n array: { label: \"מערך\", gender: \"m\" },\n object: { label: \"אובייקט\", gender: \"m\" },\n null: { label: \"ערך ריק (null)\", gender: \"m\" },\n undefined: { label: \"ערך לא מוגדר (undefined)\", gender: \"m\" },\n symbol: { label: \"סימבול (Symbol)\", gender: \"m\" },\n function: { label: \"פונקציה\", gender: \"f\" },\n map: { label: \"מפה (Map)\", gender: \"f\" },\n set: { label: \"קבוצה (Set)\", gender: \"f\" },\n file: { label: \"קובץ\", gender: \"m\" },\n promise: { label: \"Promise\", gender: \"m\" },\n NaN: { label: \"NaN\", gender: \"m\" },\n unknown: { label: \"ערך לא ידוע\", gender: \"m\" },\n value: { label: \"ערך\", gender: \"m\" },\n };\n\n // Sizing units for size-related messages + localized origin labels\n const Sizable: Record<string, { unit: string; shortLabel?: string; longLabel?: string }> = {\n "} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":7,"symbol":"TypeNames","kind":"constant","lang":"typescript","doc":"Hebrew labels + grammatical gender","code":"const TypeNames: Record<string, { label: string; gender: \"m\" | \"f\" }> = {\n string: { label: \"מחרוזת\", gender: \"f\" },\n number: { label: \"מספר\", gender: \"m\" },\n boolean: { label: \"ערך בוליאני\", gender: \"m\" },\n bigint: { label: \"BigInt\", gender: \"m\" },\n date: { label: \"תאריך\", gender: \"m\" },\n array: { label: \"מערך\", gender: \"m\" },\n object: { label: \"אובייקט\", gender: \"m\" },\n null: { label: \"ערך ריק (null)\", gender: \"m\" },\n undefined: { label: \"ערך לא מוגדר (undefined)\", gender: \"m\" },\n symbol: { label: \"סימבול (Symbol)\", gender: \"m\" },\n function: { label: \"פונקציה\", gender: \"f\" },\n map: { label: \"מפה (Map)\", gender: \"f\" },\n set: { label: \"קבוצה (Set)\", gender: \"f\" },\n file: { label: \"קובץ\", gender: \"m\" },\n promise: { label: \"Promise\", gender: \"m\" },\n NaN: { label: \"NaN\", gender: \"m\" },\n unknown: { label: \"ערך לא ידוע\", gender: \"m\" },\n value: { label: \"ערך\", gender: \"m\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":29,"symbol":"Sizable","kind":"constant","lang":"typescript","doc":"Sizing units for size-related messages + localized origin labels","code":"const Sizable: Record<string, { unit: string; shortLabel?: string; longLabel?: string }> = {\n string: { unit: \"תווים\", shortLabel: \"קצר\", longLabel: \"ארוך\" },\n file: { unit: \"בייטים\", shortLabel: \"קטן\", longLabel: \"גדול\" },\n array: { unit: \"פריטים\", shortLabel: \"קטן\", longLabel: \"גדול\" },\n set: { unit: \"פריטים\", shortLabel: \"קטן\", longLabel: \"גדול\" },\n number: { unit: \"\", shortLabel: \"קטן\", longLabel: \"גדול\" }, // no unit\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":38,"symbol":"typeEntry","kind":"constant","lang":"typescript","doc":"Helpers — labels, articles, and verbs","code":"const typeEntry = (t?: string | null) => (t ? TypeNames[t] : undefined);"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":40,"symbol":"typeLabel","kind":"constant","lang":"typescript","code":"const typeLabel = (t?: string | null): string => {\n const e = typeEntry(t);\n if (e) return e.label;\n // fallback: show raw string if unknown\n return t ?? TypeNames.unknown.label;\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":41,"symbol":"e","kind":"constant","lang":"typescript","code":"const e = typeEntry(t);"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":47,"symbol":"withDefinite","kind":"constant","lang":"typescript","code":"const withDefinite = (t?: string | null): string => `ה${typeLabel(t)}`;"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":49,"symbol":"verbFor","kind":"constant","lang":"typescript","code":"const verbFor = (t?: string | null): string => {\n const e = typeEntry(t);\n const gender = e?.gender ?? \"m\";\n return gender === \"f\" ? \"צריכה להיות\" : \"צריך להיות\";\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":50,"symbol":"e","kind":"constant","lang":"typescript","code":"const e = typeEntry(t);"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":51,"symbol":"gender","kind":"constant","lang":"typescript","code":"const gender = e?.gender ?? \"m\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":55,"symbol":"getSizing","kind":"constant","lang":"typescript","code":"const getSizing = (origin?: string | null) => {\n if (!origin) return null;\n return Sizable[origin] ?? null;\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":60,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: { label: string; gender: \"m\" | \"f\" };\n } = {\n regex: { label: \"קלט\", gender: \"m\" },\n email: { label: \"כתובת אימייל\", gender: \"f\" },\n url: { label: \"כתובת רשת\", gender: \"f\" },\n emoji: { label: \"אימוג'י\", gender: \"m\" },\n uuid: { label: \"UUID\", gender: \"m\" },\n uuidv4: { label: \"UUIDv4\", gender: \"m\" },\n uuidv6: { label: \"UUIDv6\", gender: \"m\" },\n nanoid: { label: \"nanoid\", gender: \"m\" },\n guid: { label: \"GUID\", gender: \"m\" },\n cuid: { label: \"cuid\", gender: \"m\" },\n cuid2: { label: \"cuid2\", gender: \"m\" },\n ulid: { label: \"ULID\", gender: \"m\" },\n xid: { label: \"XID\", gender: \"m\" },\n ksuid: { label: \"KSUID\", gender: \"m\" },\n datetime: { label: \"תאריך וזמן ISO\", gender: \"m\" },\n date: { label: \"תאריך ISO\", gender: \"m\" },\n time: { label: \"זמן ISO\", gender: \"m\" },\n duration: { label: \"משך זמן ISO\", gender: \"m\" },\n ipv4: { label: \"כתובת IPv4\", gender: \"f\" },\n ipv6: { label: \"כתובת IPv6\", gender: \"f\" },\n mac: { label: \"כתובת MAC\", gender: \"f\" },\n cidrv4: { label: \"טווח IPv4\", gender: \"m\" },\n cidrv6: { label: \"טווח IPv6\", gender: \"m\" },\n base64: { label: "} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":102,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":112,"symbol":"expectedKey","kind":"constant","lang":"typescript","doc":"Expected type: show without definite article for clearer Hebrew","code":"const expectedKey = issue.expected as string | undefined;"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":113,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[expectedKey ?? \"\"] ?? typeLabel(expectedKey);"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":115,"symbol":"receivedType","kind":"constant","lang":"typescript","doc":"Received: show localized label if known, otherwise constructor/raw","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":116,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? TypeNames[receivedType]?.label ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":128,"symbol":"stringified","kind":"constant","lang":"typescript","doc":"Join values with proper Hebrew formatting","code":"const stringified = issue.values.map((v) => util.stringifyPrimitive(v));"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":133,"symbol":"lastValue","kind":"constant","lang":"typescript","doc":"For 3+ values: \"a\", \"b\" או \"c\"","code":"const lastValue = stringified[stringified.length - 1];"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":134,"symbol":"restValues","kind":"constant","lang":"typescript","code":"const restValues = stringified.slice(0, -1).join(\", \");"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":139,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":140,"symbol":"subject","kind":"constant","lang":"typescript","code":"const subject = withDefinite(issue.origin ?? \"value\");"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":149,"symbol":"comparison","kind":"constant","lang":"typescript","doc":"Natural Hebrew for numbers","code":"const comparison = issue.inclusive ? `קטן או שווה ל-${issue.maximum}` : `קטן מ-${issue.maximum}`;"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":155,"symbol":"verb","kind":"constant","lang":"typescript","doc":"Natural Hebrew for arrays and sets","code":"const verb = issue.origin === \"set\" ? \"צריכה\" : \"צריך\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":156,"symbol":"comparison","kind":"constant","lang":"typescript","code":"const comparison = issue.inclusive\n ? `${issue.maximum} ${sizing?.unit ?? \"\"} או פחות`\n : `פחות מ-${issue.maximum} ${sizing?.unit ?? \"\"}`;"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":162,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":163,"symbol":"be","kind":"constant","lang":"typescript","code":"const be = verbFor(issue.origin ?? \"value\");"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":171,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":172,"symbol":"subject","kind":"constant","lang":"typescript","code":"const subject = withDefinite(issue.origin ?? \"value\");"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":181,"symbol":"comparison","kind":"constant","lang":"typescript","doc":"Natural Hebrew for numbers","code":"const comparison = issue.inclusive ? `גדול או שווה ל-${issue.minimum}` : `גדול מ-${issue.minimum}`;"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":187,"symbol":"verb","kind":"constant","lang":"typescript","doc":"Natural Hebrew for arrays and sets","code":"const verb = issue.origin === \"set\" ? \"צריכה\" : \"צריך\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":191,"symbol":"singularPhrase","kind":"constant","lang":"typescript","code":"const singularPhrase = issue.origin === \"set\" ? \"לפחות פריט אחד\" : \"לפחות פריט אחד\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":195,"symbol":"comparison","kind":"constant","lang":"typescript","code":"const comparison = issue.inclusive\n ? `${issue.minimum} ${sizing?.unit ?? \"\"} או יותר`\n : `יותר מ-${issue.minimum} ${sizing?.unit ?? \"\"}`;"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":201,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":202,"symbol":"be","kind":"constant","lang":"typescript","code":"const be = verbFor(issue.origin ?? \"value\");"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":210,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":218,"symbol":"nounEntry","kind":"constant","lang":"typescript","doc":"Handle gender agreement for formats","code":"const nounEntry = FormatDictionary[_issue.format];"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":219,"symbol":"noun","kind":"constant","lang":"typescript","code":"const noun = nounEntry?.label ?? _issue.format;"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":220,"symbol":"gender","kind":"constant","lang":"typescript","code":"const gender = nounEntry?.gender ?? \"m\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":221,"symbol":"adjective","kind":"constant","lang":"typescript","code":"const adjective = gender === \"f\" ? \"תקינה\" : \"תקין\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/he.ts","line":239,"symbol":"place","kind":"constant","lang":"typescript","code":"const place = withDefinite(issue.origin ?? \"array\");"} {"repo":"zod","file":"packages/zod/src/v4/locales/hi.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"अक्षर\", verb: \"रखने के लिए\" },\n file: { unit: \"बाइट्स\", verb: \"रखने के लिए\" },\n array: { unit: \"तत्व\", verb: \"रखने के लिए\" },\n set: { unit: \"तत्व\", verb: \"रखने के लिए\" },\n map: { unit: \"प्रविष्टियाँ\", verb: \"रखने के लिए\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"इनपुट\",\n email: \"ईमेल पता\",\n url: \"URL\",\n emoji: \"इमोजी\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO तिथि और समय\",\n date: \"ISO तिथि\",\n time: \"ISO समय\",\n duration: \"ISO अवधि\",\n ipv4: \"IPv4 पता\",\n ipv6: \"IPv6 पता\",\n mac: \"MAC पता\",\n cidrv4: \"IPv4 श्रेणी\",\n cidrv6: \"IPv6 श्रेणी\",\n base64: \"Base64-एन्कोडेड स्ट्रिंग\",\n base64url: \"Base64URL-एन्कोडेड स्ट्रिंग\",\n json_string: \"JSON स्ट्रिंग"} {"repo":"zod","file":"packages/zod/src/v4/locales/hi.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"अक्षर\", verb: \"रखने के लिए\" },\n file: { unit: \"बाइट्स\", verb: \"रखने के लिए\" },\n array: { unit: \"तत्व\", verb: \"रखने के लिए\" },\n set: { unit: \"तत्व\", verb: \"रखने के लिए\" },\n map: { unit: \"प्रविष्टियाँ\", verb: \"रखने के लिए\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/hi.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/hi.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"इनपुट\",\n email: \"ईमेल पता\",\n url: \"URL\",\n emoji: \"इमोजी\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO तिथि और समय\",\n date: \"ISO तिथि\",\n time: \"ISO समय\",\n duration: \"ISO अवधि\",\n ipv4: \"IPv4 पता\",\n ipv6: \"IPv6 पता\",\n mac: \"MAC पता\",\n cidrv4: \"IPv4 श्रेणी\",\n cidrv6: \"IPv6 श्रेणी\",\n base64: \"Base64-एन्कोडेड स्ट्रिंग\",\n base64url: \"Base64URL-एन्कोडेड स्ट्रिंग\",\n json_string: \"JSON स्ट्रिंग\",\n e164: \"E.164 संख्या\",\n credit_card: \"क्रेडिट कार्ड संख्या\",\n currency_code: \"मुद्रा कोड\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"इनपुट\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/hi.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/hi.ts","line":64,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/hi.ts","line":65,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/hi.ts","line":66,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/hi.ts","line":75,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/hi.ts","line":76,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/hi.ts","line":82,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/hi.ts","line":83,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/hi.ts","line":89,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/hi.ts","line":108,"symbol":"opts","kind":"constant","lang":"typescript","code":"const opts = issue.options.map((o) => `'${o}'`).join(\" | \");"} {"repo":"zod","file":"packages/zod/src/v4/locales/hr.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"znakova\", verb: \"imati\" },\n file: { unit: \"bajtova\", verb: \"imati\" },\n array: { unit: \"stavki\", verb: \"imati\" },\n set: { unit: \"stavki\", verb: \"imati\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"unos\",\n email: \"email adresa\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO datum i vrijeme\",\n date: \"ISO datum\",\n time: \"ISO vrijeme\",\n duration: \"ISO trajanje\",\n ipv4: \"IPv4 adresa\",\n ipv6: \"IPv6 adresa\",\n mac: \"MAC adresa\",\n cidrv4: \"IPv4 raspon\",\n cidrv6: \"IPv6 raspon\",\n base64: \"base64 kodirani tekst\",\n base64url: \"base64url kodirani tekst\",\n json_string: \"JSON tekst\",\n e164: \"E.164 broj\",\n credit_card: \"broj kreditn"} {"repo":"zod","file":"packages/zod/src/v4/locales/hr.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"znakova\", verb: \"imati\" },\n file: { unit: \"bajtova\", verb: \"imati\" },\n array: { unit: \"stavki\", verb: \"imati\" },\n set: { unit: \"stavki\", verb: \"imati\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/hr.ts","line":13,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/hr.ts","line":17,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"unos\",\n email: \"email adresa\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO datum i vrijeme\",\n date: \"ISO datum\",\n time: \"ISO vrijeme\",\n duration: \"ISO trajanje\",\n ipv4: \"IPv4 adresa\",\n ipv6: \"IPv6 adresa\",\n mac: \"MAC adresa\",\n cidrv4: \"IPv4 raspon\",\n cidrv6: \"IPv6 raspon\",\n base64: \"base64 kodirani tekst\",\n base64url: \"base64url kodirani tekst\",\n json_string: \"JSON tekst\",\n e164: \"E.164 broj\",\n credit_card: \"broj kreditne kartice\",\n currency_code: \"kod valute\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"unos\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/hr.ts","line":54,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n string: \"tekst\",\n number: \"broj\",\n boolean: \"boolean\",\n array: \"niz\",\n object: \"objekt\",\n set: \"skup\",\n file: \"datoteka\",\n date: \"datum\",\n bigint: \"bigint\",\n symbol: \"simbol\",\n undefined: \"undefined\",\n null: \"null\",\n function: \"funkcija\",\n map: \"mapa\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/hr.ts","line":77,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/hr.ts","line":78,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/hr.ts","line":79,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/hr.ts","line":90,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/hr.ts","line":91,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/hr.ts","line":92,"symbol":"origin","kind":"constant","lang":"typescript","code":"const origin = TypeDictionary[issue.origin] ?? issue.origin;"} {"repo":"zod","file":"packages/zod/src/v4/locales/hr.ts","line":98,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/hr.ts","line":99,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/hr.ts","line":100,"symbol":"origin","kind":"constant","lang":"typescript","code":"const origin = TypeDictionary[issue.origin] ?? issue.origin;"} {"repo":"zod","file":"packages/zod/src/v4/locales/hr.ts","line":108,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/hu.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"karakter\", verb: \"legyen\" },\n file: { unit: \"byte\", verb: \"legyen\" },\n array: { unit: \"elem\", verb: \"legyen\" },\n set: { unit: \"elem\", verb: \"legyen\" },\n map: { unit: \"elem\", verb: \"legyen\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"bemenet\",\n email: \"email cím\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO időbélyeg\",\n date: \"ISO dátum\",\n time: \"ISO idő\",\n duration: \"ISO időintervallum\",\n ipv4: \"IPv4 cím\",\n ipv6: \"IPv6 cím\",\n mac: \"MAC cím\",\n cidrv4: \"IPv4 tartomány\",\n cidrv6: \"IPv6 tartomány\",\n base64: \"base64-kódolt string\",\n base64url: \"base64url-kódolt string\",\n json_string: \"JSON string\",\n e164: \"E.164 szám"} {"repo":"zod","file":"packages/zod/src/v4/locales/hu.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"karakter\", verb: \"legyen\" },\n file: { unit: \"byte\", verb: \"legyen\" },\n array: { unit: \"elem\", verb: \"legyen\" },\n set: { unit: \"elem\", verb: \"legyen\" },\n map: { unit: \"elem\", verb: \"legyen\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/hu.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/hu.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"bemenet\",\n email: \"email cím\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO időbélyeg\",\n date: \"ISO dátum\",\n time: \"ISO idő\",\n duration: \"ISO időintervallum\",\n ipv4: \"IPv4 cím\",\n ipv6: \"IPv6 cím\",\n mac: \"MAC cím\",\n cidrv4: \"IPv4 tartomány\",\n cidrv6: \"IPv6 tartomány\",\n base64: \"base64-kódolt string\",\n base64url: \"base64url-kódolt string\",\n json_string: \"JSON string\",\n e164: \"E.164 szám\",\n credit_card: \"hitelkártyaszám\",\n currency_code: \"pénznemkód\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"bemenet\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/hu.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"szám\",\n array: \"tömb\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/hu.ts","line":66,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/hu.ts","line":67,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/hu.ts","line":68,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/hu.ts","line":79,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/hu.ts","line":80,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/hu.ts","line":86,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/hu.ts","line":87,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/hu.ts","line":95,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":5,"symbol":"getArmenianPlural","kind":"function","lang":"typescript","code":"function getArmenianPlural(count: number, one: string, many: string): string {\n return Math.abs(count) === 1 ? one : many;\n}"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":9,"symbol":"withDefiniteArticle","kind":"function","lang":"typescript","code":"function withDefiniteArticle(word: string | undefined): string {\n if (!word) return \"\";\n const vowels = [\"ա\", \"ե\", \"ը\", \"ի\", \"ո\", \"ու\", \"օ\"];\n const lastChar = word[word.length - 1];\n return word + (vowels.includes(lastChar) ? \"ն\" : \"ը\");\n}"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":11,"symbol":"vowels","kind":"constant","lang":"typescript","code":"const vowels = [\"ա\", \"ե\", \"ը\", \"ի\", \"ո\", \"ու\", \"օ\"];"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":12,"symbol":"lastChar","kind":"constant","lang":"typescript","code":"const lastChar = word[word.length - 1];"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":16,"symbol":"ArmenianSizable","kind":"interface","lang":"typescript","code":"interface ArmenianSizable {\n unit: {\n one: string;\n many: string;\n };\n verb: string;\n}"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":24,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, ArmenianSizable> = {\n string: {\n unit: {\n one: \"նշան\",\n many: \"նշաններ\",\n },\n verb: \"ունենալ\",\n },\n file: {\n unit: {\n one: \"բայթ\",\n many: \"բայթեր\",\n },\n verb: \"ունենալ\",\n },\n array: {\n unit: {\n one: \"տարր\",\n many: \"տարրեր\",\n },\n verb: \"ունենալ\",\n },\n set: {\n unit: {\n one: \"տարր\",\n many: \"տարրեր\",\n },\n verb: \"ունենալ\",\n },\n map: {\n unit: {\n one: \"տարր\",\n many: \"տարրեր\",\n },\n verb: \"ունենալ\",\n },\n };\n\n function getSizing(origin: string): ArmenianSizable | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"մուտք\",\n email: \"էլ. հասցե\",\n url: \"URL\",\n emoji: \"էմոջի\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO ամսաթիվ և ժամ\",\n date: \"ISO ամսաթիվ\",\n time: \""} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":25,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, ArmenianSizable> = {\n string: {\n unit: {\n one: \"նշան\",\n many: \"նշաններ\",\n },\n verb: \"ունենալ\",\n },\n file: {\n unit: {\n one: \"բայթ\",\n many: \"բայթեր\",\n },\n verb: \"ունենալ\",\n },\n array: {\n unit: {\n one: \"տարր\",\n many: \"տարրեր\",\n },\n verb: \"ունենալ\",\n },\n set: {\n unit: {\n one: \"տարր\",\n many: \"տարրեր\",\n },\n verb: \"ունենալ\",\n },\n map: {\n unit: {\n one: \"տարր\",\n many: \"տարրեր\",\n },\n verb: \"ունենալ\",\n },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":63,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): ArmenianSizable | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":67,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"մուտք\",\n email: \"էլ. հասցե\",\n url: \"URL\",\n emoji: \"էմոջի\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO ամսաթիվ և ժամ\",\n date: \"ISO ամսաթիվ\",\n time: \"ISO ժամ\",\n duration: \"ISO տևողություն\",\n ipv4: \"IPv4 հասցե\",\n ipv6: \"IPv6 հասցե\",\n mac: \"MAC հասցե\",\n cidrv4: \"IPv4 միջակայք\",\n cidrv6: \"IPv6 միջակայք\",\n base64: \"base64 ձևաչափով տող\",\n base64url: \"base64url ձևաչափով տող\",\n json_string: \"JSON տող\",\n e164: \"E.164 համար\",\n credit_card: \"կրեդիտ քարտի համար\",\n currency_code: \"արժույթի կոդ\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"մուտք\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":104,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"թիվ\",\n array: \"զանգված\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":115,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":116,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":117,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":128,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":129,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":131,"symbol":"maxValue","kind":"constant","lang":"typescript","code":"const maxValue = Number(issue.maximum);"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":132,"symbol":"unit","kind":"constant","lang":"typescript","code":"const unit = getArmenianPlural(maxValue, sizing.unit.one, sizing.unit.many);"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":138,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":139,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":141,"symbol":"minValue","kind":"constant","lang":"typescript","code":"const minValue = Number(issue.minimum);"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":142,"symbol":"unit","kind":"constant","lang":"typescript","code":"const unit = getArmenianPlural(minValue, sizing.unit.one, sizing.unit.many);"} {"repo":"zod","file":"packages/zod/src/v4/locales/hy.ts","line":148,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/id.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"karakter\", verb: \"memiliki\" },\n file: { unit: \"byte\", verb: \"memiliki\" },\n array: { unit: \"item\", verb: \"memiliki\" },\n set: { unit: \"item\", verb: \"memiliki\" },\n map: { unit: \"item\", verb: \"memiliki\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"input\",\n email: \"alamat email\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"tanggal dan waktu format ISO\",\n date: \"tanggal format ISO\",\n time: \"jam format ISO\",\n duration: \"durasi format ISO\",\n ipv4: \"alamat IPv4\",\n ipv6: \"alamat IPv6\",\n mac: \"alamat MAC\",\n cidrv4: \"rentang alamat IPv4\",\n cidrv6: \"rentang alamat IPv6\",\n base64: \"string dengan enkode base64\",\n base64url: \"string denga"} {"repo":"zod","file":"packages/zod/src/v4/locales/id.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"karakter\", verb: \"memiliki\" },\n file: { unit: \"byte\", verb: \"memiliki\" },\n array: { unit: \"item\", verb: \"memiliki\" },\n set: { unit: \"item\", verb: \"memiliki\" },\n map: { unit: \"item\", verb: \"memiliki\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/id.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/id.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"input\",\n email: \"alamat email\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"tanggal dan waktu format ISO\",\n date: \"tanggal format ISO\",\n time: \"jam format ISO\",\n duration: \"durasi format ISO\",\n ipv4: \"alamat IPv4\",\n ipv6: \"alamat IPv6\",\n mac: \"alamat MAC\",\n cidrv4: \"rentang alamat IPv4\",\n cidrv6: \"rentang alamat IPv6\",\n base64: \"string dengan enkode base64\",\n base64url: \"string dengan enkode base64url\",\n json_string: \"string JSON\",\n e164: \"angka E.164\",\n credit_card: \"nomor kartu kredit\",\n currency_code: \"kode mata uang\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"input\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/id.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/id.ts","line":64,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/id.ts","line":65,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/id.ts","line":66,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/id.ts","line":77,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/id.ts","line":78,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/id.ts","line":84,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/id.ts","line":85,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/id.ts","line":93,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/is.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"stafi\", verb: \"að hafa\" },\n file: { unit: \"bæti\", verb: \"að hafa\" },\n array: { unit: \"hluti\", verb: \"að hafa\" },\n set: { unit: \"hluti\", verb: \"að hafa\" },\n map: { unit: \"hluti\", verb: \"að hafa\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"gildi\",\n email: \"netfang\",\n url: \"vefslóð\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO dagsetning og tími\",\n date: \"ISO dagsetning\",\n time: \"ISO tími\",\n duration: \"ISO tímalengd\",\n ipv4: \"IPv4 address\",\n ipv6: \"IPv6 address\",\n mac: \"MAC address\",\n cidrv4: \"IPv4 range\",\n cidrv6: \"IPv6 range\",\n base64: \"base64-encoded strengur\",\n base64url: \"base64url-encoded strengur\",\n json_string: \"JSON stren"} {"repo":"zod","file":"packages/zod/src/v4/locales/is.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"stafi\", verb: \"að hafa\" },\n file: { unit: \"bæti\", verb: \"að hafa\" },\n array: { unit: \"hluti\", verb: \"að hafa\" },\n set: { unit: \"hluti\", verb: \"að hafa\" },\n map: { unit: \"hluti\", verb: \"að hafa\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/is.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/is.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"gildi\",\n email: \"netfang\",\n url: \"vefslóð\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO dagsetning og tími\",\n date: \"ISO dagsetning\",\n time: \"ISO tími\",\n duration: \"ISO tímalengd\",\n ipv4: \"IPv4 address\",\n ipv6: \"IPv6 address\",\n mac: \"MAC address\",\n cidrv4: \"IPv4 range\",\n cidrv6: \"IPv6 range\",\n base64: \"base64-encoded strengur\",\n base64url: \"base64url-encoded strengur\",\n json_string: \"JSON strengur\",\n e164: \"E.164 tölugildi\",\n credit_card: \"kreditkortanúmer\",\n currency_code: \"gjaldmiðilskóði\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"gildi\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/is.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"númer\",\n array: \"fylki\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/is.ts","line":66,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/is.ts","line":67,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/is.ts","line":68,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/is.ts","line":79,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/is.ts","line":80,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/is.ts","line":86,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/is.ts","line":87,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/is.ts","line":95,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/it.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"caratteri\", verb: \"avere\" },\n file: { unit: \"byte\", verb: \"avere\" },\n array: { unit: \"elementi\", verb: \"avere\" },\n set: { unit: \"elementi\", verb: \"avere\" },\n map: { unit: \"elementi\", verb: \"avere\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"input\",\n email: \"indirizzo email\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"data e ora ISO\",\n date: \"data ISO\",\n time: \"ora ISO\",\n duration: \"durata ISO\",\n ipv4: \"indirizzo IPv4\",\n ipv6: \"indirizzo IPv6\",\n mac: \"indirizzo MAC\",\n cidrv4: \"intervallo IPv4\",\n cidrv6: \"intervallo IPv6\",\n base64: \"stringa codificata in base64\",\n base64url: \"URL codificata in base64\",\n json_string: \"st"} {"repo":"zod","file":"packages/zod/src/v4/locales/it.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"caratteri\", verb: \"avere\" },\n file: { unit: \"byte\", verb: \"avere\" },\n array: { unit: \"elementi\", verb: \"avere\" },\n set: { unit: \"elementi\", verb: \"avere\" },\n map: { unit: \"elementi\", verb: \"avere\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/it.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/it.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"input\",\n email: \"indirizzo email\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"data e ora ISO\",\n date: \"data ISO\",\n time: \"ora ISO\",\n duration: \"durata ISO\",\n ipv4: \"indirizzo IPv4\",\n ipv6: \"indirizzo IPv6\",\n mac: \"indirizzo MAC\",\n cidrv4: \"intervallo IPv4\",\n cidrv6: \"intervallo IPv6\",\n base64: \"stringa codificata in base64\",\n base64url: \"URL codificata in base64\",\n json_string: \"stringa JSON\",\n e164: \"numero E.164\",\n credit_card: \"numero di carta di credito\",\n currency_code: \"codice valuta\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"input\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/it.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"numero\",\n array: \"vettore\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/it.ts","line":66,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/it.ts","line":67,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/it.ts","line":68,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/it.ts","line":78,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/it.ts","line":79,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/it.ts","line":85,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/it.ts","line":86,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/it.ts","line":94,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ja.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"文字\", verb: \"である\" },\n file: { unit: \"バイト\", verb: \"である\" },\n array: { unit: \"要素\", verb: \"である\" },\n set: { unit: \"要素\", verb: \"である\" },\n map: { unit: \"要素\", verb: \"である\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"入力値\",\n email: \"メールアドレス\",\n url: \"URL\",\n emoji: \"絵文字\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO日時\",\n date: \"ISO日付\",\n time: \"ISO時刻\",\n duration: \"ISO期間\",\n ipv4: \"IPv4アドレス\",\n ipv6: \"IPv6アドレス\",\n mac: \"MACアドレス\",\n cidrv4: \"IPv4範囲\",\n cidrv6: \"IPv6範囲\",\n base64: \"base64エンコード文字列\",\n base64url: \"base64urlエンコード文字列\",\n json_string: \"JSON文字列\",\n e164: \"E.164番号\",\n credit_card: \"クレジットカード番号\",\n currency_code: \"通貨コード\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n "} {"repo":"zod","file":"packages/zod/src/v4/locales/ja.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"文字\", verb: \"である\" },\n file: { unit: \"バイト\", verb: \"である\" },\n array: { unit: \"要素\", verb: \"である\" },\n set: { unit: \"要素\", verb: \"である\" },\n map: { unit: \"要素\", verb: \"である\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ja.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/ja.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"入力値\",\n email: \"メールアドレス\",\n url: \"URL\",\n emoji: \"絵文字\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO日時\",\n date: \"ISO日付\",\n time: \"ISO時刻\",\n duration: \"ISO期間\",\n ipv4: \"IPv4アドレス\",\n ipv6: \"IPv6アドレス\",\n mac: \"MACアドレス\",\n cidrv4: \"IPv4範囲\",\n cidrv6: \"IPv6範囲\",\n base64: \"base64エンコード文字列\",\n base64url: \"base64urlエンコード文字列\",\n json_string: \"JSON文字列\",\n e164: \"E.164番号\",\n credit_card: \"クレジットカード番号\",\n currency_code: \"通貨コード\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"入力値\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ja.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"数値\",\n array: \"配列\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ja.ts","line":66,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ja.ts","line":67,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ja.ts","line":68,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ja.ts","line":78,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"以下である\" : \"より小さい\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ja.ts","line":79,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ja.ts","line":85,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"以上である\" : \"より大きい\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ja.ts","line":86,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ja.ts","line":92,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ka.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"სიმბოლო\", verb: \"უნდა შეიცავდეს\" },\n file: { unit: \"ბაიტი\", verb: \"უნდა შეიცავდეს\" },\n array: { unit: \"ელემენტი\", verb: \"უნდა შეიცავდეს\" },\n set: { unit: \"ელემენტი\", verb: \"უნდა შეიცავდეს\" },\n map: { unit: \"ელემენტი\", verb: \"უნდა შეიცავდეს\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"შეყვანა\",\n email: \"ელ-ფოსტის მისამართი\",\n url: \"URL\",\n emoji: \"ემოჯი\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"თარიღი-დრო\",\n date: \"თარიღი\",\n time: \"დრო\",\n duration: \"ხანგრძლივობა\",\n ipv4: \"IPv4 მისამართი\",\n ipv6: \"IPv6 მისამართი\",\n mac: \"MAC მისამართი\",\n cidrv4: \"IPv4 დიაპაზონი\",\n cidrv6: \"IPv6 დიაპაზონი\",\n base64: \"base64-კოდირებული ველი\",\n base64url: \"base64url-კოდ"} {"repo":"zod","file":"packages/zod/src/v4/locales/ka.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"სიმბოლო\", verb: \"უნდა შეიცავდეს\" },\n file: { unit: \"ბაიტი\", verb: \"უნდა შეიცავდეს\" },\n array: { unit: \"ელემენტი\", verb: \"უნდა შეიცავდეს\" },\n set: { unit: \"ელემენტი\", verb: \"უნდა შეიცავდეს\" },\n map: { unit: \"ელემენტი\", verb: \"უნდა შეიცავდეს\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ka.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/ka.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"შეყვანა\",\n email: \"ელ-ფოსტის მისამართი\",\n url: \"URL\",\n emoji: \"ემოჯი\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"თარიღი-დრო\",\n date: \"თარიღი\",\n time: \"დრო\",\n duration: \"ხანგრძლივობა\",\n ipv4: \"IPv4 მისამართი\",\n ipv6: \"IPv6 მისამართი\",\n mac: \"MAC მისამართი\",\n cidrv4: \"IPv4 დიაპაზონი\",\n cidrv6: \"IPv6 დიაპაზონი\",\n base64: \"base64-კოდირებული ველი\",\n base64url: \"base64url-კოდირებული ველი\",\n json_string: \"JSON ველი\",\n e164: \"E.164 ნომერი\",\n credit_card: \"საკრედიტო ბარათის ნომერი\",\n currency_code: \"ვალუტის კოდი\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"შეყვანა\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ka.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"რიცხვი\",\n string: \"ველი\",\n boolean: \"ბულეანი\",\n function: \"ფუნქცია\",\n array: \"მასივი\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ka.ts","line":69,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ka.ts","line":70,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ka.ts","line":71,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ka.ts","line":83,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ka.ts","line":84,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ka.ts","line":90,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ka.ts","line":91,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ka.ts","line":99,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/km.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"តួអក្សរ\", verb: \"គួរមាន\" },\n file: { unit: \"បៃ\", verb: \"គួរមាន\" },\n array: { unit: \"ធាតុ\", verb: \"គួរមាន\" },\n set: { unit: \"ធាតុ\", verb: \"គួរមាន\" },\n map: { unit: \"ធាតុ\", verb: \"គួរមាន\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ទិន្នន័យបញ្ចូល\",\n email: \"អាសយដ្ឋានអ៊ីមែល\",\n url: \"URL\",\n emoji: \"សញ្ញាអារម្មណ៍\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"កាលបរិច្ឆេទ និងម៉ោង ISO\",\n date: \"កាលបរិច្ឆេទ ISO\",\n time: \"ម៉ោង ISO\",\n duration: \"រយៈពេល ISO\",\n ipv4: \"អាសយដ្ឋាន IPv4\",\n ipv6: \"អាសយដ្ឋាន IPv6\",\n mac: \"អាសយដ្ឋាន MAC\",\n cidrv4: \"ដែនអាសយដ្ឋាន IPv4\",\n cidrv6: \"ដែនអាសយដ្ឋាន IPv6\",\n base64: \"ខ្សែអក្សរអ៊ិកូដ base64\",\n base64url: \"ខ្សែអក្សរអ៊ិកូដ base64url\""} {"repo":"zod","file":"packages/zod/src/v4/locales/km.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"តួអក្សរ\", verb: \"គួរមាន\" },\n file: { unit: \"បៃ\", verb: \"គួរមាន\" },\n array: { unit: \"ធាតុ\", verb: \"គួរមាន\" },\n set: { unit: \"ធាតុ\", verb: \"គួរមាន\" },\n map: { unit: \"ធាតុ\", verb: \"គួរមាន\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/km.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/km.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ទិន្នន័យបញ្ចូល\",\n email: \"អាសយដ្ឋានអ៊ីមែល\",\n url: \"URL\",\n emoji: \"សញ្ញាអារម្មណ៍\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"កាលបរិច្ឆេទ និងម៉ោង ISO\",\n date: \"កាលបរិច្ឆេទ ISO\",\n time: \"ម៉ោង ISO\",\n duration: \"រយៈពេល ISO\",\n ipv4: \"អាសយដ្ឋាន IPv4\",\n ipv6: \"អាសយដ្ឋាន IPv6\",\n mac: \"អាសយដ្ឋាន MAC\",\n cidrv4: \"ដែនអាសយដ្ឋាន IPv4\",\n cidrv6: \"ដែនអាសយដ្ឋាន IPv6\",\n base64: \"ខ្សែអក្សរអ៊ិកូដ base64\",\n base64url: \"ខ្សែអក្សរអ៊ិកូដ base64url\",\n json_string: \"ខ្សែអក្សរ JSON\",\n e164: \"លេខ E.164\",\n credit_card: \"លេខប័ណ្ណឥណទាន\",\n currency_code: \"កូដរូបិយប័ណ្ណ\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"ទិន្នន័យបញ្ចូល\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/km.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"លេខ\",\n array: \"អារេ (Array)\",\n null: \"គ្មានតម្លៃ (null)\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/km.ts","line":67,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/km.ts","line":68,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/km.ts","line":69,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/km.ts","line":79,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/km.ts","line":80,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/km.ts","line":86,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/km.ts","line":87,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/km.ts","line":95,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/kn.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"ಅಕ್ಷರಗಳು\", verb: \"ಹೊಂದಲು\" },\n file: { unit: \"ಬೈಟ್‌ಗಳು\", verb: \"ಹೊಂದಲು\" },\n array: { unit: \"ವಸ್ತುಗಳು\", verb: \"ಹೊಂದಲು\" },\n set: { unit: \"ವಸ್ತುಗಳು\", verb: \"ಹೊಂದಲು\" },\n map: { unit: \"entries\", verb: \"ಹೊಂದಲು\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ಇನ್ಪುಟ್\",\n email: \"email ವಿಳಾಸ\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO ದಿನಾಂಕದ ಸಮಯ\",\n date: \"ISO ದಿನಾಂಕ\",\n time: \"ISO ಸಮಯ\",\n duration: \"ISO ಅವಧಿ\",\n ipv4: \"IPv4 ವಿಳಾಸ\",\n ipv6: \"IPv6 ವಿಳಾಸ\",\n mac: \"MAC ವಿಳಾಸ\",\n cidrv4: \"IPv4 ವ್ಯಾಪ್ತಿಯ\",\n cidrv6: \"IPv6 ವ್ಯಾಪ್ತಿಯ\",\n base64: \"base64-encodedಸ್ಟ್ರಿಂಗ್\",\n base64url: \"base64url-encodedಸ್ಟ್ರಿಂಗ್\",\n json_string: \"JSONಸ್ಟ್ರಿಂಗ್"} {"repo":"zod","file":"packages/zod/src/v4/locales/kn.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"ಅಕ್ಷರಗಳು\", verb: \"ಹೊಂದಲು\" },\n file: { unit: \"ಬೈಟ್‌ಗಳು\", verb: \"ಹೊಂದಲು\" },\n array: { unit: \"ವಸ್ತುಗಳು\", verb: \"ಹೊಂದಲು\" },\n set: { unit: \"ವಸ್ತುಗಳು\", verb: \"ಹೊಂದಲು\" },\n map: { unit: \"entries\", verb: \"ಹೊಂದಲು\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/kn.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/kn.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ಇನ್ಪುಟ್\",\n email: \"email ವಿಳಾಸ\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO ದಿನಾಂಕದ ಸಮಯ\",\n date: \"ISO ದಿನಾಂಕ\",\n time: \"ISO ಸಮಯ\",\n duration: \"ISO ಅವಧಿ\",\n ipv4: \"IPv4 ವಿಳಾಸ\",\n ipv6: \"IPv6 ವಿಳಾಸ\",\n mac: \"MAC ವಿಳಾಸ\",\n cidrv4: \"IPv4 ವ್ಯಾಪ್ತಿಯ\",\n cidrv6: \"IPv6 ವ್ಯಾಪ್ತಿಯ\",\n base64: \"base64-encodedಸ್ಟ್ರಿಂಗ್\",\n base64url: \"base64url-encodedಸ್ಟ್ರಿಂಗ್\",\n json_string: \"JSONಸ್ಟ್ರಿಂಗ್\",\n e164: \"E.164 ಸಂಖ್ಯೆ\",\n credit_card: \"ಕ್ರೆಡಿಟ್ ಕಾರ್ಡ್ ಸಂಖ್ಯೆ\",\n currency_code: \"ಕರೆನ್ಸಿ ಕೋಡ್\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"ಇನ್ಪುಟ್\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/kn.ts","line":56,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","doc":"type names: missing keys = do not translate (use raw value via ?? fallback)","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n // Compatibility: \"nan\" -> \"NaN\" for display\n nan: \"NaN\",\n // All other type names omitted - they fall back to raw values via ?? operator\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/kn.ts","line":67,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/kn.ts","line":68,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/kn.ts","line":69,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/kn.ts","line":77,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/kn.ts","line":78,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/kn.ts","line":84,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/kn.ts","line":85,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/kn.ts","line":93,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/kn.ts","line":110,"symbol":"opts","kind":"constant","lang":"typescript","code":"const opts = issue.options.map((o) => `'${o}'`).join(\" | \");"} {"repo":"zod","file":"packages/zod/src/v4/locales/ko.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"문자\", verb: \"to have\" },\n file: { unit: \"바이트\", verb: \"to have\" },\n array: { unit: \"개\", verb: \"to have\" },\n set: { unit: \"개\", verb: \"to have\" },\n map: { unit: \"개\", verb: \"to have\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"입력\",\n email: \"이메일 주소\",\n url: \"URL\",\n emoji: \"이모지\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO 날짜시간\",\n date: \"ISO 날짜\",\n time: \"ISO 시간\",\n duration: \"ISO 기간\",\n ipv4: \"IPv4 주소\",\n ipv6: \"IPv6 주소\",\n mac: \"MAC 주소\",\n cidrv4: \"IPv4 범위\",\n cidrv6: \"IPv6 범위\",\n base64: \"base64 인코딩 문자열\",\n base64url: \"base64url 인코딩 문자열\",\n json_string: \"JSON 문자열\",\n e164: \"E.164 번호\",\n credit_card: \"신용카드 번호\",\n currency_code: \"통화 코드\",\n iban: \"IBAN\","} {"repo":"zod","file":"packages/zod/src/v4/locales/ko.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"문자\", verb: \"to have\" },\n file: { unit: \"바이트\", verb: \"to have\" },\n array: { unit: \"개\", verb: \"to have\" },\n set: { unit: \"개\", verb: \"to have\" },\n map: { unit: \"개\", verb: \"to have\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ko.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/ko.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"입력\",\n email: \"이메일 주소\",\n url: \"URL\",\n emoji: \"이모지\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO 날짜시간\",\n date: \"ISO 날짜\",\n time: \"ISO 시간\",\n duration: \"ISO 기간\",\n ipv4: \"IPv4 주소\",\n ipv6: \"IPv6 주소\",\n mac: \"MAC 주소\",\n cidrv4: \"IPv4 범위\",\n cidrv6: \"IPv6 범위\",\n base64: \"base64 인코딩 문자열\",\n base64url: \"base64url 인코딩 문자열\",\n json_string: \"JSON 문자열\",\n e164: \"E.164 번호\",\n credit_card: \"신용카드 번호\",\n currency_code: \"통화 코드\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"입력\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ko.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ko.ts","line":64,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ko.ts","line":65,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ko.ts","line":66,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ko.ts","line":77,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"이하\" : \"미만\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ko.ts","line":78,"symbol":"suffix","kind":"constant","lang":"typescript","code":"const suffix = adj === \"미만\" ? \"이어야 합니다\" : \"여야 합니다\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ko.ts","line":79,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ko.ts","line":80,"symbol":"unit","kind":"constant","lang":"typescript","code":"const unit = sizing?.unit ?? \"요소\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ko.ts","line":86,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"이상\" : \"초과\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ko.ts","line":87,"symbol":"suffix","kind":"constant","lang":"typescript","code":"const suffix = adj === \"이상\" ? \"이어야 합니다\" : \"여야 합니다\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ko.ts","line":88,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ko.ts","line":89,"symbol":"unit","kind":"constant","lang":"typescript","code":"const unit = sizing?.unit ?? \"요소\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ko.ts","line":97,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":5,"symbol":"capitalizeFirstCharacter","kind":"constant","lang":"typescript","code":"const capitalizeFirstCharacter = (text: string): string => {\n return text.charAt(0).toUpperCase() + text.slice(1);\n};"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":9,"symbol":"UnitType","kind":"type","lang":"typescript","code":"type UnitType = \"one\" | \"few\" | \"many\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":10,"symbol":"SizeableComparisonType","kind":"type","lang":"typescript","code":"type SizeableComparisonType = \"smaller\" | \"bigger\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":12,"symbol":"getUnitTypeFromNumber","kind":"function","lang":"typescript","code":"function getUnitTypeFromNumber(number: number): UnitType {\n const abs = Math.abs(number);\n const last = abs % 10;\n const last2 = abs % 100;\n\n if ((last2 >= 11 && last2 <= 19) || last === 0) return \"many\";\n if (last === 1) return \"one\";\n return \"few\";\n}"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":13,"symbol":"abs","kind":"constant","lang":"typescript","code":"const abs = Math.abs(number);"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":14,"symbol":"last","kind":"constant","lang":"typescript","code":"const last = abs % 10;"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":15,"symbol":"last2","kind":"constant","lang":"typescript","code":"const last2 = abs % 100;"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":22,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<\n string,\n {\n unit: Record<UnitType, string>;\n verb: Record<SizeableComparisonType, { inclusive: string; notInclusive: string }>;\n }\n > = {\n string: {\n unit: {\n one: \"simbolis\",\n few: \"simboliai\",\n many: \"simbolių\",\n },\n verb: {\n smaller: {\n inclusive: \"turi būti ne ilgesnė kaip\",\n notInclusive: \"turi būti trumpesnė kaip\",\n },\n bigger: {\n inclusive: \"turi būti ne trumpesnė kaip\",\n notInclusive: \"turi būti ilgesnė kaip\",\n },\n },\n },\n file: {\n unit: {\n one: \"baitas\",\n few: \"baitai\",\n many: \"baitų\",\n },\n verb: {\n smaller: {\n inclusive: \"turi būti ne didesnis kaip\",\n notInclusive: \"turi būti mažesnis kaip\",\n },\n bigger: {\n inclusive: \"turi būti ne mažesnis kaip\",\n notInclusive: \"turi būti didesnis kaip\",\n },\n },\n },\n array: {\n unit: {\n one: \"elementą\",\n few: \"elementus\",\n many: \"elementų\",\n },\n verb: {\n smaller: {\n inclusi"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":23,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<\n string,\n {\n unit: Record<UnitType, string>;\n verb: Record<SizeableComparisonType, { inclusive: string; notInclusive: string }>;\n }\n > = {\n string: {\n unit: {\n one: \"simbolis\",\n few: \"simboliai\",\n many: \"simbolių\",\n },\n verb: {\n smaller: {\n inclusive: \"turi būti ne ilgesnė kaip\",\n notInclusive: \"turi būti trumpesnė kaip\",\n },\n bigger: {\n inclusive: \"turi būti ne trumpesnė kaip\",\n notInclusive: \"turi būti ilgesnė kaip\",\n },\n },\n },\n file: {\n unit: {\n one: \"baitas\",\n few: \"baitai\",\n many: \"baitų\",\n },\n verb: {\n smaller: {\n inclusive: \"turi būti ne didesnis kaip\",\n notInclusive: \"turi būti mažesnis kaip\",\n },\n bigger: {\n inclusive: \"turi būti ne mažesnis kaip\",\n notInclusive: \"turi būti didesnis kaip\",\n },\n },\n },\n array: {\n unit: {\n one: \"elementą\",\n few: \"elementus\",\n many: \"elementų\",\n },\n verb: {\n smaller: {\n inclusive: \"turi turėti ne daugiau kaip\",\n notInc"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":100,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(\n origin: string,\n unitType: UnitType,\n inclusive: boolean,\n targetShouldBe: SizeableComparisonType\n ): {\n unit: string;\n verb: string;\n } | null {\n const result = Sizable[origin] ?? null;\n if (result === null) return result;\n\n return {\n unit: result.unit[unitType],\n verb: result.verb[targetShouldBe][inclusive ? \"inclusive\" : \"notInclusive\"],\n };\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":109,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = Sizable[origin] ?? null;"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":118,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"įvestis\",\n email: \"el. pašto adresas\",\n url: \"URL\",\n emoji: \"jaustukas\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO data ir laikas\",\n date: \"ISO data\",\n time: \"ISO laikas\",\n duration: \"ISO trukmė\",\n ipv4: \"IPv4 adresas\",\n ipv6: \"IPv6 adresas\",\n mac: \"MAC adresas\",\n cidrv4: \"IPv4 tinklo prefiksas (CIDR)\",\n cidrv6: \"IPv6 tinklo prefiksas (CIDR)\",\n base64: \"base64 užkoduota eilutė\",\n base64url: \"base64url užkoduota eilutė\",\n json_string: \"JSON eilutė\",\n e164: \"E.164 numeris\",\n credit_card: \"kredito kortelės numeris\",\n currency_code: \"valiutos kodas\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"įvestis\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":155,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"skaičius\",\n bigint: \"sveikasis skaičius\",\n string: \"eilutė\",\n boolean: \"loginė reikšmė\",\n undefined: \"neapibrėžta reikšmė\",\n function: \"funkcija\",\n symbol: \"simbolis\",\n array: \"masyvas\",\n object: \"objektas\",\n null: \"nulinė reikšmė\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":174,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":175,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":176,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":186,"symbol":"origin","kind":"constant","lang":"typescript","code":"const origin = TypeDictionary[issue.origin] ?? issue.origin;"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":187,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(\n issue.origin,\n getUnitTypeFromNumber(Number(issue.maximum)),\n issue.inclusive ?? false,\n \"smaller\"\n );"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":195,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"ne didesnis kaip\" : \"mažesnis kaip\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":199,"symbol":"origin","kind":"constant","lang":"typescript","code":"const origin = TypeDictionary[issue.origin] ?? issue.origin;"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":200,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(\n issue.origin,\n getUnitTypeFromNumber(Number(issue.minimum)),\n issue.inclusive ?? false,\n \"bigger\"\n );"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":208,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"ne mažesnis kaip\" : \"didesnis kaip\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":212,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/lt.ts","line":230,"symbol":"origin","kind":"constant","lang":"typescript","code":"const origin = TypeDictionary[issue.origin] ?? issue.origin;"} {"repo":"zod","file":"packages/zod/src/v4/locales/mk.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"знаци\", verb: \"да имаат\" },\n file: { unit: \"бајти\", verb: \"да имаат\" },\n array: { unit: \"ставки\", verb: \"да имаат\" },\n set: { unit: \"ставки\", verb: \"да имаат\" },\n map: { unit: \"ставки\", verb: \"да имаат\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"внес\",\n email: \"адреса на е-пошта\",\n url: \"URL\",\n emoji: \"емоџи\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO датум и време\",\n date: \"ISO датум\",\n time: \"ISO време\",\n duration: \"ISO времетраење\",\n ipv4: \"IPv4 адреса\",\n ipv6: \"IPv6 адреса\",\n mac: \"MAC адреса\",\n cidrv4: \"IPv4 опсег\",\n cidrv6: \"IPv6 опсег\",\n base64: \"base64-енкодирана низа\",\n base64url: \"base64url-енкодирана низа\",\n json_string: \"JSON низ"} {"repo":"zod","file":"packages/zod/src/v4/locales/mk.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"знаци\", verb: \"да имаат\" },\n file: { unit: \"бајти\", verb: \"да имаат\" },\n array: { unit: \"ставки\", verb: \"да имаат\" },\n set: { unit: \"ставки\", verb: \"да имаат\" },\n map: { unit: \"ставки\", verb: \"да имаат\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/mk.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/mk.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"внес\",\n email: \"адреса на е-пошта\",\n url: \"URL\",\n emoji: \"емоџи\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO датум и време\",\n date: \"ISO датум\",\n time: \"ISO време\",\n duration: \"ISO времетраење\",\n ipv4: \"IPv4 адреса\",\n ipv6: \"IPv6 адреса\",\n mac: \"MAC адреса\",\n cidrv4: \"IPv4 опсег\",\n cidrv6: \"IPv6 опсег\",\n base64: \"base64-енкодирана низа\",\n base64url: \"base64url-енкодирана низа\",\n json_string: \"JSON низа\",\n e164: \"E.164 број\",\n credit_card: \"број на кредитна картичка\",\n currency_code: \"код на валута\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"внес\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/mk.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"број\",\n array: \"низа\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/mk.ts","line":66,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/mk.ts","line":67,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/mk.ts","line":68,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/mk.ts","line":78,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/mk.ts","line":79,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/mk.ts","line":85,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/mk.ts","line":86,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/mk.ts","line":94,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ms.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"aksara\", verb: \"mempunyai\" },\n file: { unit: \"bait\", verb: \"mempunyai\" },\n array: { unit: \"elemen\", verb: \"mempunyai\" },\n set: { unit: \"elemen\", verb: \"mempunyai\" },\n map: { unit: \"elemen\", verb: \"mempunyai\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"input\",\n email: \"alamat e-mel\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"tarikh masa ISO\",\n date: \"tarikh ISO\",\n time: \"masa ISO\",\n duration: \"tempoh ISO\",\n ipv4: \"alamat IPv4\",\n ipv6: \"alamat IPv6\",\n mac: \"alamat MAC\",\n cidrv4: \"julat IPv4\",\n cidrv6: \"julat IPv6\",\n base64: \"string dikodkan base64\",\n base64url: \"string dikodkan base64url\",\n json_string: \"string JSON\",\n"} {"repo":"zod","file":"packages/zod/src/v4/locales/ms.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"aksara\", verb: \"mempunyai\" },\n file: { unit: \"bait\", verb: \"mempunyai\" },\n array: { unit: \"elemen\", verb: \"mempunyai\" },\n set: { unit: \"elemen\", verb: \"mempunyai\" },\n map: { unit: \"elemen\", verb: \"mempunyai\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ms.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/ms.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"input\",\n email: \"alamat e-mel\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"tarikh masa ISO\",\n date: \"tarikh ISO\",\n time: \"masa ISO\",\n duration: \"tempoh ISO\",\n ipv4: \"alamat IPv4\",\n ipv6: \"alamat IPv6\",\n mac: \"alamat MAC\",\n cidrv4: \"julat IPv4\",\n cidrv6: \"julat IPv6\",\n base64: \"string dikodkan base64\",\n base64url: \"string dikodkan base64url\",\n json_string: \"string JSON\",\n e164: \"nombor E.164\",\n credit_card: \"nombor kad kredit\",\n currency_code: \"kod mata wang\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"input\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ms.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"nombor\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ms.ts","line":65,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ms.ts","line":66,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ms.ts","line":67,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ms.ts","line":77,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ms.ts","line":78,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ms.ts","line":84,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ms.ts","line":85,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ms.ts","line":93,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ne.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"अक्षर\", verb: \"हुनुपर्छ\" },\n file: { unit: \"बाइट\", verb: \"हुनुपर्छ\" },\n array: { unit: \"तत्व\", verb: \"हुनुपर्छ\" },\n set: { unit: \"तत्व\", verb: \"हुनुपर्छ\" },\n map: { unit: \"प्रविष्टि\", verb: \"हुनुपर्छ\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"इनपुट\",\n email: \"इमेल ठेगाना\",\n url: \"URL\",\n emoji: \"इमोजी\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO मिति र समय\",\n date: \"ISO मिति\",\n time: \"ISO समय\",\n duration: \"ISO अवधि\",\n ipv4: \"IPv4 ठेगाना\",\n ipv6: \"IPv6 ठेगाना\",\n mac: \"MAC ठेगाना\",\n cidrv4: \"IPv4 दायरा\",\n cidrv6: \"IPv6 दायरा\",\n base64: \"base64-इन्कोड गरिएको स्ट्रिङ\",\n base64url: \"base64url-इन्कोड गरिएको स्ट्रिङ\",\n json_string: \"JSON स्ट्रिङ\",\n "} {"repo":"zod","file":"packages/zod/src/v4/locales/ne.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"अक्षर\", verb: \"हुनुपर्छ\" },\n file: { unit: \"बाइट\", verb: \"हुनुपर्छ\" },\n array: { unit: \"तत्व\", verb: \"हुनुपर्छ\" },\n set: { unit: \"तत्व\", verb: \"हुनुपर्छ\" },\n map: { unit: \"प्रविष्टि\", verb: \"हुनुपर्छ\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ne.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/ne.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"इनपुट\",\n email: \"इमेल ठेगाना\",\n url: \"URL\",\n emoji: \"इमोजी\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO मिति र समय\",\n date: \"ISO मिति\",\n time: \"ISO समय\",\n duration: \"ISO अवधि\",\n ipv4: \"IPv4 ठेगाना\",\n ipv6: \"IPv6 ठेगाना\",\n mac: \"MAC ठेगाना\",\n cidrv4: \"IPv4 दायरा\",\n cidrv6: \"IPv6 दायरा\",\n base64: \"base64-इन्कोड गरिएको स्ट्रिङ\",\n base64url: \"base64url-इन्कोड गरिएको स्ट्रिङ\",\n json_string: \"JSON स्ट्रिङ\",\n e164: \"E.164 नम्बर\",\n credit_card: \"क्रेडिट कार्ड नम्बर\",\n currency_code: \"मुद्रा कोड\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"इनपुट\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ne.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ne.ts","line":64,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ne.ts","line":65,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ne.ts","line":66,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ne.ts","line":75,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ne.ts","line":76,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ne.ts","line":83,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ne.ts","line":84,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ne.ts","line":91,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ne.ts","line":110,"symbol":"opts","kind":"constant","lang":"typescript","code":"const opts = issue.options.map((o) => `'${o}'`).join(\" | \");"} {"repo":"zod","file":"packages/zod/src/v4/locales/nl.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"tekens\", verb: \"heeft\" },\n file: { unit: \"bytes\", verb: \"heeft\" },\n array: { unit: \"elementen\", verb: \"heeft\" },\n set: { unit: \"elementen\", verb: \"heeft\" },\n map: { unit: \"elementen\", verb: \"heeft\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"invoer\",\n email: \"emailadres\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO datum en tijd\",\n date: \"ISO datum\",\n time: \"ISO tijd\",\n duration: \"ISO duur\",\n ipv4: \"IPv4-adres\",\n ipv6: \"IPv6-adres\",\n mac: \"MAC-adres\",\n cidrv4: \"IPv4-bereik\",\n cidrv6: \"IPv6-bereik\",\n base64: \"base64-gecodeerde tekst\",\n base64url: \"base64 URL-gecodeerde tekst\",\n json_string: \"JSON string\",\n e164: "} {"repo":"zod","file":"packages/zod/src/v4/locales/nl.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"tekens\", verb: \"heeft\" },\n file: { unit: \"bytes\", verb: \"heeft\" },\n array: { unit: \"elementen\", verb: \"heeft\" },\n set: { unit: \"elementen\", verb: \"heeft\" },\n map: { unit: \"elementen\", verb: \"heeft\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/nl.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/nl.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"invoer\",\n email: \"emailadres\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO datum en tijd\",\n date: \"ISO datum\",\n time: \"ISO tijd\",\n duration: \"ISO duur\",\n ipv4: \"IPv4-adres\",\n ipv6: \"IPv6-adres\",\n mac: \"MAC-adres\",\n cidrv4: \"IPv4-bereik\",\n cidrv6: \"IPv6-bereik\",\n base64: \"base64-gecodeerde tekst\",\n base64url: \"base64 URL-gecodeerde tekst\",\n json_string: \"JSON string\",\n e164: \"E.164-nummer\",\n credit_card: \"creditcardnummer\",\n currency_code: \"valutacode\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"invoer\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/nl.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"getal\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/nl.ts","line":65,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/nl.ts","line":66,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/nl.ts","line":67,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/nl.ts","line":77,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/nl.ts","line":78,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/nl.ts","line":79,"symbol":"longName","kind":"constant","lang":"typescript","code":"const longName = issue.origin === \"date\" ? \"laat\" : issue.origin === \"string\" ? \"lang\" : \"groot\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/nl.ts","line":86,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/nl.ts","line":87,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/nl.ts","line":88,"symbol":"shortName","kind":"constant","lang":"typescript","code":"const shortName = issue.origin === \"date\" ? \"vroeg\" : issue.origin === \"string\" ? \"kort\" : \"klein\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/nl.ts","line":97,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/nn.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"teikn\", verb: \"å ha\" },\n file: { unit: \"bytes\", verb: \"å ha\" },\n array: { unit: \"element\", verb: \"å innehalde\" },\n set: { unit: \"element\", verb: \"å innehalde\" },\n map: { unit: \"element\", verb: \"å innehalde\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"input\",\n email: \"e-postadresse\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO dato- og klokkeslett\",\n date: \"ISO-dato\",\n time: \"ISO-klokkeslett\",\n duration: \"ISO-varigheit\",\n ipv4: \"IPv4-adresse\",\n ipv6: \"IPv6-adresse\",\n mac: \"MAC-adresse\",\n cidrv4: \"IPv4-spekter\",\n cidrv6: \"IPv6-spekter\",\n base64: \"base64-enkoda streng\",\n base64url: \"base64url-enkoda streng\",\n json_str"} {"repo":"zod","file":"packages/zod/src/v4/locales/nn.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"teikn\", verb: \"å ha\" },\n file: { unit: \"bytes\", verb: \"å ha\" },\n array: { unit: \"element\", verb: \"å innehalde\" },\n set: { unit: \"element\", verb: \"å innehalde\" },\n map: { unit: \"element\", verb: \"å innehalde\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/nn.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/nn.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"input\",\n email: \"e-postadresse\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO dato- og klokkeslett\",\n date: \"ISO-dato\",\n time: \"ISO-klokkeslett\",\n duration: \"ISO-varigheit\",\n ipv4: \"IPv4-adresse\",\n ipv6: \"IPv6-adresse\",\n mac: \"MAC-adresse\",\n cidrv4: \"IPv4-spekter\",\n cidrv6: \"IPv6-spekter\",\n base64: \"base64-enkoda streng\",\n base64url: \"base64url-enkoda streng\",\n json_string: \"JSON-streng\",\n e164: \"E.164-nummer\",\n credit_card: \"kredittkortnummer\",\n currency_code: \"valutakode\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"input\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/nn.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"tal\",\n array: \"liste\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/nn.ts","line":66,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/nn.ts","line":67,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/nn.ts","line":68,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/nn.ts","line":78,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/nn.ts","line":79,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/nn.ts","line":85,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/nn.ts","line":86,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/nn.ts","line":94,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/no.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"tegn\", verb: \"å ha\" },\n file: { unit: \"bytes\", verb: \"å ha\" },\n array: { unit: \"elementer\", verb: \"å inneholde\" },\n set: { unit: \"elementer\", verb: \"å inneholde\" },\n map: { unit: \"elementer\", verb: \"å inneholde\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"input\",\n email: \"e-postadresse\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO dato- og klokkeslett\",\n date: \"ISO-dato\",\n time: \"ISO-klokkeslett\",\n duration: \"ISO-varighet\",\n ipv4: \"IPv4-adresse\",\n ipv6: \"IPv6-adresse\",\n mac: \"MAC-adresse\",\n cidrv4: \"IPv4-spekter\",\n cidrv6: \"IPv6-spekter\",\n base64: \"base64-enkodet streng\",\n base64url: \"base64url-enkodet streng\",\n js"} {"repo":"zod","file":"packages/zod/src/v4/locales/no.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"tegn\", verb: \"å ha\" },\n file: { unit: \"bytes\", verb: \"å ha\" },\n array: { unit: \"elementer\", verb: \"å inneholde\" },\n set: { unit: \"elementer\", verb: \"å inneholde\" },\n map: { unit: \"elementer\", verb: \"å inneholde\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/no.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/no.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"input\",\n email: \"e-postadresse\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO dato- og klokkeslett\",\n date: \"ISO-dato\",\n time: \"ISO-klokkeslett\",\n duration: \"ISO-varighet\",\n ipv4: \"IPv4-adresse\",\n ipv6: \"IPv6-adresse\",\n mac: \"MAC-adresse\",\n cidrv4: \"IPv4-spekter\",\n cidrv6: \"IPv6-spekter\",\n base64: \"base64-enkodet streng\",\n base64url: \"base64url-enkodet streng\",\n json_string: \"JSON-streng\",\n e164: \"E.164-nummer\",\n credit_card: \"kredittkortnummer\",\n currency_code: \"valutakode\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"input\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/no.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"tall\",\n array: \"liste\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/no.ts","line":66,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/no.ts","line":67,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/no.ts","line":68,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/no.ts","line":78,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/no.ts","line":79,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/no.ts","line":85,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/no.ts","line":86,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/no.ts","line":94,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ota.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"harf\", verb: \"olmalıdır\" },\n file: { unit: \"bayt\", verb: \"olmalıdır\" },\n array: { unit: \"unsur\", verb: \"olmalıdır\" },\n set: { unit: \"unsur\", verb: \"olmalıdır\" },\n map: { unit: \"unsur\", verb: \"olmalıdır\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"giren\",\n email: \"epostagâh\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO hengâmı\",\n date: \"ISO tarihi\",\n time: \"ISO zamanı\",\n duration: \"ISO müddeti\",\n ipv4: \"IPv4 nişânı\",\n ipv6: \"IPv6 nişânı\",\n mac: \"MAC nişânı\",\n cidrv4: \"IPv4 menzili\",\n cidrv6: \"IPv6 menzili\",\n base64: \"base64-şifreli metin\",\n base64url: \"base64url-şifreli metin\",\n json_string: \"JSON metin\",\n e164: "} {"repo":"zod","file":"packages/zod/src/v4/locales/ota.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"harf\", verb: \"olmalıdır\" },\n file: { unit: \"bayt\", verb: \"olmalıdır\" },\n array: { unit: \"unsur\", verb: \"olmalıdır\" },\n set: { unit: \"unsur\", verb: \"olmalıdır\" },\n map: { unit: \"unsur\", verb: \"olmalıdır\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ota.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/ota.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"giren\",\n email: \"epostagâh\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO hengâmı\",\n date: \"ISO tarihi\",\n time: \"ISO zamanı\",\n duration: \"ISO müddeti\",\n ipv4: \"IPv4 nişânı\",\n ipv6: \"IPv6 nişânı\",\n mac: \"MAC nişânı\",\n cidrv4: \"IPv4 menzili\",\n cidrv6: \"IPv6 menzili\",\n base64: \"base64-şifreli metin\",\n base64url: \"base64url-şifreli metin\",\n json_string: \"JSON metin\",\n e164: \"E.164 sayısı\",\n credit_card: \"i'tibâr kartı numarası\",\n currency_code: \"para birimi kodu\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"giren\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ota.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"numara\",\n array: \"saf\",\n null: \"gayb\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ota.ts","line":67,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ota.ts","line":68,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ota.ts","line":69,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ota.ts","line":79,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ota.ts","line":80,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ota.ts","line":86,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ota.ts","line":87,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ota.ts","line":95,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/pl.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"znaków\", verb: \"mieć\" },\n file: { unit: \"bajtów\", verb: \"mieć\" },\n array: { unit: \"elementów\", verb: \"mieć\" },\n set: { unit: \"elementów\", verb: \"mieć\" },\n map: { unit: \"elementów\", verb: \"mieć\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"wyrażenie\",\n email: \"adres email\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"data i godzina w formacie ISO\",\n date: \"data w formacie ISO\",\n time: \"godzina w formacie ISO\",\n duration: \"czas trwania ISO\",\n ipv4: \"adres IPv4\",\n ipv6: \"adres IPv6\",\n mac: \"adres MAC\",\n cidrv4: \"zakres IPv4\",\n cidrv6: \"zakres IPv6\",\n base64: \"ciąg znaków zakodowany w formacie base64\",\n base64url: \"ciąg znaków"} {"repo":"zod","file":"packages/zod/src/v4/locales/pl.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"znaków\", verb: \"mieć\" },\n file: { unit: \"bajtów\", verb: \"mieć\" },\n array: { unit: \"elementów\", verb: \"mieć\" },\n set: { unit: \"elementów\", verb: \"mieć\" },\n map: { unit: \"elementów\", verb: \"mieć\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/pl.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/pl.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"wyrażenie\",\n email: \"adres email\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"data i godzina w formacie ISO\",\n date: \"data w formacie ISO\",\n time: \"godzina w formacie ISO\",\n duration: \"czas trwania ISO\",\n ipv4: \"adres IPv4\",\n ipv6: \"adres IPv6\",\n mac: \"adres MAC\",\n cidrv4: \"zakres IPv4\",\n cidrv6: \"zakres IPv6\",\n base64: \"ciąg znaków zakodowany w formacie base64\",\n base64url: \"ciąg znaków zakodowany w formacie base64url\",\n json_string: \"ciąg znaków w formacie JSON\",\n e164: \"liczba E.164\",\n credit_card: \"numer karty kredytowej\",\n currency_code: \"kod waluty\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"wejście\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/pl.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"liczba\",\n array: \"tablica\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/pl.ts","line":66,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/pl.ts","line":67,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/pl.ts","line":68,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/pl.ts","line":79,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/pl.ts","line":80,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/pl.ts","line":87,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/pl.ts","line":88,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/pl.ts","line":95,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ps.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"توکي\", verb: \"ولري\" },\n file: { unit: \"بایټس\", verb: \"ولري\" },\n array: { unit: \"توکي\", verb: \"ولري\" },\n set: { unit: \"توکي\", verb: \"ولري\" },\n map: { unit: \"توکي\", verb: \"ولري\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ورودي\",\n email: \"بریښنالیک\",\n url: \"یو آر ال\",\n emoji: \"ایموجي\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"نیټه او وخت\",\n date: \"نېټه\",\n time: \"وخت\",\n duration: \"موده\",\n ipv4: \"د IPv4 پته\",\n ipv6: \"د IPv6 پته\",\n mac: \"د MAC پته\",\n cidrv4: \"د IPv4 ساحه\",\n cidrv6: \"د IPv6 ساحه\",\n base64: \"base64-encoded متن\",\n base64url: \"base64url-encoded متن\",\n json_string: \"JSON متن\",\n e164: \"د E.164 شمېره\",\n credit_card: \"د کریډیټ کارت شمی"} {"repo":"zod","file":"packages/zod/src/v4/locales/ps.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"توکي\", verb: \"ولري\" },\n file: { unit: \"بایټس\", verb: \"ولري\" },\n array: { unit: \"توکي\", verb: \"ولري\" },\n set: { unit: \"توکي\", verb: \"ولري\" },\n map: { unit: \"توکي\", verb: \"ولري\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ps.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/ps.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ورودي\",\n email: \"بریښنالیک\",\n url: \"یو آر ال\",\n emoji: \"ایموجي\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"نیټه او وخت\",\n date: \"نېټه\",\n time: \"وخت\",\n duration: \"موده\",\n ipv4: \"د IPv4 پته\",\n ipv6: \"د IPv6 پته\",\n mac: \"د MAC پته\",\n cidrv4: \"د IPv4 ساحه\",\n cidrv6: \"د IPv6 ساحه\",\n base64: \"base64-encoded متن\",\n base64url: \"base64url-encoded متن\",\n json_string: \"JSON متن\",\n e164: \"د E.164 شمېره\",\n credit_card: \"د کریډیټ کارت شمیره\",\n currency_code: \"د اسعارو کوډ\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"ورودي\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ps.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"عدد\",\n array: \"ارې\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ps.ts","line":66,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ps.ts","line":67,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ps.ts","line":68,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ps.ts","line":80,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ps.ts","line":81,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ps.ts","line":88,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ps.ts","line":89,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ps.ts","line":96,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":6,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string }> = {\n string: { unit: \"caracteres\" },\n file: { unit: \"bytes\" },\n array: { unit: \"elementos\" },\n set: { unit: \"elementos\" },\n map: { unit: \"entradas\" },\n };\n\n function getSizing(origin: string): { unit: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"a entrada\",\n email: \"o endereço de e-mail\",\n url: \"o URL\",\n emoji: \"o emoji\",\n uuid: \"o UUID\",\n uuidv4: \"o UUIDv4\",\n uuidv6: \"o UUIDv6\",\n nanoid: \"o nanoid\",\n guid: \"o GUID\",\n cuid: \"o cuid\",\n cuid2: \"o cuid2\",\n ulid: \"o ULID\",\n xid: \"o XID\",\n ksuid: \"o KSUID\",\n datetime: \"a data e hora ISO\",\n date: \"a data ISO\",\n time: \"a hora ISO\",\n duration: \"a duração ISO\",\n ipv4: \"o endereço IPv4\",\n ipv6: \"o endereço IPv6\",\n mac: \"o endereço MAC\",\n cidrv4: \"a faixa de endereços IPv4\",\n cidrv6: \"a faixa de endereços IPv6\",\n base64: \"o texto codificado em base64\",\n base64url: \"o texto codificado em base64url\",\n json_string: \"o texto JSON\",\n e164: \"o"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":7,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string }> = {\n string: { unit: \"caracteres\" },\n file: { unit: \"bytes\" },\n array: { unit: \"elementos\" },\n set: { unit: \"elementos\" },\n map: { unit: \"entradas\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":15,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":19,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"a entrada\",\n email: \"o endereço de e-mail\",\n url: \"o URL\",\n emoji: \"o emoji\",\n uuid: \"o UUID\",\n uuidv4: \"o UUIDv4\",\n uuidv6: \"o UUIDv6\",\n nanoid: \"o nanoid\",\n guid: \"o GUID\",\n cuid: \"o cuid\",\n cuid2: \"o cuid2\",\n ulid: \"o ULID\",\n xid: \"o XID\",\n ksuid: \"o KSUID\",\n datetime: \"a data e hora ISO\",\n date: \"a data ISO\",\n time: \"a hora ISO\",\n duration: \"a duração ISO\",\n ipv4: \"o endereço IPv4\",\n ipv6: \"o endereço IPv6\",\n mac: \"o endereço MAC\",\n cidrv4: \"a faixa de endereços IPv4\",\n cidrv6: \"a faixa de endereços IPv6\",\n base64: \"o texto codificado em base64\",\n base64url: \"o texto codificado em base64url\",\n json_string: \"o texto JSON\",\n e164: \"o número E.164\",\n credit_card: \"o número de cartão de crédito\",\n currency_code: \"o código de moeda\",\n iban: \"o IBAN\",\n jwt: \"o JWT\",\n template_literal: \"a entrada\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":56,"symbol":"Articles","kind":"type","lang":"typescript","code":"type Articles = { definite: string; indefinite: string };"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":58,"symbol":"Gender","kind":"constant","lang":"typescript","code":"const Gender: { [k in \"masculine\" | \"feminine\"]: Articles } = {\n masculine: { definite: \"o\", indefinite: \"um\" },\n feminine: { definite: \"a\", indefinite: \"uma\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":63,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: { name: string; articles: Articles };\n } = {\n string: { name: \"texto\", articles: Gender.masculine },\n number: { name: \"número\", articles: Gender.masculine },\n int: { name: \"número inteiro\", articles: Gender.masculine },\n boolean: { name: \"valor booleano\", articles: Gender.masculine },\n bigint: { name: \"número bigint\", articles: Gender.masculine },\n symbol: { name: \"símbolo\", articles: Gender.masculine },\n undefined: { name: 'valor \"undefined\"', articles: Gender.masculine },\n null: { name: 'valor \"nulo\"', articles: Gender.masculine },\n never: { name: 'valor \"never\"', articles: Gender.masculine },\n void: { name: 'valor \"void\"', articles: Gender.masculine },\n date: { name: \"data\", articles: Gender.feminine },\n array: { name: \"vetor\", articles: Gender.masculine },\n object: { name: \"objeto\", articles: Gender.masculine },\n tuple: { name: \"tupla\", articles: Gender.feminine },\n record: { name: \"registro\", articles: Gender.masculine },\n map: { name: \"mapa\", articles: Gender.masculine },\n set: { name: \"conjunto\", articles: Gender.masculine },\n file: { nam"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":89,"symbol":"translateOriginWithArticle","kind":"function","lang":"typescript","code":"function translateOriginWithArticle(\n type: $ZodInvalidTypeExpected | (string & {}),\n articleType: \"definite\" | \"indefinite\"\n ): string {\n const translatedValue = TypeDictionary[type] ?? { name: `valor \"${type}\"`, articles: Gender.masculine };\n return `${translatedValue.articles[articleType]} ${translatedValue.name}`;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":93,"symbol":"translatedValue","kind":"constant","lang":"typescript","code":"const translatedValue = TypeDictionary[type] ?? { name: `valor \"${type}\"`, articles: Gender.masculine };"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":100,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = translateOriginWithArticle(issue.expected, \"indefinite\");"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":101,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":102,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = translateOriginWithArticle(receivedType, \"indefinite\");"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":110,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":111,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":117,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":118,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":126,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":138,"symbol":"plural","kind":"constant","lang":"typescript","code":"const plural = issue.keys.length > 1 ? \"s\" : \"\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt-BR.ts","line":145,"symbol":"opts","kind":"constant","lang":"typescript","code":"const opts = issue.options.map((o) => `'${o}'`).join(\" | \");"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":6,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string }> = {\n string: { unit: \"caracteres\" },\n file: { unit: \"bytes\" },\n array: { unit: \"elementos\" },\n set: { unit: \"elementos\" },\n map: { unit: \"entradas\" },\n };\n\n function getSizing(origin: string): { unit: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"a entrada\",\n email: \"o endereço de e-mail\",\n url: \"o URL\",\n emoji: \"o emoji\",\n uuid: \"o UUID\",\n uuidv4: \"o UUIDv4\",\n uuidv6: \"o UUIDv6\",\n nanoid: \"o nanoid\",\n guid: \"o GUID\",\n cuid: \"o cuid\",\n cuid2: \"o cuid2\",\n ulid: \"o ULID\",\n xid: \"o XID\",\n ksuid: \"o KSUID\",\n datetime: \"a data e hora ISO\",\n date: \"a data ISO\",\n time: \"a hora ISO\",\n duration: \"a duração ISO\",\n ipv4: \"o endereço IPv4\",\n ipv6: \"o endereço IPv6\",\n mac: \"o endereço MAC\",\n cidrv4: \"o intervalo de endereços IPv4\",\n cidrv6: \"o intervalo de endereços IPv6\",\n base64: \"o texto codificado em base64\",\n base64url: \"o texto codificado em base64url\",\n json_string: \"o texto JSON\",\n "} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":7,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string }> = {\n string: { unit: \"caracteres\" },\n file: { unit: \"bytes\" },\n array: { unit: \"elementos\" },\n set: { unit: \"elementos\" },\n map: { unit: \"entradas\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":15,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":19,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"a entrada\",\n email: \"o endereço de e-mail\",\n url: \"o URL\",\n emoji: \"o emoji\",\n uuid: \"o UUID\",\n uuidv4: \"o UUIDv4\",\n uuidv6: \"o UUIDv6\",\n nanoid: \"o nanoid\",\n guid: \"o GUID\",\n cuid: \"o cuid\",\n cuid2: \"o cuid2\",\n ulid: \"o ULID\",\n xid: \"o XID\",\n ksuid: \"o KSUID\",\n datetime: \"a data e hora ISO\",\n date: \"a data ISO\",\n time: \"a hora ISO\",\n duration: \"a duração ISO\",\n ipv4: \"o endereço IPv4\",\n ipv6: \"o endereço IPv6\",\n mac: \"o endereço MAC\",\n cidrv4: \"o intervalo de endereços IPv4\",\n cidrv6: \"o intervalo de endereços IPv6\",\n base64: \"o texto codificado em base64\",\n base64url: \"o texto codificado em base64url\",\n json_string: \"o texto JSON\",\n e164: \"o número E.164\",\n credit_card: \"o número de cartão de crédito\",\n currency_code: \"o código de moeda\",\n iban: \"o IBAN\",\n jwt: \"o JWT\",\n template_literal: \"a entrada\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":56,"symbol":"Articles","kind":"type","lang":"typescript","code":"type Articles = { definite: string; indefinite: string };"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":58,"symbol":"Gender","kind":"constant","lang":"typescript","code":"const Gender: { [k in \"masculine\" | \"feminine\"]: Articles } = {\n masculine: { definite: \"o\", indefinite: \"um\" },\n feminine: { definite: \"a\", indefinite: \"uma\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":63,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: { name: string; articles: Articles };\n } = {\n string: { name: \"texto\", articles: Gender.masculine },\n number: { name: \"número\", articles: Gender.masculine },\n int: { name: \"número inteiro\", articles: Gender.masculine },\n boolean: { name: \"valor booleano\", articles: Gender.masculine },\n bigint: { name: \"número bigint\", articles: Gender.masculine },\n symbol: { name: \"símbolo\", articles: Gender.masculine },\n undefined: { name: 'valor \"undefined\"', articles: Gender.masculine },\n null: { name: 'valor \"nulo\"', articles: Gender.masculine },\n never: { name: 'valor \"never\"', articles: Gender.masculine },\n void: { name: 'valor \"void\"', articles: Gender.masculine },\n date: { name: \"data\", articles: Gender.feminine },\n array: { name: \"vetor\", articles: Gender.masculine },\n object: { name: \"objeto\", articles: Gender.masculine },\n tuple: { name: \"tuplo\", articles: Gender.masculine },\n record: { name: \"registo\", articles: Gender.masculine },\n map: { name: \"mapa\", articles: Gender.masculine },\n set: { name: \"conjunto\", articles: Gender.masculine },\n file: { nam"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":89,"symbol":"translateOriginWithArticle","kind":"function","lang":"typescript","code":"function translateOriginWithArticle(\n type: $ZodInvalidTypeExpected | (string & {}),\n articleType: \"definite\" | \"indefinite\"\n ): string {\n const translatedValue = TypeDictionary[type] ?? { name: `valor \"${type}\"`, articles: Gender.masculine };\n return `${translatedValue.articles[articleType]} ${translatedValue.name}`;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":93,"symbol":"translatedValue","kind":"constant","lang":"typescript","code":"const translatedValue = TypeDictionary[type] ?? { name: `valor \"${type}\"`, articles: Gender.masculine };"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":100,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = translateOriginWithArticle(issue.expected, \"indefinite\");"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":101,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":102,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = translateOriginWithArticle(receivedType, \"indefinite\");"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":110,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":111,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":117,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":118,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":126,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":136,"symbol":"plural","kind":"constant","lang":"typescript","code":"const plural = issue.keys.length > 1 ? \"s\" : \"\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/pt.ts","line":143,"symbol":"opts","kind":"constant","lang":"typescript","code":"const opts = issue.options.map((o) => `'${o}'`).join(\" | \");"} {"repo":"zod","file":"packages/zod/src/v4/locales/ro.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"caractere\", verb: \"să aibă\" },\n file: { unit: \"octeți\", verb: \"să aibă\" },\n array: { unit: \"elemente\", verb: \"să aibă\" },\n set: { unit: \"elemente\", verb: \"să aibă\" },\n map: { unit: \"intrări\", verb: \"să aibă\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"intrare\",\n email: \"adresă de email\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"dată și oră ISO\",\n date: \"dată ISO\",\n time: \"oră ISO\",\n duration: \"durată ISO\",\n ipv4: \"adresă IPv4\",\n ipv6: \"adresă IPv6\",\n mac: \"adresă MAC\",\n cidrv4: \"interval IPv4\",\n cidrv6: \"interval IPv6\",\n base64: \"șir codat base64\",\n base64url: \"șir codat base64url\",\n json_string: \"șir JSON\",\n e16"} {"repo":"zod","file":"packages/zod/src/v4/locales/ro.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"caractere\", verb: \"să aibă\" },\n file: { unit: \"octeți\", verb: \"să aibă\" },\n array: { unit: \"elemente\", verb: \"să aibă\" },\n set: { unit: \"elemente\", verb: \"să aibă\" },\n map: { unit: \"intrări\", verb: \"să aibă\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ro.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/ro.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"intrare\",\n email: \"adresă de email\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"dată și oră ISO\",\n date: \"dată ISO\",\n time: \"oră ISO\",\n duration: \"durată ISO\",\n ipv4: \"adresă IPv4\",\n ipv6: \"adresă IPv6\",\n mac: \"adresă MAC\",\n cidrv4: \"interval IPv4\",\n cidrv6: \"interval IPv6\",\n base64: \"șir codat base64\",\n base64url: \"șir codat base64url\",\n json_string: \"șir JSON\",\n e164: \"număr E.164\",\n credit_card: \"număr de card de credit\",\n currency_code: \"cod valutar\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"intrare\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ro.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n string: \"șir\",\n number: \"număr\",\n boolean: \"boolean\",\n function: \"funcție\",\n array: \"matrice\",\n object: \"obiect\",\n undefined: \"nedefinit\",\n symbol: \"simbol\",\n bigint: \"număr mare\",\n void: \"void\",\n never: \"never\",\n map: \"hartă\",\n set: \"set\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ro.ts","line":77,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ro.ts","line":78,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ro.ts","line":79,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ro.ts","line":87,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ro.ts","line":88,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ro.ts","line":94,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ro.ts","line":95,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ro.ts","line":103,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":5,"symbol":"getRussianPlural","kind":"function","lang":"typescript","code":"function getRussianPlural(count: number, one: string, few: string, many: string): string {\n const absCount = Math.abs(count);\n const lastDigit = absCount % 10;\n const lastTwoDigits = absCount % 100;\n\n if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {\n return many;\n }\n\n if (lastDigit === 1) {\n return one;\n }\n\n if (lastDigit >= 2 && lastDigit <= 4) {\n return few;\n }\n\n return many;\n}"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":6,"symbol":"absCount","kind":"constant","lang":"typescript","code":"const absCount = Math.abs(count);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":7,"symbol":"lastDigit","kind":"constant","lang":"typescript","code":"const lastDigit = absCount % 10;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":8,"symbol":"lastTwoDigits","kind":"constant","lang":"typescript","code":"const lastTwoDigits = absCount % 100;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":25,"symbol":"RussianSizable","kind":"interface","lang":"typescript","code":"interface RussianSizable {\n unit: {\n one: string;\n few: string;\n many: string;\n };\n verb: string;\n}"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":33,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, RussianSizable> = {\n string: {\n unit: {\n one: \"символ\",\n few: \"символа\",\n many: \"символов\",\n },\n verb: \"иметь\",\n },\n file: {\n unit: {\n one: \"байт\",\n few: \"байта\",\n many: \"байт\",\n },\n verb: \"иметь\",\n },\n array: {\n unit: {\n one: \"элемент\",\n few: \"элемента\",\n many: \"элементов\",\n },\n verb: \"иметь\",\n },\n set: {\n unit: {\n one: \"элемент\",\n few: \"элемента\",\n many: \"элементов\",\n },\n verb: \"иметь\",\n },\n map: {\n unit: {\n one: \"элемент\",\n few: \"элемента\",\n many: \"элементов\",\n },\n verb: \"иметь\",\n },\n };\n\n function getSizing(origin: string): RussianSizable | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ввод\",\n email: \"email адрес\",\n url: \"URL\",\n emoji: \"эмодзи\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cui"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":34,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, RussianSizable> = {\n string: {\n unit: {\n one: \"символ\",\n few: \"символа\",\n many: \"символов\",\n },\n verb: \"иметь\",\n },\n file: {\n unit: {\n one: \"байт\",\n few: \"байта\",\n many: \"байт\",\n },\n verb: \"иметь\",\n },\n array: {\n unit: {\n one: \"элемент\",\n few: \"элемента\",\n many: \"элементов\",\n },\n verb: \"иметь\",\n },\n set: {\n unit: {\n one: \"элемент\",\n few: \"элемента\",\n many: \"элементов\",\n },\n verb: \"иметь\",\n },\n map: {\n unit: {\n one: \"элемент\",\n few: \"элемента\",\n many: \"элементов\",\n },\n verb: \"иметь\",\n },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":77,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): RussianSizable | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":81,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ввод\",\n email: \"email адрес\",\n url: \"URL\",\n emoji: \"эмодзи\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO дата и время\",\n date: \"ISO дата\",\n time: \"ISO время\",\n duration: \"ISO длительность\",\n ipv4: \"IPv4 адрес\",\n ipv6: \"IPv6 адрес\",\n mac: \"MAC адрес\",\n cidrv4: \"IPv4 диапазон\",\n cidrv6: \"IPv6 диапазон\",\n base64: \"строка в формате base64\",\n base64url: \"строка в формате base64url\",\n json_string: \"JSON строка\",\n e164: \"номер E.164\",\n credit_card: \"номер кредитной карты\",\n currency_code: \"код валюты\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"ввод\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":118,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"число\",\n array: \"массив\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":129,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":130,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":131,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":141,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":142,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":144,"symbol":"maxValue","kind":"constant","lang":"typescript","code":"const maxValue = Number(issue.maximum);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":145,"symbol":"unit","kind":"constant","lang":"typescript","code":"const unit = getRussianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":151,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":152,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":154,"symbol":"minValue","kind":"constant","lang":"typescript","code":"const minValue = Number(issue.minimum);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":155,"symbol":"unit","kind":"constant","lang":"typescript","code":"const unit = getRussianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ru.ts","line":161,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/sk.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"znakov\", verb: \"mať\" },\n file: { unit: \"bajtov\", verb: \"mať\" },\n array: { unit: \"prvkov\", verb: \"mať\" },\n set: { unit: \"prvkov\", verb: \"mať\" },\n map: { unit: \"položiek\", verb: \"mať\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"regulárny výraz\",\n email: \"e-mailová adresa\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"dátum a čas vo formáte ISO\",\n date: \"dátum vo formáte ISO\",\n time: \"čas vo formáte ISO\",\n duration: \"doba trvania ISO\",\n ipv4: \"IPv4 adresa\",\n ipv6: \"IPv6 adresa\",\n mac: \"MAC adresa\",\n cidrv4: \"rozsah IPv4\",\n cidrv6: \"rozsah IPv6\",\n base64: \"reťazec zakódovaný vo formáte base64\",\n base64url: \"reťazec zakódovaný "} {"repo":"zod","file":"packages/zod/src/v4/locales/sk.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"znakov\", verb: \"mať\" },\n file: { unit: \"bajtov\", verb: \"mať\" },\n array: { unit: \"prvkov\", verb: \"mať\" },\n set: { unit: \"prvkov\", verb: \"mať\" },\n map: { unit: \"položiek\", verb: \"mať\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/sk.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/sk.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"regulárny výraz\",\n email: \"e-mailová adresa\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"dátum a čas vo formáte ISO\",\n date: \"dátum vo formáte ISO\",\n time: \"čas vo formáte ISO\",\n duration: \"doba trvania ISO\",\n ipv4: \"IPv4 adresa\",\n ipv6: \"IPv6 adresa\",\n mac: \"MAC adresa\",\n cidrv4: \"rozsah IPv4\",\n cidrv6: \"rozsah IPv6\",\n base64: \"reťazec zakódovaný vo formáte base64\",\n base64url: \"reťazec zakódovaný vo formáte base64url\",\n json_string: \"reťazec vo formáte JSON\",\n e164: \"číslo E.164\",\n credit_card: \"číslo kreditnej karty\",\n currency_code: \"kód meny\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"vstup\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/sk.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"číslo\",\n string: \"reťazec\",\n function: \"funkcia\",\n array: \"pole\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/sk.ts","line":68,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/sk.ts","line":69,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/sk.ts","line":70,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/sk.ts","line":80,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/sk.ts","line":81,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/sk.ts","line":88,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/sk.ts","line":89,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/sk.ts","line":96,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/sl.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"znakov\", verb: \"imeti\" },\n file: { unit: \"bajtov\", verb: \"imeti\" },\n array: { unit: \"elementov\", verb: \"imeti\" },\n set: { unit: \"elementov\", verb: \"imeti\" },\n map: { unit: \"elementov\", verb: \"imeti\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"vnos\",\n email: \"e-poštni naslov\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO datum in čas\",\n date: \"ISO datum\",\n time: \"ISO čas\",\n duration: \"ISO trajanje\",\n ipv4: \"IPv4 naslov\",\n ipv6: \"IPv6 naslov\",\n mac: \"MAC naslov\",\n cidrv4: \"obseg IPv4\",\n cidrv6: \"obseg IPv6\",\n base64: \"base64 kodiran niz\",\n base64url: \"base64url kodiran niz\",\n json_string: \"JSON niz\",\n e164: \"E.164 "} {"repo":"zod","file":"packages/zod/src/v4/locales/sl.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"znakov\", verb: \"imeti\" },\n file: { unit: \"bajtov\", verb: \"imeti\" },\n array: { unit: \"elementov\", verb: \"imeti\" },\n set: { unit: \"elementov\", verb: \"imeti\" },\n map: { unit: \"elementov\", verb: \"imeti\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/sl.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/sl.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"vnos\",\n email: \"e-poštni naslov\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO datum in čas\",\n date: \"ISO datum\",\n time: \"ISO čas\",\n duration: \"ISO trajanje\",\n ipv4: \"IPv4 naslov\",\n ipv6: \"IPv6 naslov\",\n mac: \"MAC naslov\",\n cidrv4: \"obseg IPv4\",\n cidrv6: \"obseg IPv6\",\n base64: \"base64 kodiran niz\",\n base64url: \"base64url kodiran niz\",\n json_string: \"JSON niz\",\n e164: \"E.164 številka\",\n credit_card: \"številka kreditne kartice\",\n currency_code: \"koda valute\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"vnos\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/sl.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"število\",\n array: \"tabela\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/sl.ts","line":66,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/sl.ts","line":67,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/sl.ts","line":68,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/sl.ts","line":79,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/sl.ts","line":80,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/sl.ts","line":86,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/sl.ts","line":87,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/sl.ts","line":94,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/sv.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"tecken\", verb: \"att ha\" },\n file: { unit: \"bytes\", verb: \"att ha\" },\n array: { unit: \"objekt\", verb: \"att innehålla\" },\n set: { unit: \"objekt\", verb: \"att innehålla\" },\n map: { unit: \"objekt\", verb: \"att innehålla\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"reguljärt uttryck\",\n email: \"e-postadress\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO-datum och tid\",\n date: \"ISO-datum\",\n time: \"ISO-tid\",\n duration: \"ISO-varaktighet\",\n ipv4: \"IPv4-adress\",\n ipv6: \"IPv6-adress\",\n mac: \"MAC-adress\",\n cidrv4: \"IPv4-spektrum\",\n cidrv6: \"IPv6-spektrum\",\n base64: \"base64-kodad sträng\",\n base64url: \"base64url-kodad sträng\",\n json"} {"repo":"zod","file":"packages/zod/src/v4/locales/sv.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"tecken\", verb: \"att ha\" },\n file: { unit: \"bytes\", verb: \"att ha\" },\n array: { unit: \"objekt\", verb: \"att innehålla\" },\n set: { unit: \"objekt\", verb: \"att innehålla\" },\n map: { unit: \"objekt\", verb: \"att innehålla\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/sv.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/sv.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"reguljärt uttryck\",\n email: \"e-postadress\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO-datum och tid\",\n date: \"ISO-datum\",\n time: \"ISO-tid\",\n duration: \"ISO-varaktighet\",\n ipv4: \"IPv4-adress\",\n ipv6: \"IPv6-adress\",\n mac: \"MAC-adress\",\n cidrv4: \"IPv4-spektrum\",\n cidrv6: \"IPv6-spektrum\",\n base64: \"base64-kodad sträng\",\n base64url: \"base64url-kodad sträng\",\n json_string: \"JSON-sträng\",\n e164: \"E.164-nummer\",\n credit_card: \"kreditkortsnummer\",\n currency_code: \"valutakod\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"mall-literal\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/sv.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"antal\",\n array: \"lista\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/sv.ts","line":66,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/sv.ts","line":67,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/sv.ts","line":68,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/sv.ts","line":79,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/sv.ts","line":80,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/sv.ts","line":87,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/sv.ts","line":88,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/sv.ts","line":95,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ta.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"எழுத்துக்கள்\", verb: \"கொண்டிருக்க வேண்டும்\" },\n file: { unit: \"பைட்டுகள்\", verb: \"கொண்டிருக்க வேண்டும்\" },\n array: { unit: \"உறுப்புகள்\", verb: \"கொண்டிருக்க வேண்டும்\" },\n set: { unit: \"உறுப்புகள்\", verb: \"கொண்டிருக்க வேண்டும்\" },\n map: { unit: \"உறுப்புகள்\", verb: \"கொண்டிருக்க வேண்டும்\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"உள்ளீடு\",\n email: \"மின்னஞ்சல் முகவரி\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO தேதி நேரம்\",\n date: \"ISO தேதி\",\n time: \"ISO நேரம்\",\n duration: \"ISO கால அளவு\",\n ipv4: \"IPv4 முகவரி\",\n ipv6: \"IPv6 முகவரி\",\n mac: \"MAC முகவரி\",\n cidrv4: \"IPv4 வரம்பு\",\n cidrv6: \"IPv6 வரம்பு\",\n base64: \"base64-encoded"} {"repo":"zod","file":"packages/zod/src/v4/locales/ta.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"எழுத்துக்கள்\", verb: \"கொண்டிருக்க வேண்டும்\" },\n file: { unit: \"பைட்டுகள்\", verb: \"கொண்டிருக்க வேண்டும்\" },\n array: { unit: \"உறுப்புகள்\", verb: \"கொண்டிருக்க வேண்டும்\" },\n set: { unit: \"உறுப்புகள்\", verb: \"கொண்டிருக்க வேண்டும்\" },\n map: { unit: \"உறுப்புகள்\", verb: \"கொண்டிருக்க வேண்டும்\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ta.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/ta.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"உள்ளீடு\",\n email: \"மின்னஞ்சல் முகவரி\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO தேதி நேரம்\",\n date: \"ISO தேதி\",\n time: \"ISO நேரம்\",\n duration: \"ISO கால அளவு\",\n ipv4: \"IPv4 முகவரி\",\n ipv6: \"IPv6 முகவரி\",\n mac: \"MAC முகவரி\",\n cidrv4: \"IPv4 வரம்பு\",\n cidrv6: \"IPv6 வரம்பு\",\n base64: \"base64-encoded சரம்\",\n base64url: \"base64url-encoded சரம்\",\n json_string: \"JSON சரம்\",\n e164: \"E.164 எண்\",\n credit_card: \"கடன் அட்டை எண்\",\n currency_code: \"நாணயக் குறியீடு\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"input\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ta.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"எண்\",\n array: \"அணி\",\n null: \"வெறுமை\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ta.ts","line":67,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ta.ts","line":68,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ta.ts","line":69,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ta.ts","line":79,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ta.ts","line":80,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ta.ts","line":87,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ta.ts","line":88,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ta.ts","line":96,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/tg.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n // singular units after numerals in Tajik\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"аломат\", verb: \"дошта бошад\" },\n file: { unit: \"байт\", verb: \"дошта бошад\" },\n array: { unit: \"унсур\", verb: \"дошта бошад\" },\n set: { unit: \"унсур\", verb: \"дошта бошад\" },\n map: { unit: \"сабт\", verb: \"дошта бошад\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"вуруд\",\n email: \"суроғаи email\",\n url: \"URL\",\n emoji: \"эмоҷи\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"санаву вақти ISO\",\n date: \"санаи ISO\",\n time: \"вақти ISO\",\n duration: \"давомнокии ISO\",\n ipv4: \"суроғаи IPv4\",\n ipv6: \"суроғаи IPv6\",\n mac: \"суроғаи MAC\",\n cidrv4: \"маҳдудаи IPv4\",\n cidrv6: \"маҳдудаи IPv6\",\n base64: \"сатри дар формати base64\",\n base6"} {"repo":"zod","file":"packages/zod/src/v4/locales/tg.ts","line":7,"symbol":"Sizable","kind":"constant","lang":"typescript","doc":"singular units after numerals in Tajik","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"аломат\", verb: \"дошта бошад\" },\n file: { unit: \"байт\", verb: \"дошта бошад\" },\n array: { unit: \"унсур\", verb: \"дошта бошад\" },\n set: { unit: \"унсур\", verb: \"дошта бошад\" },\n map: { unit: \"сабт\", verb: \"дошта бошад\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/tg.ts","line":15,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/tg.ts","line":19,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"вуруд\",\n email: \"суроғаи email\",\n url: \"URL\",\n emoji: \"эмоҷи\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"санаву вақти ISO\",\n date: \"санаи ISO\",\n time: \"вақти ISO\",\n duration: \"давомнокии ISO\",\n ipv4: \"суроғаи IPv4\",\n ipv6: \"суроғаи IPv6\",\n mac: \"суроғаи MAC\",\n cidrv4: \"маҳдудаи IPv4\",\n cidrv6: \"маҳдудаи IPv6\",\n base64: \"сатри дар формати base64\",\n base64url: \"сатри дар формати base64url\",\n json_string: \"сатри JSON\",\n e164: \"рақами E.164\",\n credit_card: \"рақами корти кредитӣ\",\n currency_code: \"рамзи асъор\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"вуруд\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/tg.ts","line":56,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"рақам\",\n string: \"сатр\",\n array: \"массив\",\n object: \"объект\",\n date: \"сана\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/tg.ts","line":70,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/tg.ts","line":71,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/tg.ts","line":72,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/tg.ts","line":82,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/tg.ts","line":83,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/tg.ts","line":90,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/tg.ts","line":91,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/tg.ts","line":98,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/tg.ts","line":117,"symbol":"opts","kind":"constant","lang":"typescript","code":"const opts = issue.options.map((o) => `'${o}'`).join(\" | \");"} {"repo":"zod","file":"packages/zod/src/v4/locales/th.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"ตัวอักษร\", verb: \"ควรมี\" },\n file: { unit: \"ไบต์\", verb: \"ควรมี\" },\n array: { unit: \"รายการ\", verb: \"ควรมี\" },\n set: { unit: \"รายการ\", verb: \"ควรมี\" },\n map: { unit: \"รายการ\", verb: \"ควรมี\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ข้อมูลที่ป้อน\",\n email: \"ที่อยู่อีเมล\",\n url: \"URL\",\n emoji: \"อิโมจิ\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"วันที่เวลาแบบ ISO\",\n date: \"วันที่แบบ ISO\",\n time: \"เวลาแบบ ISO\",\n duration: \"ช่วงเวลาแบบ ISO\",\n ipv4: \"ที่อยู่ IPv4\",\n ipv6: \"ที่อยู่ IPv6\",\n mac: \"ที่อยู่ MAC\",\n cidrv4: \"ช่วง IP แบบ IPv4\",\n cidrv6: \"ช่วง IP แบบ IPv6\",\n base64: \"ข้อความแบบ Base64\",\n base64url: \"ข้อความแบบ Base64 สำหรับ URL\",\n json_string"} {"repo":"zod","file":"packages/zod/src/v4/locales/th.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"ตัวอักษร\", verb: \"ควรมี\" },\n file: { unit: \"ไบต์\", verb: \"ควรมี\" },\n array: { unit: \"รายการ\", verb: \"ควรมี\" },\n set: { unit: \"รายการ\", verb: \"ควรมี\" },\n map: { unit: \"รายการ\", verb: \"ควรมี\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/th.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/th.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ข้อมูลที่ป้อน\",\n email: \"ที่อยู่อีเมล\",\n url: \"URL\",\n emoji: \"อิโมจิ\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"วันที่เวลาแบบ ISO\",\n date: \"วันที่แบบ ISO\",\n time: \"เวลาแบบ ISO\",\n duration: \"ช่วงเวลาแบบ ISO\",\n ipv4: \"ที่อยู่ IPv4\",\n ipv6: \"ที่อยู่ IPv6\",\n mac: \"ที่อยู่ MAC\",\n cidrv4: \"ช่วง IP แบบ IPv4\",\n cidrv6: \"ช่วง IP แบบ IPv6\",\n base64: \"ข้อความแบบ Base64\",\n base64url: \"ข้อความแบบ Base64 สำหรับ URL\",\n json_string: \"ข้อความแบบ JSON\",\n e164: \"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)\",\n credit_card: \"หมายเลขบัตรเครดิต\",\n currency_code: \"รหัสสกุลเงิน\",\n iban: \"IBAN\",\n jwt: \"โทเคน JWT\",\n template_literal: \"ข้อมูลที่ป้อน\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/th.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"ตัวเลข\",\n array: \"อาร์เรย์ (Array)\",\n null: \"ไม่มีค่า (null)\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/th.ts","line":67,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/th.ts","line":68,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/th.ts","line":69,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/th.ts","line":79,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"ไม่เกิน\" : \"น้อยกว่า\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/th.ts","line":80,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/th.ts","line":86,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"อย่างน้อย\" : \"มากกว่า\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/th.ts","line":87,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/th.ts","line":95,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/tk.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"simwol\", verb: \"bolmaly\" },\n file: { unit: \"baýt\", verb: \"bolmaly\" },\n array: { unit: \"elementler\", verb: \"bolmaly\" },\n set: { unit: \"elementler\", verb: \"bolmaly\" },\n map: { unit: \"elementler\", verb: \"bolmaly\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"giriş\",\n email: \"e-poçta salgysy\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO sene we wagt\",\n date: \"ISO sene\",\n time: \"ISO wagt\",\n duration: \"ISO wagt aralygy\",\n ipv4: \"IPv4 salgysy\",\n ipv6: \"IPv6 salgysy\",\n mac: \"MAC salgysy\",\n cidrv4: \"IPv4 aralygy\",\n cidrv6: \"IPv6 aralygy\",\n base64: \"base64 bilen şifrlenen setir\",\n base64url: \"base64url bilen şifrlenen setir\",\n "} {"repo":"zod","file":"packages/zod/src/v4/locales/tk.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"simwol\", verb: \"bolmaly\" },\n file: { unit: \"baýt\", verb: \"bolmaly\" },\n array: { unit: \"elementler\", verb: \"bolmaly\" },\n set: { unit: \"elementler\", verb: \"bolmaly\" },\n map: { unit: \"elementler\", verb: \"bolmaly\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/tk.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/tk.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"giriş\",\n email: \"e-poçta salgysy\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO sene we wagt\",\n date: \"ISO sene\",\n time: \"ISO wagt\",\n duration: \"ISO wagt aralygy\",\n ipv4: \"IPv4 salgysy\",\n ipv6: \"IPv6 salgysy\",\n mac: \"MAC salgysy\",\n cidrv4: \"IPv4 aralygy\",\n cidrv6: \"IPv6 aralygy\",\n base64: \"base64 bilen şifrlenen setir\",\n base64url: \"base64url bilen şifrlenen setir\",\n json_string: \"JSON setiri\",\n e164: \"E.164 nomeri\",\n credit_card: \"kredit kartynyň nomeri\",\n currency_code: \"walýuta kody\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"şablon\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/tk.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/tk.ts","line":64,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/tk.ts","line":65,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/tk.ts","line":66,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/tk.ts","line":73,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/tk.ts","line":74,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/tk.ts","line":80,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/tk.ts","line":81,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/tk.ts","line":86,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/tr.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"karakter\", verb: \"olmalı\" },\n file: { unit: \"bayt\", verb: \"olmalı\" },\n array: { unit: \"öğe\", verb: \"olmalı\" },\n set: { unit: \"öğe\", verb: \"olmalı\" },\n map: { unit: \"öğe\", verb: \"olmalı\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"girdi\",\n email: \"e-posta adresi\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO tarih ve saat\",\n date: \"ISO tarih\",\n time: \"ISO saat\",\n duration: \"ISO süre\",\n ipv4: \"IPv4 adresi\",\n ipv6: \"IPv6 adresi\",\n mac: \"MAC adresi\",\n cidrv4: \"IPv4 aralığı\",\n cidrv6: \"IPv6 aralığı\",\n base64: \"base64 ile şifrelenmiş metin\",\n base64url: \"base64url ile şifrelenmiş metin\",\n json_string: \"JSON dizesi\",\n e"} {"repo":"zod","file":"packages/zod/src/v4/locales/tr.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"karakter\", verb: \"olmalı\" },\n file: { unit: \"bayt\", verb: \"olmalı\" },\n array: { unit: \"öğe\", verb: \"olmalı\" },\n set: { unit: \"öğe\", verb: \"olmalı\" },\n map: { unit: \"öğe\", verb: \"olmalı\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/tr.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/tr.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"girdi\",\n email: \"e-posta adresi\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO tarih ve saat\",\n date: \"ISO tarih\",\n time: \"ISO saat\",\n duration: \"ISO süre\",\n ipv4: \"IPv4 adresi\",\n ipv6: \"IPv6 adresi\",\n mac: \"MAC adresi\",\n cidrv4: \"IPv4 aralığı\",\n cidrv6: \"IPv6 aralığı\",\n base64: \"base64 ile şifrelenmiş metin\",\n base64url: \"base64url ile şifrelenmiş metin\",\n json_string: \"JSON dizesi\",\n e164: \"E.164 sayısı\",\n credit_card: \"kredi kartı numarası\",\n currency_code: \"para birimi kodu\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"Şablon dizesi\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/tr.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/tr.ts","line":64,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/tr.ts","line":65,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/tr.ts","line":66,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/tr.ts","line":76,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/tr.ts","line":77,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/tr.ts","line":83,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/tr.ts","line":84,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/tr.ts","line":89,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/uk.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"символів\", verb: \"матиме\" },\n file: { unit: \"байтів\", verb: \"матиме\" },\n array: { unit: \"елементів\", verb: \"матиме\" },\n set: { unit: \"елементів\", verb: \"матиме\" },\n map: { unit: \"елементів\", verb: \"матиме\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"вхідні дані\",\n email: \"адреса електронної пошти\",\n url: \"URL\",\n emoji: \"емодзі\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"дата та час ISO\",\n date: \"дата ISO\",\n time: \"час ISO\",\n duration: \"тривалість ISO\",\n ipv4: \"адреса IPv4\",\n ipv6: \"адреса IPv6\",\n mac: \"адреса MAC\",\n cidrv4: \"діапазон IPv4\",\n cidrv6: \"діапазон IPv6\",\n base64: \"рядок у кодуванні base64\",\n base64url: \"рядок у кодуванні base64url\",\n "} {"repo":"zod","file":"packages/zod/src/v4/locales/uk.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"символів\", verb: \"матиме\" },\n file: { unit: \"байтів\", verb: \"матиме\" },\n array: { unit: \"елементів\", verb: \"матиме\" },\n set: { unit: \"елементів\", verb: \"матиме\" },\n map: { unit: \"елементів\", verb: \"матиме\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/uk.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/uk.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"вхідні дані\",\n email: \"адреса електронної пошти\",\n url: \"URL\",\n emoji: \"емодзі\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"дата та час ISO\",\n date: \"дата ISO\",\n time: \"час ISO\",\n duration: \"тривалість ISO\",\n ipv4: \"адреса IPv4\",\n ipv6: \"адреса IPv6\",\n mac: \"адреса MAC\",\n cidrv4: \"діапазон IPv4\",\n cidrv6: \"діапазон IPv6\",\n base64: \"рядок у кодуванні base64\",\n base64url: \"рядок у кодуванні base64url\",\n json_string: \"рядок JSON\",\n e164: \"номер E.164\",\n credit_card: \"номер кредитної картки\",\n currency_code: \"код валюти\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"вхідні дані\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/uk.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"число\",\n array: \"масив\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/uk.ts","line":66,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/uk.ts","line":67,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/uk.ts","line":68,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/uk.ts","line":79,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/uk.ts","line":80,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/uk.ts","line":86,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/uk.ts","line":87,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/uk.ts","line":95,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ur.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"حروف\", verb: \"ہونا\" },\n file: { unit: \"بائٹس\", verb: \"ہونا\" },\n array: { unit: \"آئٹمز\", verb: \"ہونا\" },\n set: { unit: \"آئٹمز\", verb: \"ہونا\" },\n map: { unit: \"آئٹمز\", verb: \"ہونا\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ان پٹ\",\n email: \"ای میل ایڈریس\",\n url: \"یو آر ایل\",\n emoji: \"ایموجی\",\n uuid: \"یو یو آئی ڈی\",\n uuidv4: \"یو یو آئی ڈی وی 4\",\n uuidv6: \"یو یو آئی ڈی وی 6\",\n nanoid: \"نینو آئی ڈی\",\n guid: \"جی یو آئی ڈی\",\n cuid: \"سی یو آئی ڈی\",\n cuid2: \"سی یو آئی ڈی 2\",\n ulid: \"یو ایل آئی ڈی\",\n xid: \"ایکس آئی ڈی\",\n ksuid: \"کے ایس یو آئی ڈی\",\n datetime: \"آئی ایس او ڈیٹ ٹائم\",\n date: \"آئی ایس او تاریخ\",\n time: \"آئی ایس او وقت\",\n duration: \"آئی ایس او مدت\",\n ipv4: \"آئی پی وی 4 ایڈریس\",\n ipv6: \"آئی پی وی 6 ایڈریس\",\n mac: \"ایم اے سی ایڈریس\",\n cidrv4: \"آئی پی وی 4 رینج\",\n cidrv6: \"آئی پی وی 6 ری"} {"repo":"zod","file":"packages/zod/src/v4/locales/ur.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"حروف\", verb: \"ہونا\" },\n file: { unit: \"بائٹس\", verb: \"ہونا\" },\n array: { unit: \"آئٹمز\", verb: \"ہونا\" },\n set: { unit: \"آئٹمز\", verb: \"ہونا\" },\n map: { unit: \"آئٹمز\", verb: \"ہونا\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ur.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/ur.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ان پٹ\",\n email: \"ای میل ایڈریس\",\n url: \"یو آر ایل\",\n emoji: \"ایموجی\",\n uuid: \"یو یو آئی ڈی\",\n uuidv4: \"یو یو آئی ڈی وی 4\",\n uuidv6: \"یو یو آئی ڈی وی 6\",\n nanoid: \"نینو آئی ڈی\",\n guid: \"جی یو آئی ڈی\",\n cuid: \"سی یو آئی ڈی\",\n cuid2: \"سی یو آئی ڈی 2\",\n ulid: \"یو ایل آئی ڈی\",\n xid: \"ایکس آئی ڈی\",\n ksuid: \"کے ایس یو آئی ڈی\",\n datetime: \"آئی ایس او ڈیٹ ٹائم\",\n date: \"آئی ایس او تاریخ\",\n time: \"آئی ایس او وقت\",\n duration: \"آئی ایس او مدت\",\n ipv4: \"آئی پی وی 4 ایڈریس\",\n ipv6: \"آئی پی وی 6 ایڈریس\",\n mac: \"ایم اے سی ایڈریس\",\n cidrv4: \"آئی پی وی 4 رینج\",\n cidrv6: \"آئی پی وی 6 رینج\",\n base64: \"بیس 64 ان کوڈڈ سٹرنگ\",\n base64url: \"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ\",\n json_string: \"جے ایس او این سٹرنگ\",\n e164: \"ای 164 نمبر\",\n credit_card: \"کریڈٹ کارڈ نمبر\",\n currency_code: \"کرنسی کوڈ\",\n iban: \"IBAN\",\n jwt: \"جے ڈبلیو ٹی\",\n template_literal: \"ان پٹ\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ur.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"نمبر\",\n array: \"آرے\",\n null: \"نل\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/ur.ts","line":67,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ur.ts","line":68,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ur.ts","line":69,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/ur.ts","line":79,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ur.ts","line":80,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ur.ts","line":86,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/ur.ts","line":87,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/ur.ts","line":95,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/uz.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"belgi\", verb: \"bo‘lishi kerak\" },\n file: { unit: \"bayt\", verb: \"bo‘lishi kerak\" },\n array: { unit: \"element\", verb: \"bo‘lishi kerak\" },\n set: { unit: \"element\", verb: \"bo‘lishi kerak\" },\n map: { unit: \"yozuv\", verb: \"bo‘lishi kerak\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"kirish\",\n email: \"elektron pochta manzili\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO sana va vaqti\",\n date: \"ISO sana\",\n time: \"ISO vaqt\",\n duration: \"ISO davomiylik\",\n ipv4: \"IPv4 manzil\",\n ipv6: \"IPv6 manzil\",\n mac: \"MAC manzil\",\n cidrv4: \"IPv4 diapazon\",\n cidrv6: \"IPv6 diapazon\",\n base64: \"base64 kodlangan satr\",\n base64url: \"base64url kodl"} {"repo":"zod","file":"packages/zod/src/v4/locales/uz.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"belgi\", verb: \"bo‘lishi kerak\" },\n file: { unit: \"bayt\", verb: \"bo‘lishi kerak\" },\n array: { unit: \"element\", verb: \"bo‘lishi kerak\" },\n set: { unit: \"element\", verb: \"bo‘lishi kerak\" },\n map: { unit: \"yozuv\", verb: \"bo‘lishi kerak\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/uz.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/uz.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"kirish\",\n email: \"elektron pochta manzili\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO sana va vaqti\",\n date: \"ISO sana\",\n time: \"ISO vaqt\",\n duration: \"ISO davomiylik\",\n ipv4: \"IPv4 manzil\",\n ipv6: \"IPv6 manzil\",\n mac: \"MAC manzil\",\n cidrv4: \"IPv4 diapazon\",\n cidrv6: \"IPv6 diapazon\",\n base64: \"base64 kodlangan satr\",\n base64url: \"base64url kodlangan satr\",\n json_string: \"JSON satr\",\n e164: \"E.164 raqam\",\n credit_card: \"kredit karta raqami\",\n currency_code: \"valyuta kodi\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"kirish\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/uz.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"raqam\",\n array: \"massiv\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/uz.ts","line":66,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/uz.ts","line":67,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/uz.ts","line":68,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/uz.ts","line":78,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/uz.ts","line":79,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/uz.ts","line":85,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/uz.ts","line":86,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/uz.ts","line":93,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/vi.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"ký tự\", verb: \"có\" },\n file: { unit: \"byte\", verb: \"có\" },\n array: { unit: \"phần tử\", verb: \"có\" },\n set: { unit: \"phần tử\", verb: \"có\" },\n map: { unit: \"phần tử\", verb: \"có\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"đầu vào\",\n email: \"địa chỉ email\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ngày giờ ISO\",\n date: \"ngày ISO\",\n time: \"giờ ISO\",\n duration: \"khoảng thời gian ISO\",\n ipv4: \"địa chỉ IPv4\",\n ipv6: \"địa chỉ IPv6\",\n mac: \"địa chỉ MAC\",\n cidrv4: \"dải IPv4\",\n cidrv6: \"dải IPv6\",\n base64: \"chuỗi mã hóa base64\",\n base64url: \"chuỗi mã hóa base64url\",\n json_string: \"chuỗi JSON\",\n e164: \"số E.164\",\n credit_c"} {"repo":"zod","file":"packages/zod/src/v4/locales/vi.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"ký tự\", verb: \"có\" },\n file: { unit: \"byte\", verb: \"có\" },\n array: { unit: \"phần tử\", verb: \"có\" },\n set: { unit: \"phần tử\", verb: \"có\" },\n map: { unit: \"phần tử\", verb: \"có\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/vi.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/vi.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"đầu vào\",\n email: \"địa chỉ email\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ngày giờ ISO\",\n date: \"ngày ISO\",\n time: \"giờ ISO\",\n duration: \"khoảng thời gian ISO\",\n ipv4: \"địa chỉ IPv4\",\n ipv6: \"địa chỉ IPv6\",\n mac: \"địa chỉ MAC\",\n cidrv4: \"dải IPv4\",\n cidrv6: \"dải IPv6\",\n base64: \"chuỗi mã hóa base64\",\n base64url: \"chuỗi mã hóa base64url\",\n json_string: \"chuỗi JSON\",\n e164: \"số E.164\",\n credit_card: \"số thẻ tín dụng\",\n currency_code: \"mã tiền tệ\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"đầu vào\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/vi.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"số\",\n array: \"mảng\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/vi.ts","line":66,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/vi.ts","line":67,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/vi.ts","line":68,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/vi.ts","line":79,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/vi.ts","line":80,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/vi.ts","line":86,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/vi.ts","line":87,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/vi.ts","line":95,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/yo.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"àmi\", verb: \"ní\" },\n file: { unit: \"bytes\", verb: \"ní\" },\n array: { unit: \"nkan\", verb: \"ní\" },\n set: { unit: \"nkan\", verb: \"ní\" },\n map: { unit: \"nkan\", verb: \"ní\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ẹ̀rọ ìbáwọlé\",\n email: \"àdírẹ́sì ìmẹ́lì\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"àkókò ISO\",\n date: \"ọjọ́ ISO\",\n time: \"àkókò ISO\",\n duration: \"àkókò tó pé ISO\",\n ipv4: \"àdírẹ́sì IPv4\",\n ipv6: \"àdírẹ́sì IPv6\",\n mac: \"àdírẹ́sì MAC\",\n cidrv4: \"àgbègbè IPv4\",\n cidrv6: \"àgbègbè IPv6\",\n base64: \"ọ̀rọ̀ tí a kọ́ ní base64\",\n base64url: \"ọ̀rọ̀ base64url\",\n json_string: \"ọ̀rọ̀ JSON\",\n e164: \"nọ́mbà E.164\",\n cred"} {"repo":"zod","file":"packages/zod/src/v4/locales/yo.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"àmi\", verb: \"ní\" },\n file: { unit: \"bytes\", verb: \"ní\" },\n array: { unit: \"nkan\", verb: \"ní\" },\n set: { unit: \"nkan\", verb: \"ní\" },\n map: { unit: \"nkan\", verb: \"ní\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/yo.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/yo.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"ẹ̀rọ ìbáwọlé\",\n email: \"àdírẹ́sì ìmẹ́lì\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"àkókò ISO\",\n date: \"ọjọ́ ISO\",\n time: \"àkókò ISO\",\n duration: \"àkókò tó pé ISO\",\n ipv4: \"àdírẹ́sì IPv4\",\n ipv6: \"àdírẹ́sì IPv6\",\n mac: \"àdírẹ́sì MAC\",\n cidrv4: \"àgbègbè IPv4\",\n cidrv6: \"àgbègbè IPv6\",\n base64: \"ọ̀rọ̀ tí a kọ́ ní base64\",\n base64url: \"ọ̀rọ̀ base64url\",\n json_string: \"ọ̀rọ̀ JSON\",\n e164: \"nọ́mbà E.164\",\n credit_card: \"nọmba kaadi gbese\",\n currency_code: \"koodu owó\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"ẹ̀rọ ìbáwọlé\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/yo.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"nọ́mbà\",\n array: \"akopọ\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/yo.ts","line":66,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/yo.ts","line":67,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/yo.ts","line":68,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/yo.ts","line":80,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/yo.ts","line":81,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/yo.ts","line":88,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/yo.ts","line":89,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/yo.ts","line":96,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-CN.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"字符\", verb: \"包含\" },\n file: { unit: \"字节\", verb: \"包含\" },\n array: { unit: \"项\", verb: \"包含\" },\n set: { unit: \"项\", verb: \"包含\" },\n map: { unit: \"项\", verb: \"包含\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"输入\",\n email: \"电子邮件\",\n url: \"URL\",\n emoji: \"表情符号\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO日期时间\",\n date: \"ISO日期\",\n time: \"ISO时间\",\n duration: \"ISO时长\",\n ipv4: \"IPv4地址\",\n ipv6: \"IPv6地址\",\n mac: \"MAC地址\",\n cidrv4: \"IPv4网段\",\n cidrv6: \"IPv6网段\",\n base64: \"base64编码字符串\",\n base64url: \"base64url编码字符串\",\n json_string: \"JSON字符串\",\n e164: \"E.164号码\",\n credit_card: \"信用卡号\",\n currency_code: \"货币代码\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"输入\",\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-CN.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"字符\", verb: \"包含\" },\n file: { unit: \"字节\", verb: \"包含\" },\n array: { unit: \"项\", verb: \"包含\" },\n set: { unit: \"项\", verb: \"包含\" },\n map: { unit: \"项\", verb: \"包含\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-CN.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-CN.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"输入\",\n email: \"电子邮件\",\n url: \"URL\",\n emoji: \"表情符号\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO日期时间\",\n date: \"ISO日期\",\n time: \"ISO时间\",\n duration: \"ISO时长\",\n ipv4: \"IPv4地址\",\n ipv6: \"IPv6地址\",\n mac: \"MAC地址\",\n cidrv4: \"IPv4网段\",\n cidrv6: \"IPv6网段\",\n base64: \"base64编码字符串\",\n base64url: \"base64url编码字符串\",\n json_string: \"JSON字符串\",\n e164: \"E.164号码\",\n credit_card: \"信用卡号\",\n currency_code: \"货币代码\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"输入\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-CN.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n number: \"数字\",\n array: \"数组\",\n null: \"空值(null)\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-CN.ts","line":67,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-CN.ts","line":68,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-CN.ts","line":69,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-CN.ts","line":79,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-CN.ts","line":80,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-CN.ts","line":86,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-CN.ts","line":87,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-CN.ts","line":94,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-TW.ts","line":5,"symbol":"error","kind":"constant","lang":"typescript","code":"const error: () => errors.$ZodErrorMap = () => {\n const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"字元\", verb: \"擁有\" },\n file: { unit: \"位元組\", verb: \"擁有\" },\n array: { unit: \"項目\", verb: \"擁有\" },\n set: { unit: \"項目\", verb: \"擁有\" },\n map: { unit: \"項目\", verb: \"擁有\" },\n };\n\n function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }\n\n const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"輸入\",\n email: \"郵件地址\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO 日期時間\",\n date: \"ISO 日期\",\n time: \"ISO 時間\",\n duration: \"ISO 期間\",\n ipv4: \"IPv4 位址\",\n ipv6: \"IPv6 位址\",\n mac: \"MAC 位址\",\n cidrv4: \"IPv4 範圍\",\n cidrv6: \"IPv6 範圍\",\n base64: \"base64 編碼字串\",\n base64url: \"base64url 編碼字串\",\n json_string: \"JSON 字串\",\n e164: \"E.164 數值\",\n credit_card: \"信用卡號\",\n currency_code: \"貨幣代碼\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_lit"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-TW.ts","line":6,"symbol":"Sizable","kind":"constant","lang":"typescript","code":"const Sizable: Record<string, { unit: string; verb: string }> = {\n string: { unit: \"字元\", verb: \"擁有\" },\n file: { unit: \"位元組\", verb: \"擁有\" },\n array: { unit: \"項目\", verb: \"擁有\" },\n set: { unit: \"項目\", verb: \"擁有\" },\n map: { unit: \"項目\", verb: \"擁有\" },\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-TW.ts","line":14,"symbol":"getSizing","kind":"function","lang":"typescript","code":"function getSizing(origin: string): { unit: string; verb: string } | null {\n return Sizable[origin] ?? null;\n }"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-TW.ts","line":18,"symbol":"FormatDictionary","kind":"constant","lang":"typescript","code":"const FormatDictionary: {\n [k in $ZodStringFormats | (string & {})]?: string;\n } = {\n regex: \"輸入\",\n email: \"郵件地址\",\n url: \"URL\",\n emoji: \"emoji\",\n uuid: \"UUID\",\n uuidv4: \"UUIDv4\",\n uuidv6: \"UUIDv6\",\n nanoid: \"nanoid\",\n guid: \"GUID\",\n cuid: \"cuid\",\n cuid2: \"cuid2\",\n ulid: \"ULID\",\n xid: \"XID\",\n ksuid: \"KSUID\",\n datetime: \"ISO 日期時間\",\n date: \"ISO 日期\",\n time: \"ISO 時間\",\n duration: \"ISO 期間\",\n ipv4: \"IPv4 位址\",\n ipv6: \"IPv6 位址\",\n mac: \"MAC 位址\",\n cidrv4: \"IPv4 範圍\",\n cidrv6: \"IPv6 範圍\",\n base64: \"base64 編碼字串\",\n base64url: \"base64url 編碼字串\",\n json_string: \"JSON 字串\",\n e164: \"E.164 數值\",\n credit_card: \"信用卡號\",\n currency_code: \"貨幣代碼\",\n iban: \"IBAN\",\n jwt: \"JWT\",\n template_literal: \"輸入\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-TW.ts","line":55,"symbol":"TypeDictionary","kind":"constant","lang":"typescript","code":"const TypeDictionary: {\n [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;\n } = {\n nan: \"NaN\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-TW.ts","line":64,"symbol":"expected","kind":"constant","lang":"typescript","code":"const expected = TypeDictionary[issue.expected] ?? issue.expected;"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-TW.ts","line":65,"symbol":"receivedType","kind":"constant","lang":"typescript","code":"const receivedType = util.parsedType(issue.input);"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-TW.ts","line":66,"symbol":"received","kind":"constant","lang":"typescript","code":"const received = TypeDictionary[receivedType] ?? receivedType;"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-TW.ts","line":76,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \"<=\" : \"<\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-TW.ts","line":77,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-TW.ts","line":83,"symbol":"adj","kind":"constant","lang":"typescript","code":"const adj = issue.inclusive ? \">=\" : \">\";"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-TW.ts","line":84,"symbol":"sizing","kind":"constant","lang":"typescript","code":"const sizing = getSizing(issue.origin);"} {"repo":"zod","file":"packages/zod/src/v4/locales/zh-TW.ts","line":91,"symbol":"_issue","kind":"constant","lang":"typescript","code":"const _issue = issue as errors.$ZodStringFormatIssues;"} {"repo":"zod","file":"packages/zod/src/v4/mini/coerce.ts","line":5,"symbol":"string","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function string<T = unknown>(params?: string | core.$ZodStringParams): schemas.ZodMiniString<T> {\n return core._coercedString(schemas.ZodMiniString, params) as schemas.ZodMiniString<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/coerce.ts","line":10,"symbol":"number","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function number<T = unknown>(params?: string | core.$ZodNumberParams): schemas.ZodMiniNumber<T> {\n return core._coercedNumber(schemas.ZodMiniNumber, params) as schemas.ZodMiniNumber<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/coerce.ts","line":15,"symbol":"boolean","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function boolean<T = unknown>(params?: string | core.$ZodBooleanParams): schemas.ZodMiniBoolean<T> {\n return core._coercedBoolean(schemas.ZodMiniBoolean, params) as schemas.ZodMiniBoolean<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/coerce.ts","line":20,"symbol":"bigint","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function bigint<T = unknown>(params?: string | core.$ZodBigIntParams): schemas.ZodMiniBigInt<T> {\n return core._coercedBigint(schemas.ZodMiniBigInt, params) as schemas.ZodMiniBigInt<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/coerce.ts","line":25,"symbol":"date","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function date<T = unknown>(params?: string | core.$ZodDateParams): schemas.ZodMiniDate<T> {\n return core._coercedDate(schemas.ZodMiniDate, params) as schemas.ZodMiniDate<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/deep-partial.ts","line":7,"symbol":"DeepPartial","kind":"type","lang":"typescript","doc":"Mini counterpart of `classic/deep-partial.ts`'s `DeepPartial`. biome-ignore format: preserve vertical layout for readability.","code":"type DeepPartial<T extends core.SomeType> =\n T extends schemas.ZodMiniObject<infer Shape, infer Config>\n ? schemas.ZodMiniObject<\n { -readonly [K in keyof Shape]: schemas.ZodMiniOptional<DeepPartial<Shape[K]>> },\n Config\n >\n : T extends schemas.ZodMiniDiscriminatedUnion<infer Options, any>\n ? schemas.ZodMiniUnion<\n { -readonly [I in keyof Options]: Options[I] extends core.SomeType ? DeepPartial<Options[I]> : Options[I] }\n >\n : T extends schemas.ZodMiniUnion<infer Options>\n ? schemas.ZodMiniUnion<\n { -readonly [I in keyof Options]: Options[I] extends core.SomeType ? DeepPartial<Options[I]> : Options[I] }\n >\n : T extends schemas.ZodMiniArray<infer El>\n ? schemas.ZodMiniArray<DeepPartial<El>>\n : T extends schemas.ZodMiniTuple<infer Items, infer Rest>\n ? schemas.ZodMiniTuple<\n { -readonly [K in keyof Items]: Items[K] extends core.SomeType ? DeepPartial<Items[K]> : Items[K] },\n Rest extends core.SomeType ? DeepPartial<Rest> : Rest\n >\n : T extends schemas.ZodMiniIntersection<infer A, infer B>\n ? schemas.ZodMiniIntersection<DeepPartial<A>, DeepPartial<B>>\n : T extends schemas.ZodMiniRecord<infer K, infe"} {"repo":"zod","file":"packages/zod/src/v4/mini/deep-partial.ts","line":64,"symbol":"deepPartial","kind":"function","lang":"typescript","doc":"See `classic/deep-partial.ts`. Mini variant uses `mini.partial(...)`.","code":"function deepPartial<T extends core.SomeType>(schema: T): DeepPartial<T> {\n return visit(schema, {\n object: (s) => schemas.partial(s as schemas.ZodMiniObject),\n // See `classic/deep-partial.ts`.\n union: (s) => {\n const def = s._zod.def as core.$ZodDiscriminatedUnionDef;\n return def.discriminator === undefined ? s : schemas.union(def.options as schemas.ZodMiniType[]);\n },\n }) as unknown as DeepPartial<T>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/deep-partial.ts","line":69,"symbol":"def","kind":"constant","lang":"typescript","code":"const def = s._zod.def as core.$ZodDiscriminatedUnionDef;"} {"repo":"zod","file":"packages/zod/src/v4/mini/in-out.ts","line":7,"symbol":"input","kind":"type","lang":"typescript","doc":"See `classic/in-out.ts` for why these aliases exist.","code":"type input<T> = core.input<T>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/in-out.ts","line":8,"symbol":"output","kind":"type","lang":"typescript","code":"type output<T> = core.output<T>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/in-out.ts","line":11,"symbol":"withChecks","kind":"function","lang":"typescript","doc":"See `classic/in-out.ts`.","code":"function withChecks(side: core.$ZodType, checks: core.$ZodTypeDef[\"checks\"]): core.$ZodType {\n if (!checks?.length) return side;\n const def = side._zod.def;\n return clone(side, mergeDefs(def, { checks: [...(def.checks ?? []), ...checks] }), { parent: true });\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/in-out.ts","line":13,"symbol":"def","kind":"constant","lang":"typescript","code":"const def = side._zod.def;"} {"repo":"zod","file":"packages/zod/src/v4/mini/in-out.ts","line":18,"symbol":"outSide","kind":"function","lang":"typescript","doc":"See `classic/in-out.ts`.","code":"function outSide(def: core.$ZodPipeDef): core.$ZodType {\n return withChecks(def.out, def.checks);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/in-out.ts","line":23,"symbol":"inSide","kind":"function","lang":"typescript","doc":"See `classic/in-out.ts`.","code":"function inSide(def: core.$ZodPipeDef): core.$ZodType {\n return def.in._zod.traits.has(\"$ZodTransform\") ? outSide(def) : def.in;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/in-out.ts","line":28,"symbol":"input","kind":"function","lang":"typescript","doc":"See `classic/in-out.ts`.","code":"function input<T extends core.$ZodType>(schema: T): schemas.ZodMiniType<core.input<T>, core.input<T>> {\n return visit(schema, {\n pipe: (s) => inSide(s._zod.def),\n // A default value belongs to the output side, so a rewritten inner type leaves it stranded. `.default()` widens the declared input type with `undefined`, and `optional` is what carries that across.\n default: (s, rewritten) => (rewritten ? schemas.optional(s._zod.def.innerType) : s),\n // A catch value is output-side too, but `.catch()` leaves the declared input type alone, so the inner schema stands on its own.\n catch: (s, rewritten) => (rewritten ? s._zod.def.innerType : s),\n }) as schemas.ZodMiniType<core.input<T>, core.input<T>>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/in-out.ts","line":39,"symbol":"output","kind":"function","lang":"typescript","doc":"See `classic/in-out.ts`.","code":"function output<T extends core.$ZodType>(schema: T): schemas.ZodMiniType<core.output<T>, core.output<T>> {\n return visit(schema, {\n pipe: (s) => outSide(s._zod.def),\n // A prefault value is fed through the schema, which makes it input-side, so a rewritten inner type leaves it stranded.\n prefault: (s, rewritten) => (rewritten ? s._zod.def.innerType : s),\n }) as schemas.ZodMiniType<core.output<T>, core.output<T>>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/iso.ts","line":5,"symbol":"ZodMiniISODateTime","kind":"interface","lang":"typescript","doc":"iso time","code":"interface ZodMiniISODateTime extends schemas.ZodMiniStringFormat<\"datetime\"> {\n _zod: core.$ZodISODateTimeInternals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/iso.ts","line":8,"symbol":"ZodMiniISODateTime","kind":"constant","lang":"typescript","code":"const ZodMiniISODateTime: core.$constructor<ZodMiniISODateTime> = /*@__PURE__*/ core.$constructor(\n \"ZodMiniISODateTime\",\n (inst, def) => {\n core.$ZodISODateTime.init(inst, def);\n schemas.ZodMiniStringFormat.init(inst, def);\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/mini/iso.ts","line":16,"symbol":"datetime","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function datetime(params?: string | core.$ZodISODateTimeParams): ZodMiniISODateTime {\n return core._isoDateTime(ZodMiniISODateTime, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/iso.ts","line":21,"symbol":"ZodMiniISODate","kind":"interface","lang":"typescript","doc":"iso date","code":"interface ZodMiniISODate extends schemas.ZodMiniStringFormat<\"date\"> {\n _zod: core.$ZodISODateInternals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/iso.ts","line":24,"symbol":"ZodMiniISODate","kind":"constant","lang":"typescript","code":"const ZodMiniISODate: core.$constructor<ZodMiniISODate> = /*@__PURE__*/ core.$constructor(\n \"ZodMiniISODate\",\n (inst, def) => {\n core.$ZodISODate.init(inst, def);\n schemas.ZodMiniStringFormat.init(inst, def);\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/mini/iso.ts","line":32,"symbol":"date","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function date(params?: string | core.$ZodISODateParams): ZodMiniISODate {\n return core._isoDate(ZodMiniISODate, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/iso.ts","line":37,"symbol":"ZodMiniISOTime","kind":"interface","lang":"typescript","doc":"iso time","code":"interface ZodMiniISOTime extends schemas.ZodMiniStringFormat<\"time\"> {\n _zod: core.$ZodISOTimeInternals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/iso.ts","line":40,"symbol":"ZodMiniISOTime","kind":"constant","lang":"typescript","code":"const ZodMiniISOTime: core.$constructor<ZodMiniISOTime> = /*@__PURE__*/ core.$constructor(\n \"ZodMiniISOTime\",\n (inst, def) => {\n core.$ZodISOTime.init(inst, def);\n schemas.ZodMiniStringFormat.init(inst, def);\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/mini/iso.ts","line":48,"symbol":"time","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function time(params?: string | core.$ZodISOTimeParams): ZodMiniISOTime {\n return core._isoTime(ZodMiniISOTime, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/iso.ts","line":53,"symbol":"ZodMiniISODuration","kind":"interface","lang":"typescript","doc":"iso duration","code":"interface ZodMiniISODuration extends schemas.ZodMiniStringFormat<\"duration\"> {\n _zod: core.$ZodISODurationInternals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/iso.ts","line":56,"symbol":"ZodMiniISODuration","kind":"constant","lang":"typescript","code":"const ZodMiniISODuration: core.$constructor<ZodMiniISODuration> = /*@__PURE__*/ core.$constructor(\n \"ZodMiniISODuration\",\n (inst, def) => {\n core.$ZodISODuration.init(inst, def);\n schemas.ZodMiniStringFormat.init(inst, def);\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/mini/iso.ts","line":64,"symbol":"duration","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function duration(params?: string | core.$ZodISODurationParams): ZodMiniISODuration {\n return core._isoDuration(ZodMiniISODuration, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":7,"symbol":"SomeType","kind":"type","lang":"typescript","code":"type SomeType = core.SomeType;"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":9,"symbol":"ZodMiniType","kind":"interface","lang":"typescript","code":"interface ZodMiniType<\n out Output = unknown,\n out Input = unknown,\n out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>,\n> extends core.$ZodType<Output, Input, Internals> {\n type: Internals[\"def\"][\"type\"];\n check(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;\n with(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;\n clone(def?: Internals[\"def\"], params?: { parent: boolean }): this;\n register<R extends core.$ZodRegistry>(\n registry: R,\n ...meta: this extends R[\"_schema\"]\n ? undefined extends R[\"_meta\"]\n ? [core.$replace<R[\"_meta\"], this>?]\n : [core.$replace<R[\"_meta\"], this>]\n : [\"Incompatible schema\"]\n ): this;\n brand<T extends PropertyKey = PropertyKey, Dir extends \"in\" | \"out\" | \"inout\" = \"out\">(\n value?: T\n ): PropertyKey extends T ? this : core.$ZodBranded<this, T, Dir>;\n\n def: Internals[\"def\"];\n\n parse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): core.output<this>;\n safeParse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): util.SafeParseResult<core.output<this>>;\n parseAsy"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":42,"symbol":"_ZodMiniType","kind":"interface","lang":"typescript","code":"interface _ZodMiniType<out Internals extends core.$ZodTypeInternals = core.$ZodTypeInternals>\n extends ZodMiniType<any, any, Internals> {}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":45,"symbol":"ZodMiniType","kind":"constant","lang":"typescript","code":"const ZodMiniType: core.$constructor<ZodMiniType> = /*@__PURE__*/ core.$constructor<ZodMiniType>(\n \"ZodMiniType\",\n (inst, def) => {\n if (!inst._zod) throw new Error(\"Uninitialized schema in ZodMiniType.\");\n\n core.$ZodType.init(inst, def);\n\n inst.def = def;\n inst.type = def.type;\n },\n {\n // `with` is an alias for `check`: the same function object, not a wrapper.\n get with(): ZodMiniType[\"check\"] {\n return this.check;\n },\n set with(value: ZodMiniType[\"check\"]) {\n util.own(this, \"with\", value);\n },\n parse(data, params) {\n return parse.parse(this, data, params, { callee: this.parse });\n },\n parseAsync(data, params) {\n return parse.parseAsync(this, data, params, { callee: this.parseAsync });\n },\n safeParse(data, params) {\n return parse.safeParse(this, data, params);\n },\n safeParseAsync(data, params) {\n return parse.safeParseAsync(this, data, params);\n },\n check(...checks) {\n const def = this.def;\n return this.clone(\n {\n ...def,\n checks: [\n ...(def.checks ?? []),\n ...checks.map((ch) =>\n typeof ch === \"function\" ? { _zod: { check: ch"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":57,"symbol":"with","kind":"method","lang":"typescript","doc":"`with` is an alias for `check`: the same function object, not a wrapper.","code":"get with(): ZodMiniType[\"check\"] {\n return this.check;\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":60,"symbol":"with","kind":"method","lang":"typescript","code":"set with(value: ZodMiniType[\"check\"]) {\n util.own(this, \"with\", value);\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":63,"symbol":"parse","kind":"method","lang":"typescript","code":"parse(data, params) {\n return parse.parse(this, data, params, { callee: this.parse });\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":66,"symbol":"parseAsync","kind":"method","lang":"typescript","code":"parseAsync(data, params) {\n return parse.parseAsync(this, data, params, { callee: this.parseAsync });\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":69,"symbol":"safeParse","kind":"method","lang":"typescript","code":"safeParse(data, params) {\n return parse.safeParse(this, data, params);\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":72,"symbol":"safeParseAsync","kind":"method","lang":"typescript","code":"safeParseAsync(data, params) {\n return parse.safeParseAsync(this, data, params);\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":75,"symbol":"check","kind":"method","lang":"typescript","code":"check(...checks) {\n const def = this.def;\n return this.clone(\n {\n ...def,\n checks: [\n ...(def.checks ?? []),\n ...checks.map((ch) =>\n typeof ch === \"function\" ? { _zod: { check: ch, def: { check: \"custom\" }, onattach: [] } } : ch\n ),\n ],\n },\n { parent: true }\n );\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":76,"symbol":"def","kind":"constant","lang":"typescript","code":"const def = this.def;"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":90,"symbol":"clone","kind":"method","lang":"typescript","code":"clone(_def, params) {\n return core.clone(this, _def, params);\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":93,"symbol":"brand","kind":"method","lang":"typescript","code":"brand() {\n return this as any;\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":96,"symbol":"register","kind":"method","lang":"typescript","code":"register(reg: any, meta: any): any {\n reg.add(this, meta);\n return this;\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":100,"symbol":"apply","kind":"method","lang":"typescript","code":"apply(fn: any, ...args: any[]) {\n return args.length === 0 ? fn(this) : fn(this, ...args);\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":106,"symbol":"_ZodMiniString","kind":"interface","lang":"typescript","code":"interface _ZodMiniString<T extends core.$ZodStringInternals<unknown> = core.$ZodStringInternals<unknown>>\n extends _ZodMiniType<T>,\n core.$ZodString<T[\"input\"]> {\n _zod: T;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":113,"symbol":"ZodMiniString","kind":"interface","lang":"typescript","doc":"ZodMiniString","code":"interface ZodMiniString<Input = unknown>\n extends _ZodMiniString<core.$ZodStringInternals<Input>>,\n core.$ZodString<Input> {}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":116,"symbol":"ZodMiniString","kind":"constant","lang":"typescript","code":"const ZodMiniString: core.$constructor<ZodMiniString> = /*@__PURE__*/ core.$constructor(\n \"ZodMiniString\",\n (inst, def) => {\n core.$ZodString.init(inst, def);\n ZodMiniType.init(inst, def);\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":125,"symbol":"string","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function string(params?: string | core.$ZodStringParams): ZodMiniString<string> {\n return core._string(ZodMiniString, params) as any;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":130,"symbol":"ZodMiniStringFormat","kind":"interface","lang":"typescript","doc":"ZodMiniStringFormat","code":"interface ZodMiniStringFormat<Format extends string = string>\n extends _ZodMiniString<core.$ZodStringFormatInternals<Format>>,\n core.$ZodStringFormat<Format> {\n // _zod: core.$ZodStringFormatInternals<Format>;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":135,"symbol":"ZodMiniStringFormat","kind":"constant","lang":"typescript","code":"const ZodMiniStringFormat: core.$constructor<ZodMiniStringFormat> = /*@__PURE__*/ core.$constructor(\n \"ZodMiniStringFormat\",\n (inst, def) => {\n core.$ZodStringFormat.init(inst, def);\n ZodMiniString.init(inst, def);\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":144,"symbol":"ZodMiniEmail","kind":"interface","lang":"typescript","doc":"ZodMiniEmail","code":"interface ZodMiniEmail extends _ZodMiniString<core.$ZodEmailInternals> {}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":145,"symbol":"ZodMiniEmail","kind":"constant","lang":"typescript","code":"const ZodMiniEmail: core.$constructor<ZodMiniEmail> = /*@__PURE__*/ core.$constructor(\n \"ZodMiniEmail\",\n (inst, def) => {\n core.$ZodEmail.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":154,"symbol":"email","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function email(params?: string | core.$ZodEmailParams): ZodMiniEmail {\n return core._email(ZodMiniEmail, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":159,"symbol":"ZodMiniGUID","kind":"interface","lang":"typescript","doc":"ZodMiniGUID","code":"interface ZodMiniGUID extends _ZodMiniString<core.$ZodGUIDInternals> {\n // _zod: core.$ZodGUIDInternals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":162,"symbol":"ZodMiniGUID","kind":"constant","lang":"typescript","code":"const ZodMiniGUID: core.$constructor<ZodMiniGUID> = /*@__PURE__*/ core.$constructor(\n \"ZodMiniGUID\",\n (inst, def) => {\n core.$ZodGUID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":171,"symbol":"guid","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function guid(params?: string | core.$ZodGUIDParams): ZodMiniGUID {\n return core._guid(ZodMiniGUID, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":176,"symbol":"ZodMiniUUID","kind":"interface","lang":"typescript","doc":"ZodMiniUUID","code":"interface ZodMiniUUID extends _ZodMiniString<core.$ZodUUIDInternals> {\n // _zod: core.$ZodUUIDInternals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":179,"symbol":"ZodMiniUUID","kind":"constant","lang":"typescript","code":"const ZodMiniUUID: core.$constructor<ZodMiniUUID> = /*@__PURE__*/ core.$constructor(\n \"ZodMiniUUID\",\n (inst, def) => {\n core.$ZodUUID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":188,"symbol":"uuid","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function uuid(params?: string | core.$ZodUUIDParams): ZodMiniUUID {\n return core._uuid(ZodMiniUUID, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":193,"symbol":"uuidv4","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function uuidv4(params?: string | core.$ZodUUIDv4Params): ZodMiniUUID {\n return core._uuidv4(ZodMiniUUID, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":200,"symbol":"uuidv6","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function uuidv6(params?: string | core.$ZodUUIDv6Params): ZodMiniUUID {\n return core._uuidv6(ZodMiniUUID, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":207,"symbol":"uuidv7","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function uuidv7(params?: string | core.$ZodUUIDv7Params): ZodMiniUUID {\n return core._uuidv7(ZodMiniUUID, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":212,"symbol":"ZodMiniURL","kind":"interface","lang":"typescript","doc":"ZodMiniURL","code":"interface ZodMiniURL extends _ZodMiniString<core.$ZodURLInternals> {\n // _zod: core.$ZodURLInternals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":215,"symbol":"ZodMiniURL","kind":"constant","lang":"typescript","code":"const ZodMiniURL: core.$constructor<ZodMiniURL> = /*@__PURE__*/ core.$constructor(\"ZodMiniURL\", (inst, def) => {\n core.$ZodURL.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":221,"symbol":"url","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function url(params?: string | core.$ZodURLParams): ZodMiniURL {\n return core._url(ZodMiniURL, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":226,"symbol":"httpUrl","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function httpUrl(params?: string | Omit<core.$ZodURLParams, \"protocol\" | \"hostname\">): ZodMiniURL {\n return core._url(ZodMiniURL, {\n protocol: regexes.httpProtocol,\n hostname: regexes.domain,\n ...util.normalizeParams(params),\n });\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":235,"symbol":"ZodMiniEmoji","kind":"interface","lang":"typescript","doc":"ZodMiniEmoji","code":"interface ZodMiniEmoji extends _ZodMiniString<core.$ZodEmojiInternals> {\n // _zod: core.$ZodEmojiInternals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":238,"symbol":"ZodMiniEmoji","kind":"constant","lang":"typescript","code":"const ZodMiniEmoji: core.$constructor<ZodMiniEmoji> = /*@__PURE__*/ core.$constructor(\n \"ZodMiniEmoji\",\n (inst, def) => {\n core.$ZodEmoji.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":247,"symbol":"emoji","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function emoji(params?: string | core.$ZodEmojiParams): ZodMiniEmoji {\n return core._emoji(ZodMiniEmoji, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":252,"symbol":"ZodMiniNanoID","kind":"interface","lang":"typescript","doc":"ZodMiniNanoID","code":"interface ZodMiniNanoID extends _ZodMiniString<core.$ZodNanoIDInternals> {\n // _zod: core.$ZodNanoIDInternals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":255,"symbol":"ZodMiniNanoID","kind":"constant","lang":"typescript","code":"const ZodMiniNanoID: core.$constructor<ZodMiniNanoID> = /*@__PURE__*/ core.$constructor(\n \"ZodMiniNanoID\",\n (inst, def) => {\n core.$ZodNanoID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":264,"symbol":"nanoid","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function nanoid(params?: string | core.$ZodNanoIDParams): ZodMiniNanoID {\n return core._nanoid(ZodMiniNanoID, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":274,"symbol":"ZodMiniCUID","kind":"interface","lang":"typescript","doc":"ZodMiniCUID @deprecated CUID v1 is deprecated by its authors due to information leakage (timestamps embedded in the id). Use {@link ZodMiniCUID2} instead. See https://github.com/paralleldrive/cuid.","code":"interface ZodMiniCUID extends _ZodMiniString<core.$ZodCUIDInternals> {\n // _zod: core.$ZodCUIDInternals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":282,"symbol":"ZodMiniCUID","kind":"constant","lang":"typescript","doc":"@deprecated CUID v1 is deprecated by its authors due to information leakage (timestamps embedded in the id). Use {@link ZodMiniCUID2} instead. See https://github.com/paralleldrive/cuid.","code":"const ZodMiniCUID: core.$constructor<ZodMiniCUID> = /*@__PURE__*/ core.$constructor(\n \"ZodMiniCUID\",\n (inst, def) => {\n core.$ZodCUID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":298,"symbol":"cuid","kind":"function","lang":"typescript","doc":"@deprecated CUID v1 is deprecated by its authors due to information leakage (timestamps embedded in the id). Use {@link cuid2 | `z.cuid2()`} instead. See https://github.com/paralleldrive/cuid. @__NO_SIDE_EFFECTS__","code":"function cuid(params?: string | core.$ZodCUIDParams): ZodMiniCUID {\n return core._cuid(ZodMiniCUID, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":303,"symbol":"ZodMiniCUID2","kind":"interface","lang":"typescript","doc":"ZodMiniCUID2","code":"interface ZodMiniCUID2 extends _ZodMiniString<core.$ZodCUID2Internals> {\n // _zod: core.$ZodCUID2Internals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":306,"symbol":"ZodMiniCUID2","kind":"constant","lang":"typescript","code":"const ZodMiniCUID2: core.$constructor<ZodMiniCUID2> = /*@__PURE__*/ core.$constructor(\n \"ZodMiniCUID2\",\n (inst, def) => {\n core.$ZodCUID2.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":315,"symbol":"cuid2","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function cuid2(params?: string | core.$ZodCUID2Params): ZodMiniCUID2 {\n return core._cuid2(ZodMiniCUID2, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":320,"symbol":"ZodMiniULID","kind":"interface","lang":"typescript","doc":"ZodMiniULID","code":"interface ZodMiniULID extends _ZodMiniString<core.$ZodULIDInternals> {\n // _zod: core.$ZodULIDInternals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":323,"symbol":"ZodMiniULID","kind":"constant","lang":"typescript","code":"const ZodMiniULID: core.$constructor<ZodMiniULID> = /*@__PURE__*/ core.$constructor(\n \"ZodMiniULID\",\n (inst, def) => {\n core.$ZodULID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":332,"symbol":"ulid","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function ulid(params?: string | core.$ZodULIDParams): ZodMiniULID {\n return core._ulid(ZodMiniULID, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":337,"symbol":"ZodMiniXID","kind":"interface","lang":"typescript","doc":"ZodMiniXID","code":"interface ZodMiniXID extends _ZodMiniString<core.$ZodXIDInternals> {\n // _zod: core.$ZodXIDInternals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":340,"symbol":"ZodMiniXID","kind":"constant","lang":"typescript","code":"const ZodMiniXID: core.$constructor<ZodMiniXID> = /*@__PURE__*/ core.$constructor(\"ZodMiniXID\", (inst, def) => {\n core.$ZodXID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":346,"symbol":"xid","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function xid(params?: string | core.$ZodXIDParams): ZodMiniXID {\n return core._xid(ZodMiniXID, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":351,"symbol":"ZodMiniKSUID","kind":"interface","lang":"typescript","doc":"ZodMiniKSUID","code":"interface ZodMiniKSUID extends _ZodMiniString<core.$ZodKSUIDInternals> {\n // _zod: core.$ZodKSUIDInternals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":354,"symbol":"ZodMiniKSUID","kind":"constant","lang":"typescript","code":"const ZodMiniKSUID: core.$constructor<ZodMiniKSUID> = /*@__PURE__*/ core.$constructor(\n \"ZodMiniKSUID\",\n (inst, def) => {\n core.$ZodKSUID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":363,"symbol":"ksuid","kind":"function","lang":"typescript","doc":"@__NO_SIDE_EFFECTS__","code":"function ksuid(params?: string | core.$ZodKSUIDParams): ZodMiniKSUID {\n return core._ksuid(ZodMiniKSUID, params);\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/schemas.ts","line":368,"symbol":"ZodMiniIPv4","kind":"interface","lang":"typescript","doc":"ZodMiniIPv4","code":"interface ZodMiniIPv4 extends _ZodMiniString<core.$ZodIPv4Internals> {\n // _zod: core.$ZodIPv4Internals;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/apply.test.ts","line":5,"symbol":"setCommonNumberChecks","kind":"constant","lang":"typescript","code":"const setCommonNumberChecks = <T extends z.ZodMiniNumber>(schema: T) => {\n return schema.check(z.minimum(0), z.maximum(100));\n };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/apply.test.ts","line":9,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.nullable(z.number().apply(setCommonNumberChecks));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/apply.test.ts","line":19,"symbol":"symbol","kind":"constant","lang":"typescript","code":"const symbol = Symbol();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/apply.test.ts","line":20,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.number().apply(() => symbol);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/apply.test.ts","line":27,"symbol":"calls","kind":"constant","lang":"typescript","code":"const calls: unknown[] = [];"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/apply.test.ts","line":28,"symbol":"capture","kind":"constant","lang":"typescript","code":"const capture = (schema: z.ZodMiniString, ...args: unknown[]) => {\n calls.push(schema, ...args);\n return schema;\n };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/apply.test.ts","line":33,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/apply.test.ts","line":34,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = schema.apply(capture, \"id\", 42);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/apply.test.ts","line":44,"symbol":"withMin","kind":"constant","lang":"typescript","code":"const withMin = (schema: z.ZodMiniString, n: number) => schema.check(z.minLength(n));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/assignability.test.ts","line":79,"symbol":"lazySchema","kind":"constant","lang":"typescript","doc":"$ZodLazy","code":"const lazySchema = z.lazy(() => z.string());"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/assignability.test.ts","line":120,"symbol":"Company","kind":"type","lang":"typescript","code":"type Company = {\n id: string;\n name: string;\n webAddress: string | null;\n };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/assignability.test.ts","line":126,"symbol":"CompanySchema","kind":"constant","lang":"typescript","code":"const CompanySchema = z.object({\n id: z.string(),\n name: z.string(),\n webAddress: z.nullable(z.string()),\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/assignability.test.ts","line":131,"symbol":"Company","kind":"constant","lang":"typescript","code":"const Company = z.toZod<Company>()(CompanySchema);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/assignability.test.ts","line":135,"symbol":"CoreCompany","kind":"constant","lang":"typescript","code":"const CoreCompany = z.core.toZod<Company>()(CompanySchema);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/assignability.test.ts","line":138,"symbol":"UtilCompany","kind":"constant","lang":"typescript","code":"const UtilCompany = z.core.util.toZod<Company>()(CompanySchema);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/assignability.test.ts","line":141,"symbol":"Transformed","kind":"constant","lang":"typescript","code":"const Transformed = z.toZod<{ count: number }>()(\n z.object({\n count: z.pipe(\n z.string(),\n z.transform((value) => value.length)\n ),\n })\n );"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/assignability.test.ts","line":181,"symbol":"_RefinedSchema","kind":"type","lang":"typescript","code":"type _RefinedSchema<T extends z.ZodMiniType<object> | z.ZodMiniUnion> = T extends z.ZodMiniUnion\n ? RefinedUnionSchema<T> // <-- Type instantiation is excessively deep and possibly infinite.\n : T extends z.ZodMiniType<object>\n ? RefinedTypeSchema<z.output<T>> // <-- Type instantiation is excessively deep and possibly infinite.\n : never;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/assignability.test.ts","line":187,"symbol":"RefinedTypeSchema","kind":"type","lang":"typescript","code":"type RefinedTypeSchema<T extends object> = T;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/assignability.test.ts","line":189,"symbol":"RefinedUnionSchema","kind":"type","lang":"typescript","code":"type RefinedUnionSchema<T extends z.ZodMiniUnion> = T;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":5,"symbol":"mySchema","kind":"constant","lang":"typescript","code":"const mySchema = z\n .object({\n name: z.string(),\n })\n .brand<\"superschema\">();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":12,"symbol":"MySchema","kind":"type","lang":"typescript","doc":"simple branding","code":"type MySchema = z.infer<typeof mySchema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":16,"symbol":"doStuff","kind":"constant","lang":"typescript","code":"const doStuff = (arg: MySchema) => arg;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":20,"symbol":"extendedSchema","kind":"constant","lang":"typescript","doc":"inheritance","code":"const extendedSchema = mySchema.brand<\"subschema\">();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":21,"symbol":"ExtendedSchema","kind":"type","lang":"typescript","code":"type ExtendedSchema = z.infer<typeof extendedSchema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":27,"symbol":"numberSchema","kind":"constant","lang":"typescript","doc":"number branding","code":"const numberSchema = z.number().brand<42>();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":28,"symbol":"NumberSchema","kind":"type","lang":"typescript","code":"type NumberSchema = z.infer<typeof numberSchema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":32,"symbol":"MyBrand","kind":"constant","lang":"typescript","doc":"symbol branding","code":"const MyBrand: unique symbol = Symbol(\"hello\");"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":33,"symbol":"MyBrand","kind":"type","lang":"typescript","code":"type MyBrand = typeof MyBrand;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":34,"symbol":"symbolBrand","kind":"constant","lang":"typescript","code":"const symbolBrand = z.number().brand<\"sup\">().brand<typeof MyBrand>();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":35,"symbol":"SymbolBrand","kind":"type","lang":"typescript","code":"type SymbolBrand = z.infer<typeof symbolBrand>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":40,"symbol":"age","kind":"constant","lang":"typescript","doc":"keeping brands out of input types","code":"const age = z.number().brand<\"age\">();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":41,"symbol":"Age1","kind":"type","lang":"typescript","code":"type Age1 = z.infer<typeof age>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":42,"symbol":"AgeInput1","kind":"type","lang":"typescript","code":"type AgeInput1 = z.input<typeof age>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":54,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().brand<\"A\">();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":55,"symbol":"Input","kind":"type","lang":"typescript","code":"type Input = z.input<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":56,"symbol":"Output","kind":"type","lang":"typescript","code":"type Output = z.output<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":65,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().brand<\"A\", \"out\">();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":66,"symbol":"Input","kind":"type","lang":"typescript","code":"type Input = z.input<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":67,"symbol":"Output","kind":"type","lang":"typescript","code":"type Output = z.output<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":76,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().brand<\"A\", \"in\">();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":77,"symbol":"Input","kind":"type","lang":"typescript","code":"type Input = z.input<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":78,"symbol":"Output","kind":"type","lang":"typescript","code":"type Output = z.output<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":87,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().brand<\"A\", \"inout\">();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":88,"symbol":"Input","kind":"type","lang":"typescript","code":"type Input = z.input<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/brand.test.ts","line":89,"symbol":"Output","kind":"type","lang":"typescript","code":"type Output = z.output<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":6,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.number().check(z.lt(10));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":14,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.number().check(z.lte(10));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":22,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.number().check(z.maximum(10));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":30,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.number().check(z.gt(10));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":38,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.number().check(z.gte(10));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":45,"symbol":"bound","kind":"constant","lang":"typescript","code":"const bound = new Date(Date.UTC(2022, 10, 5)).getTime();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":46,"symbol":"tooSmall","kind":"constant","lang":"typescript","code":"const tooSmall = z.safeParse(z.date().check(z.gte(bound)), new Date(Date.UTC(2022, 10, 4)));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":47,"symbol":"tooBig","kind":"constant","lang":"typescript","code":"const tooBig = z.safeParse(z.date().check(z.lte(bound)), new Date(Date.UTC(2022, 10, 6)));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":54,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.number().check(z.minimum(10));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":62,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.array(z.string()).check(z.maxLength(3));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":69,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.array(z.string()).check(z.minLength(3));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":76,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.array(z.string()).check(z.length(3));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":84,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string().check(z.regex(/^aaa$/));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":91,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string().check(z.includes(\"asdf\"));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":101,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string().check(z.startsWith(\"asdf\"));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":109,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string().check(z.endsWith(\"asdf\"));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":117,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string().check(z.lowercase());"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":124,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string().check(z.uppercase());"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":133,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string().check(z.overwrite((val) => val.toUpperCase()));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":144,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.instanceof(URL).check(...z.properties({ protocol: z.literal(\"https:\"), hostname: z.string() }));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":150,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string().check(\n z.refine((val) => val.length > 1),\n z.refine((val) => val.length > 2, { abort: true }),\n z.refine((val) => val.length > 3)\n );"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":155,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = \"\";"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/checks.test.ts","line":156,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.safeParse(schema, data);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":7,"symbol":"isoDateCodec","kind":"constant","lang":"typescript","code":"const isoDateCodec = z.codec(\n z.iso.datetime(), // Input: ISO string (validates to string)\n z.date(), // Output: Date object\n {\n decode: (isoString) => new Date(isoString), // Forward: ISO string → Date\n encode: (date) => date.toISOString(), // Backward: Date → ISO string\n }\n);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":30,"symbol":"testIsoString","kind":"constant","lang":"typescript","code":"const testIsoString = \"2024-01-15T10:30:00.000Z\";"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":31,"symbol":"testDate","kind":"constant","lang":"typescript","code":"const testDate = new Date(\"2024-01-15T10:30:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":34,"symbol":"decodedResult","kind":"constant","lang":"typescript","doc":"Forward decoding (ISO string -> Date)","code":"const decodedResult = z.decode(isoDateCodec, testIsoString);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":39,"symbol":"encodedResult","kind":"constant","lang":"typescript","doc":"Backward encoding (Date -> ISO string)","code":"const encodedResult = z.encode(isoDateCodec, testDate);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":45,"symbol":"isoDateCodec","kind":"constant","lang":"typescript","code":"const isoDateCodec = z.codec(z.iso.datetime(), z.date(), {\n decode: (isoString) => new Date(isoString),\n encode: (date) => date.toISOString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":50,"symbol":"original","kind":"constant","lang":"typescript","code":"const original = \"2024-12-25T15:45:30.123Z\";"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":51,"symbol":"toDate","kind":"constant","lang":"typescript","code":"const toDate = z.decode(isoDateCodec, original);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":52,"symbol":"backToString","kind":"constant","lang":"typescript","code":"const backToString = z.encode(isoDateCodec, toDate);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":60,"symbol":"isoDateCodec","kind":"constant","lang":"typescript","code":"const isoDateCodec = z\n .codec(z.iso.datetime(), z.date(), {\n decode: (isoString) => new Date(isoString),\n encode: (date) => date.toISOString(),\n })\n .check(z.refine((val) => val.getFullYear() === 2024, { error: \"Year must be 2024\" }));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":68,"symbol":"validDate","kind":"constant","lang":"typescript","doc":"Valid 2024 date","code":"const validDate = z.decode(isoDateCodec, \"2024-01-15T10:30:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":73,"symbol":"invalidYearResult","kind":"constant","lang":"typescript","doc":"Invalid year should fail safely","code":"const invalidYearResult = z.safeDecode(isoDateCodec, \"2023-01-15T10:30:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":89,"symbol":"isoDateCodec","kind":"constant","lang":"typescript","code":"const isoDateCodec = z.codec(z.iso.datetime(), z.date(), {\n decode: (isoString) => new Date(isoString),\n encode: (date) => date.toISOString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":95,"symbol":"safeDecodeResult","kind":"constant","lang":"typescript","doc":"Safe decode with invalid input","code":"const safeDecodeResult = z.safeDecode(isoDateCodec, \"invalid-date\");"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":113,"symbol":"safeDecodeValid","kind":"constant","lang":"typescript","doc":"Safe decode with valid input","code":"const safeDecodeValid = z.safeDecode(isoDateCodec, \"2024-01-15T10:30:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":121,"symbol":"safeEncodeResult","kind":"constant","lang":"typescript","doc":"Safe encode with valid input","code":"const safeEncodeResult = z.safeEncode(isoDateCodec, new Date(\"2024-01-01\"));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":130,"symbol":"stringNumberCodec","kind":"constant","lang":"typescript","doc":"String -> Number codec","code":"const stringNumberCodec = z.codec(z.string(), z.number(), {\n decode: (str) => Number.parseFloat(str),\n encode: (num) => num.toString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":135,"symbol":"decodedNumber","kind":"constant","lang":"typescript","code":"const decodedNumber = z.decode(stringNumberCodec, \"42.5\");"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":139,"symbol":"encodedString","kind":"constant","lang":"typescript","code":"const encodedString = z.encode(stringNumberCodec, 42.5);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":145,"symbol":"isoDateCodec","kind":"constant","lang":"typescript","code":"const isoDateCodec = z.codec(z.iso.datetime(), z.date(), {\n decode: (isoString) => new Date(isoString),\n encode: (date) => date.toISOString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":151,"symbol":"decodedResult","kind":"constant","lang":"typescript","doc":"Async decode","code":"const decodedResult = await z.decodeAsync(isoDateCodec, \"2024-01-15T10:30:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":156,"symbol":"encodedResult","kind":"constant","lang":"typescript","doc":"Async encode","code":"const encodedResult = await z.encodeAsync(isoDateCodec, new Date(\"2024-01-15T10:30:00.000Z\"));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":161,"symbol":"safeDecodeResult","kind":"constant","lang":"typescript","doc":"Safe async operations","code":"const safeDecodeResult = await z.safeDecodeAsync(isoDateCodec, \"2024-01-15T10:30:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":167,"symbol":"safeEncodeResult","kind":"constant","lang":"typescript","code":"const safeEncodeResult = await z.safeEncodeAsync(isoDateCodec, new Date(\"2024-01-15T10:30:00.000Z\"));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":175,"symbol":"codec","kind":"constant","lang":"typescript","code":"const codec = z.codec(z.string(), z.number(), {\n decode: (str) => Number.parseInt(str),\n encode: (num) => num.toString(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":181,"symbol":"decoded","kind":"constant","lang":"typescript","doc":"These should compile without type errors","code":"const decoded: number = z.decode(codec, \"123\");"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":182,"symbol":"encoded","kind":"constant","lang":"typescript","code":"const encoded: string = z.encode(codec, 123);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":190,"symbol":"waypointSchema","kind":"constant","lang":"typescript","doc":"Nested schema: object containing a codec as one of its properties, with refinements at all levels","code":"const waypointSchema = z\n .object({\n name: z.string().check(z.minLength(1, \"Waypoint name required\")),\n difficulty: z.enum([\"easy\", \"medium\", \"hard\"]),\n coordinate: z\n .codec(\n z\n .string()\n .check(z.regex(/^-?\\d+,-?\\d+$/, \"Must be 'x,y' format\")), // Input: coordinate string\n z\n .object({ x: z.number(), y: z.number() })\n .check(z.refine((coord) => coord.x >= 0 && coord.y >= 0, { error: \"Coordinates must be non-negative\" })), // Output: coordinate object\n {\n decode: (coordString: string) => {\n const [x, y] = coordString.split(\",\").map(Number);\n return { x, y };\n },\n encode: (coord: { x: number; y: number }) => `${coord.x},${coord.y}`,\n }\n )\n .check(z.refine((coord) => coord.x <= 1000 && coord.y <= 1000, { error: \"Coordinates must be within bounds\" })),\n })\n .check(\n z.refine((waypoint) => waypoint.difficulty !== \"hard\" || waypoint.coordinate.x >= 100, {\n error: \"Hard waypoints must be at least 100 units from origin\",\n })\n );"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":219,"symbol":"inputWaypoint","kind":"constant","lang":"typescript","doc":"Test data","code":"const inputWaypoint = {\n name: \"Summit Point\",\n difficulty: \"medium\" as const,\n coordinate: \"150,200\",\n };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":226,"symbol":"decodedWaypoint","kind":"constant","lang":"typescript","doc":"Forward decoding (object with string coordinate -> object with coordinate object)","code":"const decodedWaypoint = z.decode(waypointSchema, inputWaypoint);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":239,"symbol":"encodedWaypoint","kind":"constant","lang":"typescript","doc":"Backward encoding (object with coordinate object -> object with string coordinate)","code":"const encodedWaypoint = z.encode(waypointSchema, decodedWaypoint);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":251,"symbol":"emptyNameResult","kind":"constant","lang":"typescript","doc":"String validation (empty waypoint name)","code":"const emptyNameResult = z.safeDecode(waypointSchema, {\n name: \"\",\n difficulty: \"easy\",\n coordinate: \"10,20\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":275,"symbol":"invalidDifficultyResult","kind":"constant","lang":"typescript","doc":"Enum validation (invalid difficulty)","code":"const invalidDifficultyResult = z.safeDecode(waypointSchema, {\n name: \"Test Point\",\n difficulty: \"impossible\" as any,\n coordinate: \"10,20\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":301,"symbol":"invalidFormatResult","kind":"constant","lang":"typescript","doc":"Codec string format validation (invalid coordinate format)","code":"const invalidFormatResult = z.safeDecode(waypointSchema, {\n name: \"Test Point\",\n difficulty: \"easy\",\n coordinate: \"invalid\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":325,"symbol":"negativeCoordResult","kind":"constant","lang":"typescript","doc":"Codec object refinement (negative coordinates)","code":"const negativeCoordResult = z.safeDecode(waypointSchema, {\n name: \"Test Point\",\n difficulty: \"easy\",\n coordinate: \"-5,10\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":346,"symbol":"outOfBoundsResult","kind":"constant","lang":"typescript","doc":"Codec-level refinement (coordinates out of bounds)","code":"const outOfBoundsResult = z.safeDecode(waypointSchema, {\n name: \"Test Point\",\n difficulty: \"easy\",\n coordinate: \"1500,2000\",\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":367,"symbol":"hardWaypointResult","kind":"constant","lang":"typescript","doc":"Object-level refinement (hard waypoint too close to origin)","code":"const hardWaypointResult = z.safeDecode(waypointSchema, {\n name: \"Expert Point\",\n difficulty: \"hard\",\n coordinate: \"50,60\", // x < 100, but hard waypoints need x >= 100\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":386,"symbol":"roundTripResult","kind":"constant","lang":"typescript","doc":"Round trip test","code":"const roundTripResult = z.encode(waypointSchema, z.decode(waypointSchema, inputWaypoint));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":397,"symbol":"A","kind":"constant","lang":"typescript","code":"const A = z.codec(z.string(), z.string().check(z.trim()), {\n decode: (val) => val,\n encode: (val) => val,\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":408,"symbol":"stringToNumberCodec","kind":"constant","lang":"typescript","doc":"Test that codec functions have correct type signatures","code":"const stringToNumberCodec = z.codec(z.string(), z.number(), {\n decode: (value: string) => Number(value), // core.output<A> -> core.input<B>\n encode: (value: number) => String(value), // core.input<B> -> core.output<A>\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":422,"symbol":"validDecode","kind":"constant","lang":"typescript","doc":"Test that decode parameter type is core.output<A> (string)","code":"const validDecode = (value: string) => Number(value);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":426,"symbol":"validEncode","kind":"constant","lang":"typescript","doc":"Test that encode parameter type is core.input<B> (number)","code":"const validEncode = (value: number) => String(value);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":456,"symbol":"asyncCodec","kind":"constant","lang":"typescript","doc":"Test that async encode/decode functions work properly","code":"const asyncCodec = z.codec(z.string(), z.number(), {\n decode: async (str) => {\n await new Promise((resolve) => setTimeout(resolve, 1)); // Simulate async work\n return Number.parseFloat(str);\n },\n encode: async (num) => {\n await new Promise((resolve) => setTimeout(resolve, 1)); // Simulate async work\n return num.toString();\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":468,"symbol":"decoded","kind":"constant","lang":"typescript","doc":"Test async decode/encode","code":"const decoded = await z.decodeAsync(asyncCodec, \"42.5\");"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":471,"symbol":"encoded","kind":"constant","lang":"typescript","code":"const encoded = await z.encodeAsync(asyncCodec, 42.5);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":475,"symbol":"mixedCodec","kind":"constant","lang":"typescript","doc":"Test that both sync and async work","code":"const mixedCodec = z.codec(z.string(), z.number(), {\n decode: async (str) => Number.parseFloat(str),\n encode: (num) => num.toString(), // sync encode\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":480,"symbol":"mixedResult","kind":"constant","lang":"typescript","code":"const mixedResult = await z.decodeAsync(mixedCodec, \"123\");"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":485,"symbol":"User","kind":"type","lang":"typescript","code":"type User = { id: number; name: string };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":486,"symbol":"UserInput","kind":"type","lang":"typescript","code":"type UserInput = { id: string; name: string };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":488,"symbol":"userCodec","kind":"constant","lang":"typescript","code":"const userCodec = z.codec(\n z.object({ id: z.string(), name: z.string() }),\n z.object({ id: z.number(), name: z.string() }),\n {\n decode: (input: UserInput) => ({ id: Number(input.id), name: input.name }),\n encode: (user: User) => ({ id: String(user.id), name: user.name }),\n }\n );"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":533,"symbol":"inverted","kind":"constant","lang":"typescript","code":"const inverted = z.invertCodec(isoDateCodec);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":535,"symbol":"InvIn","kind":"type","lang":"typescript","code":"type InvIn = z.input<typeof inverted>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":536,"symbol":"InvOut","kind":"type","lang":"typescript","code":"type InvOut = z.output<typeof inverted>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":540,"symbol":"testDate","kind":"constant","lang":"typescript","code":"const testDate = new Date(\"2024-01-15T10:30:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":543,"symbol":"encoded","kind":"constant","lang":"typescript","code":"const encoded = z.encode(inverted, \"2024-01-15T10:30:00.000Z\");"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":547,"symbol":"doubleInverted","kind":"constant","lang":"typescript","code":"const doubleInverted = z.invertCodec(z.invertCodec(isoDateCodec));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":552,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z\n .codec(z.string(), z.number(), { decode: Number, encode: String })\n .check(z.refine((n) => n > 10, { error: \"gt10\" }));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":563,"symbol":"p","kind":"constant","lang":"typescript","code":"const p = z.pipe(\n z.transform((v: unknown) => String(v)),\n z.string().check(z.minLength(5))\n );"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":573,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.codec(z.string(), z.number(), { decode: Number, encode: String });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/codec.test.ts","line":579,"symbol":"plain","kind":"constant","lang":"typescript","doc":"A wrapper over a pipe-free schema keeps both its value and its identity.","code":"const plain = z._default(z.string(), \"x\");"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/computed.test.ts","line":8,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.number().check(z.minimum(5), z.minimum(6), z.minimum(7), z.maximum(10), z.maximum(11), z.maximum(12));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/computed.test.ts","line":14,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.number().check(z.multipleOf(5));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/computed.test.ts","line":19,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = z.int32();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/computed.test.ts","line":28,"symbol":"e","kind":"constant","lang":"typescript","code":"const e = z.array(z.string()).check(z.length(5));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/cyclic-data.test.ts","line":9,"symbol":"cyclic","kind":"constant","lang":"typescript","code":"const cyclic = (): any => {\n const input: any = { id: 1 };\n input.self = input;\n return input;\n};"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/cyclic-data.test.ts","line":10,"symbol":"input","kind":"constant","lang":"typescript","code":"const input: any = { id: 1 };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/cyclic-data.test.ts","line":16,"symbol":"Before","kind":"constant","lang":"typescript","code":"const Before: any = z.object({\n id: z.number(),\n get self() {\n return Before;\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/cyclic-data.test.ts","line":18,"symbol":"self","kind":"method","lang":"typescript","code":"get self() {\n return Before;\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/cyclic-data.test.ts","line":25,"symbol":"After","kind":"constant","lang":"typescript","code":"const After: any = z.object({\n id: z.number(),\n get self() {\n return After;\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/cyclic-data.test.ts","line":27,"symbol":"self","kind":"method","lang":"typescript","code":"get self() {\n return After;\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/cyclic-data.test.ts","line":31,"symbol":"out","kind":"constant","lang":"typescript","code":"const out = After.parse(cyclic());"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/cyclic-data.test.ts","line":40,"symbol":"Arr","kind":"constant","lang":"typescript","code":"const Arr: any = z.array(z.lazy(() => Arr));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/cyclic-data.test.ts","line":41,"symbol":"input","kind":"constant","lang":"typescript","code":"const input: any = [];"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/cyclic-data.test.ts","line":43,"symbol":"out","kind":"constant","lang":"typescript","code":"const out = Arr.parse(input);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/cyclic-data.test.ts","line":49,"symbol":"Inner","kind":"constant","lang":"typescript","code":"const Inner: any = z.object({\n name: z.string(),\n get self() {\n return Wrapped;\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/cyclic-data.test.ts","line":51,"symbol":"self","kind":"method","lang":"typescript","code":"get self() {\n return Wrapped;\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/cyclic-data.test.ts","line":55,"symbol":"Wrapped","kind":"constant","lang":"typescript","code":"const Wrapped: any = z.pipe(\n Inner,\n z.transform((value: any) => ({ wrapped: value }))\n );"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/cyclic-data.test.ts","line":60,"symbol":"input","kind":"constant","lang":"typescript","code":"const input: any = { name: \"x\" };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/cyclic-data.test.ts","line":68,"symbol":"Node","kind":"constant","lang":"typescript","code":"const Node: any = z.object({\n n: z.pipe(\n z.number(),\n z.transform((value: number) => value * 2)\n ),\n get self() {\n return Node;\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/cyclic-data.test.ts","line":73,"symbol":"self","kind":"method","lang":"typescript","code":"get self() {\n return Node;\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/cyclic-data.test.ts","line":78,"symbol":"input","kind":"constant","lang":"typescript","code":"const input: any = { n: 21 };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/cyclic-data.test.ts","line":81,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = Node.parse(input);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/deep-partial.test.ts","line":6,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n name: z.string(),\n profile: z.object({ bio: z.string(), age: z.number() }),\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/deep-partial.test.ts","line":10,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = z.deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/deep-partial.test.ts","line":21,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: z.string(), nested: z.object({ b: z.number() }) });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/deep-partial.test.ts","line":22,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = z.deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/deep-partial.test.ts","line":28,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.tuple([z.object({ a: z.string() }), z.string()]);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/deep-partial.test.ts","line":29,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = z.deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/deep-partial.test.ts","line":35,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.codec(z.object({ a: z.string() }), z.object({ a: z.string() }), {\n decode: (v) => v,\n encode: (v) => v,\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/deep-partial.test.ts","line":39,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = z.deepPartial(schema);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/deep-partial.test.ts","line":44,"symbol":"Category","kind":"constant","lang":"typescript","code":"const Category = z.object({\n name: z.string(),\n get subcategories() {\n return z.optional(z.array(Category));\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/deep-partial.test.ts","line":46,"symbol":"subcategories","kind":"method","lang":"typescript","code":"get subcategories() {\n return z.optional(z.array(Category));\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/deep-partial.test.ts","line":50,"symbol":"partial","kind":"constant","lang":"typescript","code":"const partial = z.deepPartial(Category);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/error.test.ts","line":5,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = z.safeParse(z.string(), 12);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/error.test.ts","line":12,"symbol":"e1","kind":"constant","lang":"typescript","code":"const e1 = z.string().safeParse(123).error!;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/error.test.ts","line":27,"symbol":"callSite","kind":"function","lang":"typescript","code":"function callSite() {\n z.parse(z.string(), 123);\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/error.test.ts","line":38,"symbol":"stack","kind":"constant","lang":"typescript","code":"const stack = (thrown as Error).stack!;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/functions.test.ts","line":9,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.function({ input: [z.string()], output: z.number() });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/functions.test.ts","line":10,"symbol":"fn","kind":"constant","lang":"typescript","code":"const fn = schema.implement((s) => s.length);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":6,"symbol":"string","kind":"constant","lang":"typescript","code":"const string = z.string({ checks: [z.minLength(1), z.maxLength(3)] as const });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":7,"symbol":"number","kind":"constant","lang":"typescript","code":"const number = z.number({ checks: [z.minimum(1), z.maximum(3)] as const });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":28,"symbol":"checks","kind":"constant","lang":"typescript","code":"const checks = [z.minLength(1)];"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":29,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = factory({ checks });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":32,"symbol":"checks","kind":"method","lang":"typescript","code":"get checks() {\n if (++reads > 1) throw new Error(\"checks read twice\");\n return checks;\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":44,"symbol":"checks","kind":"constant","lang":"typescript","code":"const checks = [z.minimum(1)];"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":45,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = factory({ checks });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":48,"symbol":"checks","kind":"method","lang":"typescript","code":"get checks() {\n if (++reads > 1) throw new Error(\"checks read twice\");\n return checks;\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":62,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.boolean();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":67,"symbol":"a","kind":"type","lang":"typescript","code":"type a = z.output<typeof a>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":72,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.bigint();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":79,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.symbol();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":80,"symbol":"sym","kind":"constant","lang":"typescript","code":"const sym = Symbol();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":86,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.date();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":87,"symbol":"date","kind":"constant","lang":"typescript","code":"const date = new Date();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":93,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.coerce.string();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":101,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.coerce.number();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":110,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.coerce.boolean();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":126,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.coerce.bigint();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":133,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.coerce.date();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":134,"symbol":"date","kind":"constant","lang":"typescript","code":"const date = new Date();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":141,"symbol":"d1","kind":"constant","lang":"typescript","code":"const d1 = \"2021-01-01T00:00:00Z\";"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":142,"symbol":"d2","kind":"constant","lang":"typescript","code":"const d2 = \"2021-01-01T00:00:00.123Z\";"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":143,"symbol":"d3","kind":"constant","lang":"typescript","code":"const d3 = \"2021-01-01T00:00:00\";"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":144,"symbol":"d4","kind":"constant","lang":"typescript","code":"const d4 = \"2021-01-01T00:00:00+07:00\";"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":145,"symbol":"d5","kind":"constant","lang":"typescript","code":"const d5 = \"bad data\";"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":148,"symbol":"a","kind":"constant","lang":"typescript","doc":"local: false, offset: false, precision: null","code":"const a = z.iso.datetime();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":155,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.iso.datetime({ local: true });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":162,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.iso.datetime({ offset: true });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":169,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = z.iso.datetime({ precision: 3 });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":178,"symbol":"d1","kind":"constant","lang":"typescript","code":"const d1 = \"2021-01-01\";"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":179,"symbol":"d2","kind":"constant","lang":"typescript","code":"const d2 = \"bad data\";"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":181,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.iso.date();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":185,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.string().check(z.iso.date());"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":191,"symbol":"d1","kind":"constant","lang":"typescript","code":"const d1 = \"00:00:00\";"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":192,"symbol":"d2","kind":"constant","lang":"typescript","code":"const d2 = \"00:00:00.123\";"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":193,"symbol":"d3","kind":"constant","lang":"typescript","code":"const d3 = \"bad data\";"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":195,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.iso.time();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":200,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.iso.time({ precision: 3 });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":205,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.string().check(z.iso.time());"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":212,"symbol":"d1","kind":"constant","lang":"typescript","code":"const d1 = \"P3Y6M4DT12H30M5S\";"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":213,"symbol":"d2","kind":"constant","lang":"typescript","code":"const d2 = \"bad data\";"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":215,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.iso.duration();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":219,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.string().check(z.iso.duration());"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":225,"symbol":"field","kind":"constant","lang":"typescript","code":"const field = z.prefault(z.union([z.string(), z.undefined()]), () => undefined);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":226,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ a: field });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":235,"symbol":"transformed","kind":"constant","lang":"typescript","code":"const transformed = z.prefault(\n z.pipe(\n z.string(),\n z.transform(() => undefined)\n ),\n \"fallback\"\n );"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":247,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.undefined();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":253,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.null();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":259,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.any();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":272,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.unknown();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":285,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.never();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":290,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.void();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":296,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.array(z.string());"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":303,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.union([z.string(), z.number()]);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":311,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = schema.safeParse(\"anything\");"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":318,"symbol":"disc","kind":"constant","lang":"typescript","code":"const disc = z.discriminatedUnion(\"type\", [] as any);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":319,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = disc.safeParse({ type: \"x\" });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":334,"symbol":"viaPipe","kind":"constant","lang":"typescript","doc":"An option whose shape cannot be listed without resolving it is left to the lookup map, on the first object parsed.","code":"const viaPipe = z.discriminatedUnion(\"type\", [\n z.pipe(z.object({ value: z.literal(\"x\") }), z.object({ value: z.literal(\"x\") })),\n ]);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/index.test.ts","line":341,"symbol":"variantA","kind":"constant","lang":"typescript","code":"const variantA = z.object({\n kind: z.literal(\"a\"),\n get child() {\n return z.optional(tree);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/number.test.ts","line":5,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.number();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/number.test.ts","line":11,"symbol":"a","kind":"type","lang":"typescript","code":"type a = z.infer<typeof a>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/number.test.ts","line":16,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.number().check(z.refine(async (_) => _ > 0));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/number.test.ts","line":23,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.int();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/number.test.ts","line":31,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.float32();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/number.test.ts","line":41,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.float64();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/number.test.ts","line":50,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.int32();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/number.test.ts","line":60,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.uint32();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/number.test.ts","line":71,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.int64();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/number.test.ts","line":84,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.uint64();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":5,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.object({\n name: z.string(),\n age: z.number(),\n points: z.optional(z.number()),\n \"test?\": z.boolean(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":15,"symbol":"a","kind":"type","lang":"typescript","code":"type a = z.output<typeof a>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":33,"symbol":"schema","kind":"constant","lang":"typescript","doc":"null prototype","code":"const schema = z.object({ a: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":34,"symbol":"obj","kind":"constant","lang":"typescript","code":"const obj = Object.create(null);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":40,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.object({\n name: z.string(),\n age: z.number(),\n points: z.optional(z.number()),\n \"test?\": z.boolean(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":47,"symbol":"a","kind":"type","lang":"typescript","code":"type a = z.output<typeof a>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":55,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.strictObject({\n name: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":64,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.looseObject({\n name: z.string(),\n age: z.number(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":80,"symbol":"userSchema","kind":"constant","lang":"typescript","code":"const userSchema = z.object({\n name: z.string(),\n age: z.number(),\n email: z.optional(z.string()),\n});"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":88,"symbol":"userKeysSchema","kind":"constant","lang":"typescript","doc":"z.keyof returns an enum schema of the keys of an object schema","code":"const userKeysSchema = z.keyof(userSchema);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":89,"symbol":"UserKeys","kind":"type","lang":"typescript","code":"type UserKeys = z.infer<typeof userKeysSchema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":105,"symbol":"extendedSchema","kind":"constant","lang":"typescript","code":"const extendedSchema = z.extend(userSchema, {\n isAdmin: z.boolean(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":108,"symbol":"ExtendedUser","kind":"type","lang":"typescript","code":"type ExtendedUser = z.infer<typeof extendedSchema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":120,"symbol":"mergedSchema","kind":"constant","lang":"typescript","code":"const mergedSchema = z.merge(userSchema, z.object({ isAdmin: z.boolean() }));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":121,"symbol":"MergedUser","kind":"type","lang":"typescript","code":"type MergedUser = z.infer<typeof mergedSchema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":131,"symbol":"strict","kind":"constant","lang":"typescript","doc":"the second schema's catchall wins, matching classic","code":"const strict = z.merge(userSchema, z.strictObject({ isAdmin: z.boolean() }));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":141,"symbol":"extended","kind":"constant","lang":"typescript","code":"const extended = z.safeExtend(userSchema, { name: z.string() });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":143,"symbol":"Extended","kind":"type","lang":"typescript","code":"type Extended = z.infer<typeof extended>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":150,"symbol":"pickedSchema","kind":"constant","lang":"typescript","code":"const pickedSchema = z.pick(userSchema, { name: true, email: true });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":151,"symbol":"PickedUser","kind":"type","lang":"typescript","code":"type PickedUser = z.infer<typeof pickedSchema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":158,"symbol":"omittedSchema","kind":"constant","lang":"typescript","code":"const omittedSchema = z.omit(userSchema, { age: true });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":159,"symbol":"OmittedUser","kind":"type","lang":"typescript","code":"type OmittedUser = z.infer<typeof omittedSchema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":170,"symbol":"partialSchema","kind":"constant","lang":"typescript","code":"const partialSchema = z.partial(userSchema);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":171,"symbol":"PartialUser","kind":"type","lang":"typescript","code":"type PartialUser = z.infer<typeof partialSchema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":181,"symbol":"partialSchemaWithMask","kind":"constant","lang":"typescript","code":"const partialSchemaWithMask = z.partial(userSchema, { name: true });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":182,"symbol":"PartialUserWithMask","kind":"type","lang":"typescript","code":"type PartialUserWithMask = z.infer<typeof partialSchemaWithMask>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":193,"symbol":"partialSchema","kind":"constant","lang":"typescript","code":"const partialSchema = z.exactPartial(userSchema);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":194,"symbol":"PartialUser","kind":"type","lang":"typescript","code":"type PartialUser = z.infer<typeof partialSchema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":207,"symbol":"partialSchemaWithMask","kind":"constant","lang":"typescript","code":"const partialSchemaWithMask = z.exactPartial(userSchema, { name: true });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":208,"symbol":"PartialUserWithMask","kind":"type","lang":"typescript","code":"type PartialUserWithMask = z.infer<typeof partialSchemaWithMask>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":219,"symbol":"requiredSchema","kind":"constant","lang":"typescript","code":"const requiredSchema = z.required(userSchema);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":220,"symbol":"RequiredUser","kind":"type","lang":"typescript","code":"type RequiredUser = z.infer<typeof requiredSchema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":228,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({ name: z.optional(z.string()), age: z.optional(z.number()) });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":229,"symbol":"requiredSchemaWithMask","kind":"constant","lang":"typescript","code":"const requiredSchemaWithMask = z.required(schema, { name: true });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":230,"symbol":"RequiredWithMask","kind":"type","lang":"typescript","code":"type RequiredWithMask = z.infer<typeof requiredSchemaWithMask>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":237,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n name: z.string(),\n age: z.number(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":265,"symbol":"schema","kind":"constant","lang":"typescript","doc":"z.catchall()","code":"const schema = z.catchall(\n z.object({\n name: z.string(),\n // age: z.number(),\n }),\n z.string()\n );"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":273,"symbol":"schemaIn","kind":"type","lang":"typescript","code":"type schemaIn = z.input<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/object.test.ts","line":274,"symbol":"schemaOut","kind":"type","lang":"typescript","code":"type schemaOut = z.output<typeof schema>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/prototypes.test.ts","line":5,"symbol":"$ZodType","kind":"interface","lang":"typescript","code":"interface $ZodType {\n /** @deprecated */\n _core(): string;\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/prototypes.test.ts","line":17,"symbol":"result","kind":"constant","lang":"typescript","doc":"should pass","code":"const result = z.string()._core();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/prototypes.test.ts","line":26,"symbol":"ZodMiniType","kind":"interface","lang":"typescript","code":"interface ZodMiniType {\n /** @deprecated */\n _mini(): string;\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/prototypes.test.ts","line":38,"symbol":"result","kind":"constant","lang":"typescript","doc":"should pass","code":"const result = z.string()._mini();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":5,"symbol":"ObjectField","kind":"type","lang":"typescript","code":"type ObjectField = z.ZodMiniObject<{ [k: string]: ObjectField }>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":6,"symbol":"Field","kind":"type","lang":"typescript","code":"type Field = z.ZodMiniString<string> | z.ZodMiniObject<{ [k: string]: Field }>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":7,"symbol":"ObjectValue","kind":"type","lang":"typescript","code":"type ObjectValue = { [k: string]: ObjectValue };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":8,"symbol":"Value","kind":"type","lang":"typescript","code":"type Value = string | { [k: string]: Value };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":15,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema: Field = z.object({ nested: z.object({ name: z.string() }) });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":21,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = {\n name: \"I\",\n subcategories: [\n {\n name: \"A\",\n subcategories: [\n {\n name: \"1\",\n subcategories: [\n {\n name: \"a\",\n subcategories: [],\n },\n ],\n },\n ],\n },\n ],\n };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":41,"symbol":"Category","kind":"constant","lang":"typescript","code":"const Category = z.object({\n name: z.string(),\n get subcategories(): z.ZodMiniOptional<z.ZodMiniArray<typeof Category>> {\n return z.optional(z.array(Category));\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":43,"symbol":"subcategories","kind":"method","lang":"typescript","code":"get subcategories(): z.ZodMiniOptional<z.ZodMiniArray<typeof Category>> {\n return z.optional(z.array(Category));\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":49,"symbol":"Category","kind":"type","lang":"typescript","code":"type Category = z.infer<typeof Category>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":50,"symbol":"_Category","kind":"interface","lang":"typescript","code":"interface _Category {\n name: string;\n subcategories?: _Category[] | undefined;\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":58,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = {\n value: 1,\n next: {\n value: 2,\n next: {\n value: 3,\n next: {\n value: 4,\n next: null,\n },\n },\n },\n };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":72,"symbol":"LL","kind":"constant","lang":"typescript","code":"const LL = z.object({\n value: z.number(),\n get next(): z.ZodMiniNullable<typeof LL> {\n return z.nullable(LL);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":74,"symbol":"next","kind":"method","lang":"typescript","code":"get next(): z.ZodMiniNullable<typeof LL> {\n return z.nullable(LL);\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":80,"symbol":"LL","kind":"type","lang":"typescript","code":"type LL = z.infer<typeof LL>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":81,"symbol":"_LL","kind":"type","lang":"typescript","code":"type _LL = {\n value: number;\n next: _LL | null;\n };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":89,"symbol":"Alazy","kind":"constant","lang":"typescript","code":"const Alazy = z.object({\n val: z.number(),\n get b() {\n return z.optional(Blazy);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":91,"symbol":"b","kind":"method","lang":"typescript","code":"get b() {\n return z.optional(Blazy);\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":96,"symbol":"Blazy","kind":"constant","lang":"typescript","code":"const Blazy = z.object({\n val: z.number(),\n get a() {\n return z.optional(Alazy);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":98,"symbol":"a","kind":"method","lang":"typescript","code":"get a() {\n return z.optional(Alazy);\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":102,"symbol":"testData","kind":"constant","lang":"typescript","code":"const testData = {\n val: 1,\n b: {\n val: 5,\n a: {\n val: 3,\n b: {\n val: 4,\n a: {\n val: 2,\n b: {\n val: 1,\n },\n },\n },\n },\n },\n };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":124,"symbol":"Alazy","kind":"type","lang":"typescript","code":"type Alazy = z.infer<typeof Alazy>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":125,"symbol":"Blazy","kind":"type","lang":"typescript","code":"type Blazy = z.infer<typeof Blazy>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":126,"symbol":"_Alazy","kind":"interface","lang":"typescript","code":"interface _Alazy {\n val: number;\n b?: _Blazy | undefined;\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":130,"symbol":"_Blazy","kind":"interface","lang":"typescript","code":"interface _Blazy {\n val: number;\n a?: _Alazy | undefined;\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":141,"symbol":"Category","kind":"constant","lang":"typescript","code":"const Category = z.strictObject({\n name: z.string(),\n get subcategories() {\n return z.array(Category);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":143,"symbol":"subcategories","kind":"method","lang":"typescript","code":"get subcategories() {\n return z.array(Category);\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":148,"symbol":"Category","kind":"type","lang":"typescript","code":"type Category = z.infer<typeof Category>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":149,"symbol":"_Category","kind":"interface","lang":"typescript","code":"interface _Category {\n name: string;\n subcategories: _Category[];\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":155,"symbol":"PickedCategory","kind":"constant","lang":"typescript","code":"const PickedCategory = z.pick(Category, { name: true });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":156,"symbol":"OmittedCategory","kind":"constant","lang":"typescript","code":"const OmittedCategory = z.omit(Category, { subcategories: true });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":157,"symbol":"PickedCategory","kind":"type","lang":"typescript","code":"type PickedCategory = z.infer<typeof PickedCategory>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":158,"symbol":"OmittedCategory","kind":"type","lang":"typescript","code":"type OmittedCategory = z.infer<typeof OmittedCategory>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":159,"symbol":"_PickedCategory","kind":"interface","lang":"typescript","code":"interface _PickedCategory {\n name: string;\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":162,"symbol":"_OmittedCategory","kind":"interface","lang":"typescript","code":"interface _OmittedCategory {\n name: string;\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":168,"symbol":"picked","kind":"constant","lang":"typescript","code":"const picked = { name: \"test\" };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":169,"symbol":"omitted","kind":"constant","lang":"typescript","code":"const omitted = { name: \"test\" };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":179,"symbol":"Feature","kind":"constant","lang":"typescript","code":"const Feature = z.object({\n title: z.string(),\n get features(): z.ZodMiniOptional<z.ZodMiniArray<typeof Feature>> {\n return z.optional(z.array(Feature)); //.optional();\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":181,"symbol":"features","kind":"method","lang":"typescript","code":"get features(): z.ZodMiniOptional<z.ZodMiniArray<typeof Feature>> {\n return z.optional(z.array(Feature)); //.optional();\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":185,"symbol":"Feature","kind":"type","lang":"typescript","code":"type Feature = z.infer<typeof Feature>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":187,"symbol":"Output","kind":"constant","lang":"typescript","code":"const Output = z.object({\n id: z.int(), //.nonnegative(),\n name: z.string(),\n features: z.array(Feature), //.array(), // <—\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":193,"symbol":"Output","kind":"type","lang":"typescript","code":"type Output = z.output<typeof Output>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":195,"symbol":"_Feature","kind":"type","lang":"typescript","code":"type _Feature = {\n title: string;\n features?: _Feature[] | undefined;\n };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":200,"symbol":"_Output","kind":"type","lang":"typescript","code":"type _Output = {\n id: number;\n name: string;\n features: _Feature[];\n };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":212,"symbol":"A","kind":"constant","lang":"typescript","doc":"array","code":"const A = z.object({\n get subcategories() {\n return z.array(A);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":213,"symbol":"subcategories","kind":"method","lang":"typescript","code":"get subcategories() {\n return z.array(A);\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":218,"symbol":"B","kind":"constant","lang":"typescript","doc":"tuple","code":"const B = z.object({\n get subcategories() {\n return z.tuple([B, B]);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":219,"symbol":"subcategories","kind":"method","lang":"typescript","code":"get subcategories() {\n return z.tuple([B, B]);\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":224,"symbol":"C","kind":"constant","lang":"typescript","doc":"object","code":"const C = z.object({\n get subcategories() {\n return z.object({\n subcategories: C,\n });\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":225,"symbol":"subcategories","kind":"method","lang":"typescript","code":"get subcategories() {\n return z.object({\n subcategories: C,\n });\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":232,"symbol":"D","kind":"constant","lang":"typescript","doc":"union","code":"const D = z.object({\n get subcategories() {\n return z.union([D, z.string()]);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":233,"symbol":"subcategories","kind":"method","lang":"typescript","code":"get subcategories() {\n return z.union([D, z.string()]);\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":238,"symbol":"E","kind":"constant","lang":"typescript","doc":"intersection","code":"const E = z.object({\n get subcategories() {\n return z.intersection(E, E);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":239,"symbol":"subcategories","kind":"method","lang":"typescript","code":"get subcategories() {\n return z.intersection(E, E);\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":244,"symbol":"F","kind":"constant","lang":"typescript","doc":"record","code":"const F = z.object({\n get subcategories() {\n return z.record(z.string(), F);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":245,"symbol":"subcategories","kind":"method","lang":"typescript","code":"get subcategories() {\n return z.record(z.string(), F);\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":250,"symbol":"G","kind":"constant","lang":"typescript","doc":"map","code":"const G = z.object({\n get subcategories() {\n return z.map(z.string(), G);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":251,"symbol":"subcategories","kind":"method","lang":"typescript","code":"get subcategories() {\n return z.map(z.string(), G);\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":256,"symbol":"H","kind":"constant","lang":"typescript","doc":"set","code":"const H = z.object({\n get subcategories() {\n return z.set(H);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":257,"symbol":"subcategories","kind":"method","lang":"typescript","code":"get subcategories() {\n return z.set(H);\n }"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/recursive-types.test.ts","line":262,"symbol":"I","kind":"constant","lang":"typescript","doc":"optional","code":"const I = z.object({\n get subcategories() {\n return z.optional(I);\n },\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/standard-schema.test.ts","line":5,"symbol":"acceptSchema","kind":"function","lang":"typescript","code":"function acceptSchema(schema: StandardSchemaWithJSON) {\n return schema;\n}"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/standard-schema.test.ts","line":10,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/standard-schema.test.ts","line":13,"symbol":"_standard","kind":"constant","lang":"typescript","doc":"@ts-expect-error","code":"const _standard: StandardSchemaWithJSON[\"~standard\"] = schema;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/standard-schema.test.ts","line":20,"symbol":"schema","kind":"constant","lang":"typescript","code":"const schema = z.object({\n firstName: z.string(),\n lastName: z.string(),\n });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/standard-schema.test.ts","line":25,"symbol":"jsonSchema","kind":"constant","lang":"typescript","code":"const jsonSchema = z.toJSONSchema(schema);"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/standard-schema.test.ts","line":28,"symbol":"inputSchema","kind":"constant","lang":"typescript","doc":"Call ~standard.jsonSchema.input - this should not throw","code":"const inputSchema = jsonSchema[\"~standard\"].jsonSchema.input({ target: \"draft-07\" });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/standard-schema.test.ts","line":40,"symbol":"outputSchema","kind":"constant","lang":"typescript","doc":"Call ~standard.jsonSchema.output - this should not throw","code":"const outputSchema = jsonSchema[\"~standard\"].jsonSchema.output({ target: \"draft-07\" });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":4,"symbol":"FAIL","kind":"constant","lang":"typescript","code":"const FAIL = { success: false };"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":7,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":11,"symbol":"a","kind":"type","lang":"typescript","code":"type a = z.infer<typeof a>;"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":22,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string({ error: () => \"BAD\" });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":27,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.string().check(z.refine((val) => val.length));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":30,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.string().check(z.refine((val) => val.length));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":33,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.string().check(z.refine((val) => val.length));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":36,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = z.string().check(z.refine((val) => val.length));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":43,"symbol":"a","kind":"constant","lang":"typescript","doc":"async","code":"const a = z.string().check(z.refine(async (val) => val.length));"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":49,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.uuid();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":59,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.uuidv4();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":63,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.uuidv6();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":67,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = z.uuidv7();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":74,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.email();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":79,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.email(\"bad email\");"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":82,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.email({ error: \"bad email\" });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":85,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = z.email({ error: () => \"bad email\" });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":90,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.url();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":122,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.url({ hostname: /example\\.com$/ });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":132,"symbol":"a","kind":"constant","lang":"typescript","doc":"file URLs","code":"const a = z.url({ hostname: /.*/ });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":140,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.url({ protocol: /^https?$/ });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":149,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.url({ hostname: /example\\.com$/, protocol: /^https$/ });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":159,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.url({ hostname: /a+$/, protocol: /^ftp$/ });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":169,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.emoji();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":175,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.nanoid();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":181,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.nanoid({ length: 64 });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":182,"symbol":"id","kind":"constant","lang":"typescript","code":"const id = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_\";"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":188,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.cuid();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":194,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.cuid2();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":200,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.ulid();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":206,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.xid();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":212,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.ksuid();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":225,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.ipv4();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":239,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.ipv6();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":252,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.mac();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":265,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.mac({ delimiter: \":\" });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":271,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = z.mac({ delimiter: \"-\" });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":277,"symbol":"c","kind":"constant","lang":"typescript","code":"const c = z.mac({ delimiter: \":\" });"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":284,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.base64();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":315,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.e164();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":328,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.creditCard();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":342,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.iban();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":358,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.jwt();"} {"repo":"zod","file":"packages/zod/src/v4/mini/tests/string.test.ts","line":392,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = z.currencyCode();"} {"repo":"zod","file":"play.ts","line":3,"symbol":"formDate","kind":"constant","lang":"typescript","code":"const formDate = z.iso\n .datetime({ offset: true })\n .or(z.literal(\"\"))\n .transform((v) => (v === \"\" ? null : v));"} {"repo":"zod","file":"scripts/check-comments.ts","line":9,"symbol":"IGNORED_PREFIXES","kind":"constant","lang":"typescript","code":"const IGNORED_PREFIXES = [\"packages/treeshake/\", \"packages/docs/\", \"packages/docs-v3/\", \"packages/integration/\"];"} {"repo":"zod","file":"scripts/check-comments.ts","line":11,"symbol":"DIRECTIVE","kind":"constant","lang":"typescript","code":"const DIRECTIVE =\n /^(?:@ts-|@__|biome-ignore|eslint|prettier-ignore|oxlint|[cv]8 ignore|#(?:region|endregion)|\\/|<reference)/;"} {"repo":"zod","file":"scripts/check-comments.ts","line":15,"symbol":"LIST_ITEM","kind":"constant","lang":"typescript","doc":"A bullet or numbered item. Starts a fresh block, so a list survives but a wrapped item is still caught.","code":"const LIST_ITEM = /^(?:[-*•+]\\s|\\d+[.)]\\s)/;"} {"repo":"zod","file":"scripts/check-comments.ts","line":18,"symbol":"DECLARATION","kind":"constant","lang":"typescript","doc":"Declarations, spelled tightly enough that English keeps clear of them — `class instances collapse to …` is prose, `class Foo {` is not.","code":"const DECLARATION =\n /^(?:import\\s+(?:type\\s+)?(?:[{*]|\\w+\\s*[,{]|\\w+\\s+from\\b)|import\\s*[\"']|export\\s+(?:default|const|let|var|function|class|interface|type|enum|abstract|declare|async|[*{])|(?:const|let|var)\\s+[\\w${[][^=]*=|(?:function|class|interface|enum|namespace|module)\\s+\\w+\\s*[<({]|declare\\s+\\w)/;"} {"repo":"zod","file":"scripts/check-comments.ts","line":22,"symbol":"hasCodeStructure","kind":"function","lang":"typescript","doc":"Structure that never shows up in an English sentence. Not overridable by `looksLikeEnglish`.","code":"function hasCodeStructure(body: string): boolean {\n return (\n /[;{([<]$/.test(body) ||\n /^[)}\\]>?:|&.]/.test(body) ||\n /^[\"'[]/.test(body) ||\n /^[A-Z]\\w*\\s+extends\\s/.test(body) ||\n /^[\\w$.[\\]]+\\s*=[^=]/.test(body) ||\n DECLARATION.test(body)\n );\n}"} {"repo":"zod","file":"scripts/check-comments.ts","line":34,"symbol":"hasCodeHints","kind":"function","lang":"typescript","doc":"Weaker hints, all of which prose also uses. A body that reads as English wins over these.","code":"function hasCodeHints(body: string): boolean {\n return (\n /[,:]$/.test(body) ||\n /`/.test(body) ||\n /=>|&&|\\|\\||\\?\\?|===|!==|\\+\\+/.test(body) ||\n /^[\\w$.[\\]\"']+[<(]/.test(body) ||\n /^\\w+\\s*:\\s*[\\w$]+[.<([]/.test(body) ||\n /^(?:type|return|throw|await|async|if|else|for|while|do|switch|case|try|catch|finally|new|delete|yield|readonly|static|public|private|protected|abstract|class|interface|function|import|export|const|let|var|enum|namespace|declare)\\b/.test(\n body\n )\n );\n}"} {"repo":"zod","file":"scripts/check-comments.ts","line":47,"symbol":"looksLikeEnglish","kind":"function","lang":"typescript","code":"function looksLikeEnglish(body: string): boolean {\n const words = body.split(/\\s+/).filter(Boolean);\n if (words.length < 3) return false;\n const wordy = words.filter((w) => /^[A-Za-z][A-Za-z'-]*[.,;:!?)]?$/.test(w)).length;\n return wordy / words.length >= 0.6;\n}"} {"repo":"zod","file":"scripts/check-comments.ts","line":48,"symbol":"words","kind":"constant","lang":"typescript","code":"const words = body.split(/\\s+/).filter(Boolean);"} {"repo":"zod","file":"scripts/check-comments.ts","line":50,"symbol":"wordy","kind":"constant","lang":"typescript","code":"const wordy = words.filter((w) => /^[A-Za-z][A-Za-z'-]*[.,;:!?)]?$/.test(w)).length;"} {"repo":"zod","file":"scripts/check-comments.ts","line":54,"symbol":"isProse","kind":"function","lang":"typescript","code":"function isProse(body: string): boolean {\n if (hasCodeStructure(body)) return false;\n return looksLikeEnglish(body) || !hasCodeHints(body);\n}"} {"repo":"zod","file":"scripts/check-comments.ts","line":59,"symbol":"Block","kind":"interface","lang":"typescript","code":"interface Block {\n line: number;\n bodies: string[];\n}"} {"repo":"zod","file":"scripts/check-comments.ts","line":65,"symbol":"ownLineComments","kind":"function","lang":"typescript","doc":"Line-owning `//` comments, keyed by zero-based line number. Trailing `// note` after code never stacks.","code":"function ownLineComments(fileName: string, text: string, lines: string[]): Map<number, string> {\n const sf = ts.createSourceFile(fileName, text, ts.ScriptTarget.Latest, /* setParentNodes */ false);\n\n // Every comment is leading or trailing trivia of some token, so walking the tree finds them all — and the parser has already told strings, templates and regexes apart from real comments for us.\n const starts = new Set<number>();\n const collect = (ranges: ts.CommentRange[] | undefined) => {\n for (const r of ranges ?? []) {\n if (r.kind === ts.SyntaxKind.SingleLineCommentTrivia) starts.add(r.pos);\n }\n };\n const visit = (node: ts.Node) => {\n collect(ts.getLeadingCommentRanges(text, node.pos));\n collect(ts.getTrailingCommentRanges(text, node.end));\n node.forEachChild(visit);\n };\n visit(sf);\n collect(ts.getLeadingCommentRanges(text, sf.endOfFileToken.pos));\n\n const owned = new Map<number, string>();\n for (const pos of starts) {\n const { line, character } = sf.getLineAndCharacterOfPosition(pos);\n if (lines[line].slice(0, character).trim() !== \"\") continue;\n owned.set(line, lines[line].trim().slice(2).trim());\n }\n return owned;\n}"} {"repo":"zod","file":"scripts/check-comments.ts","line":66,"symbol":"sf","kind":"constant","lang":"typescript","code":"const sf = ts.createSourceFile(fileName, text, ts.ScriptTarget.Latest, /* setParentNodes */ false);"} {"repo":"zod","file":"scripts/check-comments.ts","line":69,"symbol":"starts","kind":"constant","lang":"typescript","doc":"Every comment is leading or trailing trivia of some token, so walking the tree finds them all — and the parser has already told strings, templates and regexes apart from real comments for us.","code":"const starts = new Set<number>();"} {"repo":"zod","file":"scripts/check-comments.ts","line":70,"symbol":"collect","kind":"constant","lang":"typescript","code":"const collect = (ranges: ts.CommentRange[] | undefined) => {\n for (const r of ranges ?? []) {\n if (r.kind === ts.SyntaxKind.SingleLineCommentTrivia) starts.add(r.pos);\n }\n };"} {"repo":"zod","file":"scripts/check-comments.ts","line":75,"symbol":"visit","kind":"constant","lang":"typescript","code":"const visit = (node: ts.Node) => {\n collect(ts.getLeadingCommentRanges(text, node.pos));\n collect(ts.getTrailingCommentRanges(text, node.end));\n node.forEachChild(visit);\n };"} {"repo":"zod","file":"scripts/check-comments.ts","line":83,"symbol":"owned","kind":"constant","lang":"typescript","code":"const owned = new Map<number, string>();"} {"repo":"zod","file":"scripts/check-comments.ts","line":92,"symbol":"proseBlocks","kind":"function","lang":"typescript","code":"function proseBlocks(fileName: string, text: string, lines: string[]): Block[] {\n const owned = ownLineComments(fileName, text, lines);\n const blocks: Block[] = [];\n\n for (const line of [...owned.keys()].sort((a, b) => a - b)) {\n const body = owned.get(line)!;\n // A bare `//` is a paragraph break, and a directive belongs to whatever it annotates. Both end the block rather than joining it.\n if (body === \"\" || DIRECTIVE.test(body)) continue;\n const last = blocks.at(-1);\n if (last && last.line + last.bodies.length === line && !LIST_ITEM.test(body)) last.bodies.push(body);\n else blocks.push({ line, bodies: [body] });\n }\n\n return blocks.filter((b) => b.bodies.length > 1 && b.bodies.every(isProse));\n}"} {"repo":"zod","file":"scripts/check-comments.ts","line":93,"symbol":"owned","kind":"constant","lang":"typescript","code":"const owned = ownLineComments(fileName, text, lines);"} {"repo":"zod","file":"scripts/check-comments.ts","line":94,"symbol":"blocks","kind":"constant","lang":"typescript","code":"const blocks: Block[] = [];"} {"repo":"zod","file":"scripts/check-comments.ts","line":97,"symbol":"body","kind":"constant","lang":"typescript","code":"const body = owned.get(line)!;"} {"repo":"zod","file":"scripts/check-comments.ts","line":100,"symbol":"last","kind":"constant","lang":"typescript","code":"const last = blocks.at(-1);"} {"repo":"zod","file":"scripts/check-comments.ts","line":108,"symbol":"trackedFiles","kind":"function","lang":"typescript","code":"function trackedFiles(): string[] {\n const paths = execFileSync(\"git\", [\"ls-files\", \"-z\", \"*.ts\", \"*.mts\", \"*.cts\"], { encoding: \"utf8\" }).split(\"\\0\");\n // Dedupe: `git ls-files` repeats an unmerged path once per conflict stage, which would triple-count a file mid-rebase.\n return [...new Set(paths)].filter(\n (f) => f && !/\\.d\\.[cm]?ts$/.test(f) && !IGNORED_PREFIXES.some((p) => f.startsWith(p))\n );\n}"} {"repo":"zod","file":"scripts/check-comments.ts","line":109,"symbol":"paths","kind":"constant","lang":"typescript","code":"const paths = execFileSync(\"git\", [\"ls-files\", \"-z\", \"*.ts\", \"*.mts\", \"*.cts\"], { encoding: \"utf8\" }).split(\"\\0\");"} {"repo":"zod","file":"scripts/check-comments.ts","line":116,"symbol":"fix","kind":"constant","lang":"typescript","code":"const fix = process.argv.includes(\"--fix\");"} {"repo":"zod","file":"scripts/check-comments.ts","line":121,"symbol":"text","kind":"constant","lang":"typescript","code":"const text = readFileSync(file, \"utf8\");"} {"repo":"zod","file":"scripts/check-comments.ts","line":122,"symbol":"lines","kind":"constant","lang":"typescript","code":"const lines = text.split(\"\\n\");"} {"repo":"zod","file":"scripts/check-comments.ts","line":123,"symbol":"blocks","kind":"constant","lang":"typescript","code":"const blocks = proseBlocks(file, text, lines);"} {"repo":"zod","file":"scripts/check-comments.ts","line":129,"symbol":"indent","kind":"constant","lang":"typescript","code":"const indent = lines[block.line].match(/^[ \\t]*/)![0];"} {"repo":"zod","file":"scripts/check-lockstep.ts","line":4,"symbol":"FLOOR","kind":"constant","lang":"typescript","doc":"every zod release from 4.5.0 on must have an @zod/mini twin on npm and on JSR, and every @zod/mini 4.x must have a zod twin; latest must agree. `--wait` retries for up to ~6 minutes, since the npm packument endpoint is CDN-cached for five","code":"const FLOOR = \"4.5.0\";"} {"repo":"zod","file":"scripts/check-lockstep.ts","line":5,"symbol":"attempts","kind":"constant","lang":"typescript","code":"const attempts = process.argv.includes(\"--wait\") ? 13 : 1;"} {"repo":"zod","file":"scripts/check-lockstep.ts","line":7,"symbol":"Releases","kind":"type","lang":"typescript","code":"type Releases = { name: string; versions: string[]; latest: string };"} {"repo":"zod","file":"scripts/check-lockstep.ts","line":9,"symbol":"stable","kind":"function","lang":"typescript","code":"function stable(versions: string[]): string[] {\n return versions.filter((v) => semver.valid(v) && !semver.prerelease(v) && semver.gte(v, FLOOR));\n}"} {"repo":"zod","file":"scripts/check-lockstep.ts","line":13,"symbol":"npmReleases","kind":"function","lang":"typescript","code":"async function npmReleases(name: string): Promise<Releases> {\n const res = await fetch(`https://registry.npmjs.org/${name.replace(\"/\", \"%2f\")}`, {\n headers: { accept: \"application/vnd.npm.install-v1+json\" },\n });\n if (!res.ok) throw new Error(`npm registry ${res.status} for ${name}`);\n const body = (await res.json()) as { versions: Record<string, unknown>; \"dist-tags\": Record<string, string> };\n return { name, versions: stable(Object.keys(body.versions)), latest: body[\"dist-tags\"].latest };\n}"} {"repo":"zod","file":"scripts/check-lockstep.ts","line":14,"symbol":"res","kind":"constant","lang":"typescript","code":"const res = await fetch(`https://registry.npmjs.org/${name.replace(\"/\", \"%2f\")}`, {\n headers: { accept: \"application/vnd.npm.install-v1+json\" },\n });"} {"repo":"zod","file":"scripts/check-lockstep.ts","line":18,"symbol":"body","kind":"constant","lang":"typescript","code":"const body = (await res.json()) as { versions: Record<string, unknown>; \"dist-tags\": Record<string, string> };"} {"repo":"zod","file":"scripts/check-lockstep.ts","line":23,"symbol":"jsrReleases","kind":"function","lang":"typescript","doc":"a 404 means the package has no versions on JSR yet","code":"async function jsrReleases(name: string): Promise<Releases> {\n const res = await fetch(`https://jsr.io/${name}/meta.json`);\n if (res.status === 404) return { name: `jsr:${name}`, versions: [], latest: \"\" };\n if (!res.ok) throw new Error(`jsr ${res.status} for ${name}`);\n const body = (await res.json()) as { versions: Record<string, unknown>; latest: string };\n return { name: `jsr:${name}`, versions: stable(Object.keys(body.versions)), latest: body.latest };\n}"} {"repo":"zod","file":"scripts/check-lockstep.ts","line":24,"symbol":"res","kind":"constant","lang":"typescript","code":"const res = await fetch(`https://jsr.io/${name}/meta.json`);"} {"repo":"zod","file":"scripts/check-lockstep.ts","line":27,"symbol":"body","kind":"constant","lang":"typescript","code":"const body = (await res.json()) as { versions: Record<string, unknown>; latest: string };"} {"repo":"zod","file":"scripts/check-lockstep.ts","line":31,"symbol":"twins","kind":"function","lang":"typescript","code":"function twins(a: Releases, b: Releases): string[] {\n const out: string[] = [];\n const missing = a.versions.filter((v) => !b.versions.includes(v)).sort(semver.compare);\n const stray = b.versions.filter((v) => !a.versions.includes(v)).sort(semver.compare);\n if (missing.length) out.push(`${a.name} versions with no ${b.name} twin: ${missing.join(\", \")}`);\n if (stray.length) out.push(`${b.name} versions with no ${a.name} twin: ${stray.join(\", \")}`);\n if (a.latest !== b.latest) out.push(`latest differs: ${a.name}@${a.latest} vs ${b.name}@${b.latest}`);\n return out;\n}"} {"repo":"zod","file":"scripts/check-lockstep.ts","line":32,"symbol":"out","kind":"constant","lang":"typescript","code":"const out: string[] = [];"} {"repo":"zod","file":"scripts/check-lockstep.ts","line":33,"symbol":"missing","kind":"constant","lang":"typescript","code":"const missing = a.versions.filter((v) => !b.versions.includes(v)).sort(semver.compare);"} {"repo":"zod","file":"scripts/check-lockstep.ts","line":34,"symbol":"stray","kind":"constant","lang":"typescript","code":"const stray = b.versions.filter((v) => !a.versions.includes(v)).sort(semver.compare);"} {"repo":"zod","file":"scripts/check-lockstep.ts","line":41,"symbol":"problems","kind":"function","lang":"typescript","code":"async function problems(): Promise<string[]> {\n const [zod, mini, jsrZod, jsrMini] = await Promise.all([\n npmReleases(\"zod\"),\n npmReleases(\"@zod/mini\"),\n jsrReleases(\"@zod/zod\"),\n jsrReleases(\"@zod/mini\"),\n ]);\n const out = [...twins(zod, mini), ...twins(jsrZod, jsrMini)];\n // npm is the source of truth and JSR follows it; a gap here is reported, not fatal, because that publish is recovered by hand and must not hold a release red\n for (const gap of twins(zod, jsrZod)) console.warn(`⚠️ ${gap}`);\n if (!out.length) {\n console.log(\n `✅ zod and @zod/mini are in lockstep on npm and JSR (${zod.versions.length} versions since ${FLOOR}, latest ${zod.latest})`\n );\n }\n return out;\n}"} {"repo":"zod","file":"scripts/check-lockstep.ts","line":48,"symbol":"out","kind":"constant","lang":"typescript","code":"const out = [...twins(zod, mini), ...twins(jsrZod, jsrMini)];"} {"repo":"zod","file":"scripts/check-semver.ts","line":6,"symbol":"__dirname","kind":"constant","lang":"typescript","code":"const __dirname = fileURLToPath(new URL(\".\", import.meta.url));"} {"repo":"zod","file":"scripts/check-semver.ts","line":7,"symbol":"packageJsonPath","kind":"constant","lang":"typescript","code":"const packageJsonPath = join(__dirname, \"../packages/zod/package.json\");"} {"repo":"zod","file":"scripts/check-semver.ts","line":10,"symbol":"packageJson","kind":"constant","lang":"typescript","code":"const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\"));"} {"repo":"zod","file":"scripts/check-semver.ts","line":11,"symbol":"version","kind":"constant","lang":"typescript","code":"const version = packageJson.version;"} {"repo":"zod","file":"scripts/check-semver.ts","line":22,"symbol":"semverRegex","kind":"constant","lang":"typescript","doc":"check x.y.z format with regex","code":"const semverRegex = /^\\d+\\.\\d+\\.\\d+$/;"} {"repo":"zod","file":"scripts/check-versions.ts","line":6,"symbol":"__dirname","kind":"constant","lang":"typescript","code":"const __dirname = fileURLToPath(new URL(\".\", import.meta.url));"} {"repo":"zod","file":"scripts/check-versions.ts","line":9,"symbol":"zodPackagePath","kind":"constant","lang":"typescript","doc":"Get zod package path","code":"const zodPackagePath = join(__dirname, \"..\", \"packages\", \"zod\");"} {"repo":"zod","file":"scripts/check-versions.ts","line":12,"symbol":"packageJsonPath","kind":"constant","lang":"typescript","doc":"Read package.json version","code":"const packageJsonPath = join(zodPackagePath, \"package.json\");"} {"repo":"zod","file":"scripts/check-versions.ts","line":13,"symbol":"packageJson","kind":"constant","lang":"typescript","code":"const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf8\"));"} {"repo":"zod","file":"scripts/check-versions.ts","line":14,"symbol":"packageJsonVersion","kind":"constant","lang":"typescript","code":"const packageJsonVersion = packageJson.version as string;"} {"repo":"zod","file":"scripts/check-versions.ts","line":20,"symbol":"jsrJsonPath","kind":"constant","lang":"typescript","doc":"Read jsr.json version","code":"const jsrJsonPath = join(zodPackagePath, \"jsr.json\");"} {"repo":"zod","file":"scripts/check-versions.ts","line":21,"symbol":"jsrJson","kind":"constant","lang":"typescript","code":"const jsrJson = JSON.parse(readFileSync(jsrJsonPath, \"utf8\"));"} {"repo":"zod","file":"scripts/check-versions.ts","line":22,"symbol":"jsrJsonVersion","kind":"constant","lang":"typescript","code":"const jsrJsonVersion = jsrJson.version as string;"} {"repo":"zod","file":"scripts/check-versions.ts","line":28,"symbol":"tag","kind":"constant","lang":"typescript","doc":"read tag","code":"const tag = process.env.npm_config_tag || \"latest\";"} {"repo":"zod","file":"scripts/check-versions.ts","line":31,"symbol":"xyz","kind":"constant","lang":"typescript","doc":"e.g. \"beta\"","code":"const xyz = /^\\d+\\.\\d+\\.\\d+$/;"} {"repo":"zod","file":"scripts/check-versions.ts","line":41,"symbol":"versionsVersion","kind":"constant","lang":"typescript","doc":"Get version from versions.ts","code":"const versionsVersion = `${version.major}.${version.minor}.${version.patch}`;"} {"repo":"zod","file":"scripts/check-versions.ts","line":44,"symbol":"isPackageJsonValid","kind":"constant","lang":"typescript","doc":"Compare versions","code":"const isPackageJsonValid =\n tag === \"latest\" ? packageJsonVersion === versionsVersion : packageJsonVersion.startsWith(versionsVersion);"} {"repo":"zod","file":"scripts/check-versions.ts","line":46,"symbol":"isJsrJsonValid","kind":"constant","lang":"typescript","code":"const isJsrJsonValid =\n tag === \"latest\" ? jsrJsonVersion === versionsVersion : jsrJsonVersion.startsWith(versionsVersion);"} {"repo":"zod","file":"scripts/check-versions.ts","line":72,"symbol":"miniPackageJson","kind":"constant","lang":"typescript","code":"const miniPackageJson = JSON.parse(readFileSync(join(__dirname, \"..\", \"packages\", \"mini\", \"package.json\"), \"utf8\"));"} {"repo":"zod","file":"scripts/check-versions.ts","line":73,"symbol":"miniJsrJson","kind":"constant","lang":"typescript","code":"const miniJsrJson = JSON.parse(readFileSync(join(__dirname, \"..\", \"packages\", \"mini\", \"jsr.json\"), \"utf8\"));"} {"repo":"zod","file":"scripts/check-versions.ts","line":74,"symbol":"miniVersion","kind":"constant","lang":"typescript","code":"const miniVersion = miniPackageJson.version as string;"} {"repo":"zod","file":"scripts/check-versions.ts","line":75,"symbol":"miniJsrVersion","kind":"constant","lang":"typescript","code":"const miniJsrVersion = miniJsrJson.version as string;"} {"repo":"zod","file":"scripts/check-versions.ts","line":76,"symbol":"miniPeer","kind":"constant","lang":"typescript","code":"const miniPeer = miniPackageJson.peerDependencies?.zod as string | undefined;"} {"repo":"zod","file":"scripts/check-versions.ts","line":77,"symbol":"miniJsrImport","kind":"constant","lang":"typescript","code":"const miniJsrImport = miniJsrJson.imports?.[\"zod/mini\"] as string | undefined;"} {"repo":"zod","file":"scripts/check-versions.ts","line":78,"symbol":"expectedMiniPeer","kind":"constant","lang":"typescript","code":"const expectedMiniPeer = `^${version.major}.${version.minor}.0`;"} {"repo":"zod","file":"scripts/check-versions.ts","line":79,"symbol":"expectedMiniJsrImport","kind":"constant","lang":"typescript","code":"const expectedMiniJsrImport = `jsr:@zod/zod@${expectedMiniPeer}/mini`;"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":13,"symbol":"rnd","kind":"constant","lang":"typescript","code":"const rnd = () => {\n seed = (seed * 1664525 + 1013904223) >>> 0;\n return seed / 0x100000000;\n};"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":17,"symbol":"pick","kind":"constant","lang":"typescript","code":"const pick = <T>(xs: T[]): T => xs[Math.floor(rnd() * xs.length)]!;"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":18,"symbol":"chance","kind":"constant","lang":"typescript","code":"const chance = (p: number) => rnd() < p;"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":20,"symbol":"Built","kind":"type","lang":"typescript","code":"type Built = { schema: z.ZodType; gen: () => unknown };"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":22,"symbol":"leaves","kind":"constant","lang":"typescript","code":"const leaves: (() => Built)[] = [\n () => ({ schema: z.string(), gen: () => pick([\"\", \"abc\", \"hello world\", \" pad \"]) }),\n () => ({ schema: z.string().min(2).max(8), gen: () => pick([\"a\", \"abc\", \"abcdefghij\"]) }),\n () => ({ schema: z.string().trim(), gen: () => pick([\" x \", \"y\"]) }),\n () => ({ schema: z.email(), gen: () => pick([\"a@b.com\", \"nope\"]) }),\n () => ({ schema: z.uuid(), gen: () => pick([\"550e8400-e29b-41d4-a716-446655440000\", \"no\"]) }),\n () => ({ schema: z.creditCard(), gen: () => pick([\"4111111111111111\", \"4111111111111112\"]) }),\n () => ({ schema: z.iban(), gen: () => pick([\"DE89370400440532013000\", \"DE89370400440532013001\"]) }),\n () => ({ schema: z.number(), gen: () => pick([0, -1, 3.5, Number.NaN, Number.POSITIVE_INFINITY]) }),\n () => ({ schema: z.number().int().min(0).max(10), gen: () => pick([0, 5, 11, -1, 2.5]) }),\n () => ({ schema: z.boolean(), gen: () => pick([true, false, \"true\"]) }),\n () => ({ schema: z.bigint(), gen: () => pick([1n, 0n, 1]) }),\n () => ({ schema: z.date(), gen: () => pick([new Date(0), new Date(\"nope\")]) }),\n () => ({ schema: z.literal(\"lit\"), gen: () => pick([\"lit\", \"other\"]) }),\n () => ({ schema: z.enum([\"a\", \"b\"]), gen: () =>"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":80,"symbol":"build","kind":"function","lang":"typescript","code":"function build(depth: number): Built {\n if (depth <= 0 || chance(0.35)) return pick(leaves)();\n\n const kind = pick([\n \"object\",\n \"strictObject\",\n \"looseObject\",\n \"array\",\n \"tuple\",\n \"union\",\n \"du\",\n \"record\",\n \"optional\",\n \"nullable\",\n \"default\",\n \"prefault\",\n \"catch\",\n \"readonly\",\n \"refine\",\n \"transform\",\n \"pipe\",\n \"intersection\",\n \"nonoptional\",\n ]);\n\n const inner = () => build(depth - 1);\n\n switch (kind) {\n case \"object\":\n case \"strictObject\":\n case \"looseObject\": {\n const n = 1 + Math.floor(rnd() * 3);\n const parts: [string, Built][] = [];\n for (let i = 0; i < n; i++) parts.push([`k${i}`, inner()]);\n const shape = Object.fromEntries(parts.map(([k, b]) => [k, b.schema]));\n const make = kind === \"object\" ? z.object : kind === \"strictObject\" ? z.strictObject : z.looseObject;\n return {\n schema: (make as any)(shape),\n gen: () => {\n const o: any = {};\n for (const [k, b] of parts) if (chance(0.85)) o[k] = b.gen();\n if (chance(0.25)) o.extra = \"unknown\";\n return o;\n },\n };\n }\n case \"array\": {\n const el = inner();\n "} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":83,"symbol":"kind","kind":"constant","lang":"typescript","code":"const kind = pick([\n \"object\",\n \"strictObject\",\n \"looseObject\",\n \"array\",\n \"tuple\",\n \"union\",\n \"du\",\n \"record\",\n \"optional\",\n \"nullable\",\n \"default\",\n \"prefault\",\n \"catch\",\n \"readonly\",\n \"refine\",\n \"transform\",\n \"pipe\",\n \"intersection\",\n \"nonoptional\",\n ]);"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":105,"symbol":"inner","kind":"constant","lang":"typescript","code":"const inner = () => build(depth - 1);"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":111,"symbol":"n","kind":"constant","lang":"typescript","code":"const n = 1 + Math.floor(rnd() * 3);"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":112,"symbol":"parts","kind":"constant","lang":"typescript","code":"const parts: [string, Built][] = [];"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":114,"symbol":"shape","kind":"constant","lang":"typescript","code":"const shape = Object.fromEntries(parts.map(([k, b]) => [k, b.schema]));"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":115,"symbol":"make","kind":"constant","lang":"typescript","code":"const make = kind === \"object\" ? z.object : kind === \"strictObject\" ? z.strictObject : z.looseObject;"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":119,"symbol":"o","kind":"constant","lang":"typescript","code":"const o: any = {};"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":127,"symbol":"el","kind":"constant","lang":"typescript","code":"const el = inner();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":131,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = inner();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":132,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = inner();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":136,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = inner();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":137,"symbol":"b","kind":"constant","lang":"typescript","code":"const b = inner();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":141,"symbol":"a","kind":"constant","lang":"typescript","code":"const a = inner();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":151,"symbol":"v","kind":"constant","lang":"typescript","code":"const v = inner();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":152,"symbol":"key","kind":"constant","lang":"typescript","code":"const key = pick([z.string(), z.email(), z.string().min(2)]) as z.ZodType;"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":156,"symbol":"o","kind":"constant","lang":"typescript","code":"const o: any = {};"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":169,"symbol":"i","kind":"constant","lang":"typescript","code":"const i = inner();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":173,"symbol":"i","kind":"constant","lang":"typescript","code":"const i = inner();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":177,"symbol":"i","kind":"constant","lang":"typescript","code":"const i = inner();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":181,"symbol":"i","kind":"constant","lang":"typescript","code":"const i = inner();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":182,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = i.gen();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":186,"symbol":"i","kind":"constant","lang":"typescript","code":"const i = inner();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":187,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = i.gen();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":191,"symbol":"i","kind":"constant","lang":"typescript","code":"const i = inner();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":192,"symbol":"d","kind":"constant","lang":"typescript","code":"const d = i.gen();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":196,"symbol":"i","kind":"constant","lang":"typescript","code":"const i = inner();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":200,"symbol":"i","kind":"constant","lang":"typescript","code":"const i = inner();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":205,"symbol":"i","kind":"constant","lang":"typescript","code":"const i = inner();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":209,"symbol":"i","kind":"constant","lang":"typescript","code":"const i = inner();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":217,"symbol":"same","kind":"function","lang":"typescript","doc":"Structural equality that is strict about the things parity actually turns on: key order, absent vs undefined-valued keys, NaN, -0, frozenness.","code":"function same(a: unknown, b: unknown, path = \"$\"): string | null {\n if (Object.is(a, b)) return null;\n if (typeof a !== typeof b) return `${path}: type ${typeof a} vs ${typeof b}`;\n if (a === null || b === null || typeof a !== \"object\") return `${path}: ${String(a)} vs ${String(b)}`;\n if (Array.isArray(a) !== Array.isArray(b)) return `${path}: array-ness differs`;\n if (a instanceof Date && b instanceof Date) return Object.is(a.getTime(), b.getTime()) ? null : `${path}: date`;\n // Set and Map hold their entries in internal slots, so the ownKeys walk below sees `[]` for both and reports every pair equal. The grammar generates both, so without these arms that coverage is imaginary.\n if (a instanceof Set || b instanceof Set) {\n if (!(a instanceof Set) || !(b instanceof Set)) return `${path}: only one is a Set`;\n if (a.size !== b.size) return `${path}: Set size ${a.size} vs ${b.size}`;\n const bv = [...b];\n const av = [...a];\n for (let i = 0; i < av.length; i++) {\n const r = same(av[i], bv[i], `${path}.«set»[${i}]`);\n if (r) return r;\n }\n return null;\n }\n if (a instanceof Map || b instanceof Map) {\n if (!(a instanceof Map) || !(b instanceof Map)"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":227,"symbol":"bv","kind":"constant","lang":"typescript","code":"const bv = [...b];"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":228,"symbol":"av","kind":"constant","lang":"typescript","code":"const av = [...a];"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":230,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = same(av[i], bv[i], `${path}.«set»[${i}]`);"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":238,"symbol":"ae","kind":"constant","lang":"typescript","code":"const ae = [...a.entries()];"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":239,"symbol":"be","kind":"constant","lang":"typescript","code":"const be = [...b.entries()];"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":241,"symbol":"k","kind":"constant","lang":"typescript","code":"const k = same(ae[i]![0], be[i]![0], `${path}.«mapkey»[${i}]`);"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":243,"symbol":"v","kind":"constant","lang":"typescript","code":"const v = same(ae[i]![1], be[i]![1], `${path}.«map»[${i}]`);"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":249,"symbol":"ka","kind":"constant","lang":"typescript","code":"const ka = Reflect.ownKeys(a as object);"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":250,"symbol":"kb","kind":"constant","lang":"typescript","code":"const kb = Reflect.ownKeys(b as object);"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":254,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = same((a as any)[ka[i]!], (b as any)[kb[i]!], `${path}.${String(ka[i])}`);"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":260,"symbol":"describe","kind":"function","lang":"typescript","code":"function describe(s: any, d = 0): string {\n if (d > 6 || !s?._zod?.def) return \"?\";\n const def = s._zod.def;\n const t = def.type;\n if (def.shape)\n return `${t}{${Object.entries(def.shape)\n .map(([k, v]) => `${k}:${describe(v, d + 1)}`)\n .join(\",\")}}`;\n if (def.element) return `${t}<${describe(def.element, d + 1)}>`;\n if (def.items) return `${t}[${def.items.map((i: any) => describe(i, d + 1)).join(\",\")}]`;\n if (def.options) return `${t}(${def.options.map((o: any) => describe(o, d + 1)).join(\"|\")})`;\n if (def.keyType) return `${t}<${describe(def.keyType, d + 1)},${describe(def.valueType, d + 1)}>`;\n if (def.left) return `${t}(${describe(def.left, d + 1)}&${describe(def.right, d + 1)})`;\n if (def.in) return `${t}(${describe(def.in, d + 1)}->${describe(def.out, d + 1)})`;\n if (def.innerType) return `${t}(${describe(def.innerType, d + 1)})`;\n const checks = (def.checks ?? []).map((c: any) => c._zod?.def?.check ?? \"?\").join(\"+\");\n return checks ? `${t}[${checks}]` : t;\n}"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":262,"symbol":"def","kind":"constant","lang":"typescript","code":"const def = s._zod.def;"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":263,"symbol":"t","kind":"constant","lang":"typescript","code":"const t = def.type;"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":275,"symbol":"checks","kind":"constant","lang":"typescript","code":"const checks = (def.checks ?? []).map((c: any) => c._zod?.def?.check ?? \"?\").join(\"+\");"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":280,"symbol":"ser","kind":"function","lang":"typescript","doc":"JSON.stringify throws on BigInt and drops Symbols, Maps and Sets — none of which the grammar can avoid generating.","code":"function ser(v: unknown): string {\n return JSON.stringify(v, (_k, val) => {\n if (typeof val === \"bigint\") return `«bigint:${val}»`;\n if (typeof val === \"symbol\") return `«symbol:${String(val)}»`;\n if (val instanceof Map) return { \"«map»\": [...val.entries()] };\n if (val instanceof Set) return { \"«set»\": [...val.values()] };\n if (typeof val === \"number\" && Number.isNaN(val)) return \"«NaN»\";\n return val;\n });\n}"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":291,"symbol":"ROUNDS","kind":"constant","lang":"typescript","code":"const ROUNDS = Number(process.env.ROUNDS ?? 4000);"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":295,"symbol":"failures","kind":"constant","lang":"typescript","code":"const failures: string[] = [];"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":298,"symbol":"startSeed","kind":"constant","lang":"typescript","code":"const startSeed = seed;"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":299,"symbol":"built","kind":"constant","lang":"typescript","code":"const built = build(Number(process.env.DEPTH ?? 3));"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":316,"symbol":"marker","kind":"constant","lang":"typescript","code":"const marker = Symbol(\"sentinel\");"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":327,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = built.gen();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":352,"symbol":"input","kind":"constant","lang":"typescript","code":"const input = built.gen();"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":373,"symbol":"opts","kind":"constant","lang":"typescript","code":"const opts = (built.schema._zod.def as any).options as any[] | undefined;"} {"repo":"zod","file":"scripts/compile-fuzz.ts","line":377,"symbol":"rt","kind":"constant","lang":"typescript","code":"const rt = o.safeParse(input);"} {"repo":"zod","file":"scripts/enable-compile.ts","line":8,"symbol":"CompileStats","kind":"interface","lang":"typescript","code":"interface CompileStats {\n attempts: number;\n successes: number;\n fallbacks: number;\n}"} {"repo":"zod","file":"scripts/enable-compile.ts","line":14,"symbol":"stats","kind":"constant","lang":"typescript","code":"const stats: CompileStats = { attempts: 0, successes: 0, fallbacks: 0 };"} {"repo":"zod","file":"scripts/enable-compile.ts","line":17,"symbol":"installed","kind":"constant","lang":"typescript","code":"const installed = core.globalConfig.postProcessor;"} {"repo":"zod","file":"scripts/enable-compile.ts","line":20,"symbol":"before","kind":"constant","lang":"typescript","code":"const before = inst._zod?.run;"} {"repo":"zod","file":"scripts/enable-compile.ts","line":22,"symbol":"after","kind":"constant","lang":"typescript","code":"const after = inst._zod?.run;"} {"repo":"zod","file":"scripts/enable-compile.ts","line":25,"symbol":"shim","kind":"constant","lang":"typescript","code":"const shim = after;"} {"repo":"zod","file":"scripts/enable-compile.ts","line":34,"symbol":"result","kind":"constant","lang":"typescript","code":"const result = shim(payload, ctx);"} {"repo":"zod","file":"scripts/fail-on-console.ts","line":3,"symbol":"original","kind":"constant","lang":"typescript","code":"const original = { ...console } as Record<string, any>;"} {"repo":"zod","file":"scripts/fail-on-console.ts","line":5,"symbol":"thrower","kind":"function","lang":"typescript","code":"function thrower(method: string) {\n return (...args: any[]) => {\n throw new Error(`Unexpected console.${method} call: ${args.join(\" \")}`);\n };\n}"} {"repo":"zod","file":"scripts/triage-signal.ts","line":18,"symbol":"Args","kind":"interface","lang":"typescript","code":"interface Args {\n repo: string;\n top: number;\n outDir: string;\n page: number;\n}"} {"repo":"zod","file":"scripts/triage-signal.ts","line":25,"symbol":"parseArgs","kind":"function","lang":"typescript","code":"function parseArgs(argv: string[]): Args {\n const get = (flag: string) => {\n const i = argv.indexOf(flag);\n return i === -1 ? undefined : argv[i + 1];\n };\n return {\n repo: get(\"--repo\") ?? \"colinhacks/zod\",\n top: Number(get(\"--top\") ?? 40),\n outDir: get(\"--out\") ?? \".triage\",\n page: Number(get(\"--page\") ?? 50),\n };\n}"} {"repo":"zod","file":"scripts/triage-signal.ts","line":26,"symbol":"get","kind":"constant","lang":"typescript","code":"const get = (flag: string) => {\n const i = argv.indexOf(flag);\n return i === -1 ? undefined : argv[i + 1];\n };"} {"repo":"zod","file":"scripts/triage-signal.ts","line":27,"symbol":"i","kind":"constant","lang":"typescript","code":"const i = argv.indexOf(flag);"} {"repo":"zod","file":"scripts/triage-signal.ts","line":43,"symbol":"UPVOTE_REACTIONS","kind":"constant","lang":"typescript","doc":"Reaction weights. A reaction is one-per-person, so it is the cleanest \"this affects me too\" vote available. Positive reactions carry demand; the rest are ambiguous and count for much less.","code":"const UPVOTE_REACTIONS = new Set([\"THUMBS_UP\", \"HEART\", \"ROCKET\", \"HOORAY\"]);"} {"repo":"zod","file":"scripts/triage-signal.ts","line":46,"symbol":"W","kind":"constant","lang":"typescript","doc":"Channel weights, applied to log-compressed counts so no one channel runs away.","code":"const W = {\n upvote: 14,\n softReaction: 5,\n voice: 9,\n comment: 5,\n} as const;"} {"repo":"zod","file":"scripts/triage-signal.ts","line":54,"symbol":"PENALTY","kind":"constant","lang":"typescript","doc":"Multipliers applied after the engagement score is assembled.","code":"const PENALTY = {\n draft: 0.5,\n stale: 0.7,\n \"needs-info\": 0.6,\n \"working-as-intended\": 0.3,\n duplicate: 0.25,\n dependencies: 0.2,\n bot: 0.15,\n} as const;"} {"repo":"zod","file":"scripts/triage-signal.ts","line":65,"symbol":"SECURITY_BONUS","kind":"constant","lang":"typescript","doc":"Flat bonus for confirmed security content — large enough to outrank any thread.","code":"const SECURITY_BONUS = 120;"} {"repo":"zod","file":"scripts/triage-signal.ts","line":66,"symbol":"SECURITY_MAYBE_BONUS","kind":"constant","lang":"typescript","code":"const SECURITY_MAYBE_BONUS = 15;"} {"repo":"zod","file":"scripts/triage-signal.ts","line":69,"symbol":"DECAY_FLOOR","kind":"constant","lang":"typescript","doc":"Staleness decay on `updatedAt`: 1.0 fresh, ~0.68 at one year, floored so old pain still surfaces.","code":"const DECAY_FLOOR = 0.35;"} {"repo":"zod","file":"scripts/triage-signal.ts","line":70,"symbol":"DECAY_HALF_LIFE_MONTHS","kind":"constant","lang":"typescript","code":"const DECAY_HALF_LIFE_MONTHS = 12;"} {"repo":"zod","file":"scripts/triage-signal.ts","line":80,"symbol":"VULN_STRONG","kind":"constant","lang":"typescript","doc":"Unambiguous markers. These name a security concept that has no innocent use, so a hit anywhere — title or body — promotes the item.","code":"const VULN_STRONG: [RegExp, string][] = [\n [/\\bCVE-\\d{4}-\\d{4,}/i, \"CVE reference\"],\n [/\\bGHSA-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}\\b/i, \"GHSA reference\"],\n [/\\bCWE-\\d+\\b/i, \"CWE reference\"],\n [/prototype\\s+pollut/i, \"prototype pollution\"],\n [/\\bprototype\\s+(chain\\s+)?(poison|injection|manipulat)/i, \"prototype manipulation\"],\n [/regular\\s+expression\\s+denial\\s+of\\s+service/i, \"ReDoS\"],\n [/catastrophic\\s+backtrack/i, \"catastrophic backtracking\"],\n [/exponential\\s+backtrack/i, \"catastrophic backtracking\"],\n [/\\b(XSS|cross[\\s-]site\\s+scripting)\\b/i, \"XSS\"],\n [/\\bRCE\\b|remote\\s+code\\s+execution/i, \"RCE\"],\n [/arbitrary\\s+code\\s+execution/i, \"arbitrary code execution\"],\n [/security\\s+(vulnerabilit|advisor|issue|flaw|report)/i, \"security report\"],\n [/\\bsupply[\\s-]chain\\b/i, \"supply chain\"],\n];"} {"repo":"zod","file":"scripts/triage-signal.ts","line":101,"symbol":"VULN_CONTEXTUAL","kind":"constant","lang":"typescript","doc":"Real security terms that also appear incidentally — a PR body noting \"1 flaky timeout in the redos checker\" is not a ReDoS report. These count only in the title, or when the body carries two different ones.","code":"const VULN_CONTEXTUAL: [RegExp, string][] = [\n [/\\b__proto__\\b/, \"__proto__\"],\n [/\\bObject\\.prototype\\b/, \"Object.prototype\"],\n [/\\bReDoS\\b/i, \"ReDoS\"],\n [/\\bdenial[\\s-]of[\\s-]service\\b/i, \"denial of service\"],\n [/\\bvulnerabilit(y|ies)\\b/i, \"vulnerability\"],\n];"} {"repo":"zod","file":"scripts/triage-signal.ts","line":110,"symbol":"VULN_WEAK","kind":"constant","lang":"typescript","doc":"Weaker markers — flagged for a human look but not promoted.","code":"const VULN_WEAK: [RegExp, string][] = [\n [/\\bsanitiz(e|ing|ation)\\b/i, \"sanitization\"],\n [/\\bexploit(able)?\\b/i, \"exploit\"],\n [/\\buntrusted\\s+(input|data|user)/i, \"untrusted input\"],\n [/\\bstack\\s+overflow\\b/i, \"stack overflow\"],\n [/\\bRangeError\\b/, \"RangeError\"],\n [/\\bmalicious\\b/i, \"malicious\"],\n];"} {"repo":"zod","file":"scripts/triage-signal.ts","line":120,"symbol":"VULN_LABEL","kind":"constant","lang":"typescript","doc":"Label names that mean \"security\" regardless of content.","code":"const VULN_LABEL = /^(security|vulnerability|vuln|cve|advisory)$/i;"} {"repo":"zod","file":"scripts/triage-signal.ts","line":122,"symbol":"VulnVerdict","kind":"interface","lang":"typescript","code":"interface VulnVerdict {\n level: \"confirmed\" | \"possible\" | \"none\";\n reasons: string[];\n}"} {"repo":"zod","file":"scripts/triage-signal.ts","line":127,"symbol":"detectVuln","kind":"function","lang":"typescript","code":"function detectVuln(item: Item): VulnVerdict {\n const confirmed: string[] = [];\n for (const l of item.labels) {\n if (VULN_LABEL.test(l)) confirmed.push(`label:${l}`);\n }\n // Only the leading slice of the body is scanned. Full bodies drag in stack traces and quoted source that trip every keyword.\n const title = item.title;\n const body = item.body.slice(0, 3000);\n const hay = `${title}\\n${body}`;\n\n for (const [re, name] of VULN_STRONG) {\n if (re.test(hay)) confirmed.push(name);\n }\n\n const inTitle: string[] = [];\n const inBody: string[] = [];\n for (const [re, name] of VULN_CONTEXTUAL) {\n if (re.test(title)) inTitle.push(name);\n else if (re.test(body)) inBody.push(name);\n }\n confirmed.push(...inTitle);\n // Two different contextual terms in one body is a report, not a passing mention.\n if (inBody.length >= 2) confirmed.push(...inBody);\n\n if (confirmed.length) return { level: \"confirmed\", reasons: dedupe(confirmed) };\n\n const weak = [...inBody];\n for (const [re, name] of VULN_WEAK) {\n if (re.test(hay)) weak.push(name);\n }\n if (weak.length) return { level: \"possible\", reasons: dedupe(weak) };\n return { level: \"none\", reasons: [] };\n}"} {"repo":"zod","file":"scripts/triage-signal.ts","line":128,"symbol":"confirmed","kind":"constant","lang":"typescript","code":"const confirmed: string[] = [];"} {"repo":"zod","file":"scripts/triage-signal.ts","line":133,"symbol":"title","kind":"constant","lang":"typescript","doc":"Only the leading slice of the body is scanned. Full bodies drag in stack traces and quoted source that trip every keyword.","code":"const title = item.title;"} {"repo":"zod","file":"scripts/triage-signal.ts","line":134,"symbol":"body","kind":"constant","lang":"typescript","code":"const body = item.body.slice(0, 3000);"} {"repo":"zod","file":"scripts/triage-signal.ts","line":135,"symbol":"hay","kind":"constant","lang":"typescript","code":"const hay = `${title}\\n${body}`;"} {"repo":"zod","file":"scripts/triage-signal.ts","line":141,"symbol":"inTitle","kind":"constant","lang":"typescript","code":"const inTitle: string[] = [];"} {"repo":"zod","file":"scripts/triage-signal.ts","line":142,"symbol":"inBody","kind":"constant","lang":"typescript","code":"const inBody: string[] = [];"} {"repo":"zod","file":"scripts/triage-signal.ts","line":153,"symbol":"weak","kind":"constant","lang":"typescript","code":"const weak = [...inBody];"} {"repo":"zod","file":"scripts/triage-signal.ts","line":161,"symbol":"dedupe","kind":"function","lang":"typescript","code":"function dedupe(xs: string[]): string[] {\n return [...new Set(xs)];\n}"} {"repo":"zod","file":"scripts/triage-signal.ts","line":169,"symbol":"Item","kind":"interface","lang":"typescript","code":"interface Item {\n kind: \"issue\" | \"pr\";\n number: number;\n title: string;\n url: string;\n body: string;\n author: string;\n authorIsBot: boolean;\n createdAt: string;\n updatedAt: string;\n labels: string[];\n comments: number;\n participants: number;\n upvotes: number;\n softReactions: number;\n totalReactions: number;\n // PR-only\n isDraft?: boolean;\n additions?: number;\n deletions?: number;\n changedFiles?: number;\n reviews?: number;\n reviewDecision?: string | null;\n mergeable?: string;\n}"} {"repo":"zod","file":"scripts/triage-signal.ts","line":195,"symbol":"Scored","kind":"interface","lang":"typescript","code":"interface Scored extends Item {\n engagement: number;\n decay: number;\n penalty: number;\n vuln: VulnVerdict;\n /** Engagement alone, before the security bonus. */\n baseScore: number;\n score: number;\n /** Verdict from a previous sweep's .triage/<kind>/<n>/results.md, if one exists. */\n prior?: { verdict: string; status: string };\n}"} {"repo":"zod","file":"scripts/triage-signal.ts","line":207,"symbol":"REACTION_FRAGMENT","kind":"constant","lang":"typescript","code":"const REACTION_FRAGMENT = `reactionGroups { content users { totalCount } }`;"} {"repo":"zod","file":"scripts/triage-signal.ts","line":209,"symbol":"ISSUE_QUERY","kind":"constant","lang":"typescript","code":"const ISSUE_QUERY = `\nquery($owner: String!, $name: String!, $cursor: String, $page: Int!) {\n repository(owner: $owner, name: $name) {\n issues(first: $page, after: $cursor, states: OPEN, orderBy: {field: CREATED_AT, direction: DESC}) {\n pageInfo { hasNextPage endCursor }\n nodes {\n number title url bodyText createdAt updatedAt\n author { login __typename }\n comments { totalCount }\n participants { totalCount }\n labels(first: 20) { nodes { name } }\n ${REACTION_FRAGMENT}\n }\n }\n }\n}`;"} {"repo":"zod","file":"scripts/triage-signal.ts","line":226,"symbol":"PR_QUERY","kind":"constant","lang":"typescript","code":"const PR_QUERY = `\nquery($owner: String!, $name: String!, $cursor: String, $page: Int!) {\n repository(owner: $owner, name: $name) {\n pullRequests(first: $page, after: $cursor, states: OPEN, orderBy: {field: CREATED_AT, direction: DESC}) {\n pageInfo { hasNextPage endCursor }\n nodes {\n number title url bodyText createdAt updatedAt\n isDraft additions deletions changedFiles mergeable reviewDecision\n author { login __typename }\n comments { totalCount }\n reviews { totalCount }\n participants { totalCount }\n labels(first: 20) { nodes { name } }\n ${REACTION_FRAGMENT}\n }\n }\n }\n}`;"} {"repo":"zod","file":"scripts/triage-signal.ts","line":246,"symbol":"ghToken","kind":"function","lang":"typescript","code":"function ghToken(): string {\n token ??= execFileSync(\"gh\", [\"auth\", \"token\"], { encoding: \"utf8\" }).trim();\n return token;\n}"} {"repo":"zod","file":"scripts/triage-signal.ts","line":251,"symbol":"graphql","kind":"function","lang":"typescript","code":"async function graphql(query: string, variables: Record<string, unknown>): Promise<any> {\n const res = await fetch(\"https://api.github.com/graphql\", {\n method: \"POST\",\n headers: {\n authorization: `bearer ${ghToken()}`,\n \"content-type\": \"application/json\",\n \"user-agent\": \"zod-triage-signal\",\n },\n body: JSON.stringify({ query, variables }),\n });\n if (!res.ok) throw new Error(`GitHub API ${res.status}: ${await res.text()}`);\n const json = (await res.json()) as { data?: any; errors?: { message: string }[] };\n if (json.errors?.length) throw new Error(json.errors.map((e) => e.message).join(\"; \"));\n return json.data;\n}"} {"repo":"zod","file":"scripts/triage-signal.ts","line":252,"symbol":"res","kind":"constant","lang":"typescript","code":"const res = await fetch(\"https://api.github.com/graphql\", {\n method: \"POST\",\n headers: {\n authorization: `bearer ${ghToken()}`,\n \"content-type\": \"application/json\",\n \"user-agent\": \"zod-triage-signal\",\n },\n body: JSON.stringify({ query, variables }),\n });"} {"repo":"zod","file":"scripts/triage-signal.ts","line":262,"symbol":"json","kind":"constant","lang":"typescript","code":"const json = (await res.json()) as { data?: any; errors?: { message: string }[] };"} {"repo":"zod","file":"scripts/triage-signal.ts","line":267,"symbol":"readReactions","kind":"function","lang":"typescript","code":"function readReactions(groups: { content: string; users: { totalCount: number } }[]) {\n let upvotes = 0;\n let soft = 0;\n for (const g of groups) {\n const n = g.users.totalCount;\n if (UPVOTE_REACTIONS.has(g.content)) upvotes += n;\n else soft += n;\n }\n return { upvotes, soft, total: upvotes + soft };\n}"} {"repo":"zod","file":"scripts/triage-signal.ts","line":271,"symbol":"n","kind":"constant","lang":"typescript","code":"const n = g.users.totalCount;"} {"repo":"zod","file":"scripts/triage-signal.ts","line":278,"symbol":"normalize","kind":"function","lang":"typescript","code":"function normalize(node: any, kind: \"issue\" | \"pr\"): Item {\n const r = readReactions(node.reactionGroups ?? []);\n return {\n kind,\n number: node.number,\n title: node.title,\n url: node.url,\n body: node.bodyText ?? \"\",\n author: node.author?.login ?? \"ghost\",\n authorIsBot: node.author?.__typename === \"Bot\" || /\\[bot\\]$/.test(node.author?.login ?? \"\"),\n createdAt: node.createdAt,\n updatedAt: node.updatedAt,\n labels: (node.labels?.nodes ?? []).map((l: { name: string }) => l.name),\n comments: node.comments?.totalCount ?? 0,\n participants: node.participants?.totalCount ?? 0,\n upvotes: r.upvotes,\n softReactions: r.soft,\n totalReactions: r.total,\n ...(kind === \"pr\"\n ? {\n isDraft: node.isDraft,\n additions: node.additions,\n deletions: node.deletions,\n changedFiles: node.changedFiles,\n reviews: node.reviews?.totalCount ?? 0,\n reviewDecision: node.reviewDecision,\n mergeable: node.mergeable,\n }\n : {}),\n };\n}"} {"repo":"zod","file":"scripts/triage-signal.ts","line":279,"symbol":"r","kind":"constant","lang":"typescript","code":"const r = readReactions(node.reactionGroups ?? []);"} {"repo":"zod","file":"scripts/triage-signal.ts","line":310,"symbol":"fetchAll","kind":"function","lang":"typescript","code":"async function fetchAll(repo: string, kind: \"issue\" | \"pr\", page: number): Promise<Item[]> {\n const [owner, name] = repo.split(\"/\");\n const query = kind === \"issue\" ? ISSUE_QUERY : PR_QUERY;\n const key = kind === \"issue\" ? \"issues\" : \"pullRequests\";\n const out: Item[] = [];\n let cursor: string | null = null;\n for (;;) {\n const data = await graphql(query, { owner, name, cursor, page });\n const conn = data.repository[key];\n for (const node of conn.nodes) out.push(normalize(node, kind));\n process.stderr.write(`\\r ${kind}: ${out.length}`);\n if (!conn.pageInfo.hasNextPage) break;\n cursor = conn.pageInfo.endCursor;\n }\n process.stderr.write(\"\\n\");\n return out;\n}"} {"repo":"zod","file":"scripts/triage-signal.ts","line":312,"symbol":"query","kind":"constant","lang":"typescript","code":"const query = kind === \"issue\" ? ISSUE_QUERY : PR_QUERY;"} {"repo":"zod","file":"scripts/triage-signal.ts","line":313,"symbol":"key","kind":"constant","lang":"typescript","code":"const key = kind === \"issue\" ? \"issues\" : \"pullRequests\";"} {"repo":"zod","file":"scripts/triage-signal.ts","line":314,"symbol":"out","kind":"constant","lang":"typescript","code":"const out: Item[] = [];"} {"repo":"zod","file":"scripts/triage-signal.ts","line":317,"symbol":"data","kind":"constant","lang":"typescript","code":"const data = await graphql(query, { owner, name, cursor, page });"} {"repo":"zod","file":"scripts/triage-signal.ts","line":318,"symbol":"conn","kind":"constant","lang":"typescript","code":"const conn = data.repository[key];"} {"repo":"zod","file":"scripts/triage-signal.ts","line":332,"symbol":"MS_PER_MONTH","kind":"constant","lang":"typescript","code":"const MS_PER_MONTH = 1000 * 60 * 60 * 24 * 30.44;"} {"repo":"zod","file":"scripts/triage-signal.ts","line":334,"symbol":"score","kind":"function","lang":"typescript","code":"function score(item: Item, now: number): Scored {\n // Each channel is log-compressed independently so a single 200-comment thread can't outrank broad, quiet demand — and reactions stay the dominant term.\n const voices = Math.max(0, item.participants - 1);\n const discussion = item.comments + (item.reviews ?? 0);\n const engagement =\n W.upvote * Math.log1p(item.upvotes) +\n W.softReaction * Math.log1p(item.softReactions) +\n W.voice * Math.log1p(voices) +\n W.comment * Math.log1p(discussion);\n\n const monthsIdle = (now - Date.parse(item.updatedAt)) / MS_PER_MONTH;\n const decay = DECAY_FLOOR + (1 - DECAY_FLOOR) * 0.5 ** (monthsIdle / DECAY_HALF_LIFE_MONTHS);\n\n let penalty = 1;\n if (item.isDraft) penalty *= PENALTY.draft;\n if (item.authorIsBot) penalty *= PENALTY.bot;\n for (const l of item.labels) {\n const p = (PENALTY as Record<string, number>)[l];\n if (p !== undefined) penalty *= p;\n }\n\n const vuln = detectVuln(item);\n const bonus = vuln.level === \"confirmed\" ? SECURITY_BONUS : vuln.level === \"possible\" ? SECURITY_MAYBE_BONUS : 0;\n\n const baseScore = engagement * decay * penalty;\n return { ...item, engagement, decay, penalty, vuln, baseScore, score: baseSc"} {"repo":"zod","file":"scripts/triage-signal.ts","line":336,"symbol":"voices","kind":"constant","lang":"typescript","doc":"Each channel is log-compressed independently so a single 200-comment thread can't outrank broad, quiet demand — and reactions stay the dominant term.","code":"const voices = Math.max(0, item.participants - 1);"} {"repo":"zod","file":"scripts/triage-signal.ts","line":337,"symbol":"discussion","kind":"constant","lang":"typescript","code":"const discussion = item.comments + (item.reviews ?? 0);"} {"repo":"zod","file":"scripts/triage-signal.ts","line":338,"symbol":"engagement","kind":"constant","lang":"typescript","code":"const engagement =\n W.upvote * Math.log1p(item.upvotes) +\n W.softReaction * Math.log1p(item.softReactions) +\n W.voice * Math.log1p(voices) +\n W.comment * Math.log1p(discussion);"} {"repo":"zod","file":"scripts/triage-signal.ts","line":344,"symbol":"monthsIdle","kind":"constant","lang":"typescript","code":"const monthsIdle = (now - Date.parse(item.updatedAt)) / MS_PER_MONTH;"} {"repo":"zod","file":"scripts/triage-signal.ts","line":345,"symbol":"decay","kind":"constant","lang":"typescript","code":"const decay = DECAY_FLOOR + (1 - DECAY_FLOOR) * 0.5 ** (monthsIdle / DECAY_HALF_LIFE_MONTHS);"} {"repo":"zod","file":"scripts/triage-signal.ts","line":351,"symbol":"p","kind":"constant","lang":"typescript","code":"const p = (PENALTY as Record<string, number>)[l];"} {"repo":"zod","file":"scripts/triage-signal.ts","line":355,"symbol":"vuln","kind":"constant","lang":"typescript","code":"const vuln = detectVuln(item);"} {"repo":"zod","file":"scripts/triage-signal.ts","line":356,"symbol":"bonus","kind":"constant","lang":"typescript","code":"const bonus = vuln.level === \"confirmed\" ? SECURITY_BONUS : vuln.level === \"possible\" ? SECURITY_MAYBE_BONUS : 0;"} {"repo":"zod","file":"scripts/triage-signal.ts","line":358,"symbol":"baseScore","kind":"constant","lang":"typescript","code":"const baseScore = engagement * decay * penalty;"} {"repo":"zod","file":"scripts/triage-signal.ts","line":366,"symbol":"STOPWORDS","kind":"constant","lang":"typescript","code":"const STOPWORDS = new Set(\n \"a an the and or of to in for on with when is are be do does not no fix fixes fixed feat chore docs test tests refactor perf ci bug issue support add adds added allow allows make makes use using update updates from into via zod v3 v4 correctly properly\".split(\n \" \"\n )\n);"} {"repo":"zod","file":"scripts/triage-signal.ts","line":372,"symbol":"titleTokens","kind":"function","lang":"typescript","code":"function titleTokens(title: string): Set<string> {\n const stripped = title\n .replace(/^\\s*\\w+(\\([^)]*\\))?!?:\\s*/, \"\") // conventional-commit prefix\n .replace(/\\(#\\d+\\)/g, \"\")\n .toLowerCase();\n return new Set(\n stripped\n .split(/[^a-z0-9_]+/)\n .filter((t) => t.length > 2 && !STOPWORDS.has(t))\n .map((t) => t.replace(/(ing|ed|es|s)$/, \"\"))\n );\n}"} {"repo":"zod","file":"scripts/triage-signal.ts","line":373,"symbol":"stripped","kind":"constant","lang":"typescript","code":"const stripped = title\n .replace(/^\\s*\\w+(\\([^)]*\\))?!?:\\s*/, \"\") // conventional-commit prefix\n .replace(/\\(#\\d+\\)/g, \"\")\n .toLowerCase();"} {"repo":"zod","file":"scripts/triage-signal.ts","line":385,"symbol":"jaccard","kind":"function","lang":"typescript","code":"function jaccard(a: Set<string>, b: Set<string>): number {\n if (!a.size || !b.size) return 0;\n let shared = 0;\n for (const t of a) if (b.has(t)) shared++;\n return shared / (a.size + b.size - shared);\n}"} {"repo":"zod","file":"scripts/triage-signal.ts","line":396,"symbol":"findClusters","kind":"function","lang":"typescript","doc":"Groups open items that appear to address the same thing, so a pile of near-identical drive-by PRs collapses into one decision.","code":"function findClusters(items: Scored[], threshold = 0.5): Scored[][] {\n const toks = items.map((i) => titleTokens(i.title));\n const parent = items.map((_, i) => i);\n const find = (x: number): number => {\n while (parent[x] !== x) {\n parent[x] = parent[parent[x]];\n x = parent[x];\n }\n return x;\n };\n for (let i = 0; i < items.length; i++) {\n for (let j = i + 1; j < items.length; j++) {\n if (jaccard(toks[i], toks[j]) >= threshold) parent[find(i)] = find(j);\n }\n }\n const groups = new Map<number, Scored[]>();\n for (let i = 0; i < items.length; i++) {\n const root = find(i);\n if (!groups.has(root)) groups.set(root, []);\n groups.get(root)!.push(items[i]);\n }\n return [...groups.values()]\n .filter((g) => g.length > 1)\n .map((g) => g.sort((a, b) => b.score - a.score))\n .sort((a, b) => b.length - a.length || b[0].score - a[0].score);\n}"} {"repo":"zod","file":"scripts/update-iso-4217.ts","line":5,"symbol":"__dirname","kind":"constant","lang":"typescript","code":"const __dirname = fileURLToPath(new URL(\".\", import.meta.url));"} {"repo":"zod","file":"scripts/update-iso-4217.ts","line":8,"symbol":"SOURCE","kind":"constant","lang":"typescript","doc":"SIX Group maintains ISO 4217; list one carries the active codes, list three the withdrawn ones","code":"const SOURCE =\n \"https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml\";"} {"repo":"zod","file":"scripts/update-iso-4217.ts","line":10,"symbol":"target","kind":"constant","lang":"typescript","code":"const target = join(__dirname, \"..\", \"packages\", \"zod\", \"src\", \"v4\", \"core\", \"regexes.ts\");"} {"repo":"zod","file":"scripts/update-iso-4217.ts","line":11,"symbol":"line","kind":"constant","lang":"typescript","code":"const line = /^export const currencyCode: RegExp =\\s+\\/\\^\\(\\?:([A-Z|]+)\\)\\$\\/;$/m;"} {"repo":"zod","file":"scripts/update-iso-4217.ts","line":13,"symbol":"response","kind":"constant","lang":"typescript","code":"const response = await fetch(SOURCE);"} {"repo":"zod","file":"scripts/update-iso-4217.ts","line":15,"symbol":"xml","kind":"constant","lang":"typescript","code":"const xml = await response.text();"} {"repo":"zod","file":"scripts/update-iso-4217.ts","line":16,"symbol":"published","kind":"constant","lang":"typescript","code":"const published = xml.match(/<ISO_4217 Pblshd=\"(\\d{4}-\\d{2}-\\d{2})\"/)?.[1];"} {"repo":"zod","file":"scripts/update-iso-4217.ts","line":18,"symbol":"codes","kind":"constant","lang":"typescript","code":"const codes = [...new Set(Array.from(xml.matchAll(/<Ccy>([A-Z]{3})<\\/Ccy>/g), (m) => m[1]!))].sort();"} {"repo":"zod","file":"scripts/update-iso-4217.ts","line":22,"symbol":"source","kind":"constant","lang":"typescript","code":"const source = readFileSync(target, \"utf8\");"} {"repo":"zod","file":"scripts/update-iso-4217.ts","line":23,"symbol":"current","kind":"constant","lang":"typescript","code":"const current = source.match(line)?.[1]?.split(\"|\");"} {"repo":"zod","file":"scripts/update-iso-4217.ts","line":25,"symbol":"added","kind":"constant","lang":"typescript","code":"const added = codes.filter((code) => !current.includes(code));"} {"repo":"zod","file":"scripts/update-iso-4217.ts","line":26,"symbol":"removed","kind":"constant","lang":"typescript","code":"const removed = current.filter((code) => !codes.includes(code));"} {"repo":"zod","file":"scripts/write-stub-package-jsons.ts","line":6,"symbol":"STUB_PACKAGE_JSON_CONTENT","kind":"constant","lang":"typescript","code":"const STUB_PACKAGE_JSON_CONTENT = `{ \n \"type\": \"module\",\n \"main\": \"./index.cjs\",\n \"module\": \"./index.js\",\n \"types\": \"./index.d.cts\",\n \"sideEffects\": false\n}\n`;"} {"repo":"zod","file":"scripts/write-stub-package-jsons.ts","line":18,"symbol":"findIndexJsFiles","kind":"function","lang":"typescript","doc":"Recursively find all index.d.cts files in a directory","code":"function findIndexJsFiles(dir: string, relativePath = \"\"): string[] {\n const results: string[] = [];\n\n try {\n const entries = readdirSync(dir);\n\n for (const entry of entries) {\n // Skip node_modules\n if (entry !== \"node_modules\") {\n const fullPath = join(dir, entry);\n const relativeFilePath = relativePath ? join(relativePath, entry) : entry;\n\n try {\n const stat = statSync(fullPath);\n\n if (stat.isDirectory()) {\n // Recursively search subdirectories\n results.push(...findIndexJsFiles(fullPath, relativeFilePath));\n } else if (entry === \"index.d.cts\") {\n // Found an index.d.cts file\n results.push(relativePath || \".\");\n }\n } catch {\n // Skip files/directories we can't access\n }\n }\n }\n } catch {\n // Skip directories we can't read\n }\n\n return results;\n}"} {"repo":"zod","file":"scripts/write-stub-package-jsons.ts","line":19,"symbol":"results","kind":"constant","lang":"typescript","code":"const results: string[] = [];"} {"repo":"zod","file":"scripts/write-stub-package-jsons.ts","line":22,"symbol":"entries","kind":"constant","lang":"typescript","code":"const entries = readdirSync(dir);"} {"repo":"zod","file":"scripts/write-stub-package-jsons.ts","line":27,"symbol":"fullPath","kind":"constant","lang":"typescript","code":"const fullPath = join(dir, entry);"} {"repo":"zod","file":"scripts/write-stub-package-jsons.ts","line":28,"symbol":"relativeFilePath","kind":"constant","lang":"typescript","code":"const relativeFilePath = relativePath ? join(relativePath, entry) : entry;"} {"repo":"zod","file":"scripts/write-stub-package-jsons.ts","line":31,"symbol":"stat","kind":"constant","lang":"typescript","code":"const stat = statSync(fullPath);"} {"repo":"zod","file":"scripts/write-stub-package-jsons.ts","line":56,"symbol":"writeStubPackageJsons","kind":"function","lang":"typescript","doc":"Script to write stub package.json files to directories containing index.d.cts files. This resolves TypeScript assignability issues by providing explicit type declarations.","code":"function writeStubPackageJsons() {\n const zodPackageRoot = join(import.meta.dirname, \"../packages/zod\");\n\n // Find all directories containing index.d.cts files\n const dirsWithIndexJs = findIndexJsFiles(zodPackageRoot);\n\n const processedDirs = new Set<string>();\n\n for (const dir of dirsWithIndexJs) {\n // Skip root directory (it already has a proper package.json)\n if (dir === \".\") {\n continue;\n }\n\n // Avoid duplicate processing\n if (processedDirs.has(dir)) {\n continue;\n }\n processedDirs.add(dir);\n\n const packageJsonPath = join(zodPackageRoot, dir, \"package.json\");\n\n // Write the stub package.json\n writeFileSync(packageJsonPath, STUB_PACKAGE_JSON_CONTENT, \"utf8\");\n console.log(`✅ Created ${dir}/package.json`);\n }\n\n console.log(\"\\n✨ Done! All stub package.json files have been created.\");\n}"} {"repo":"zod","file":"scripts/write-stub-package-jsons.ts","line":57,"symbol":"zodPackageRoot","kind":"constant","lang":"typescript","code":"const zodPackageRoot = join(import.meta.dirname, \"../packages/zod\");"} {"repo":"zod","file":"scripts/write-stub-package-jsons.ts","line":60,"symbol":"dirsWithIndexJs","kind":"constant","lang":"typescript","doc":"Find all directories containing index.d.cts files","code":"const dirsWithIndexJs = findIndexJsFiles(zodPackageRoot);"} {"repo":"zod","file":"scripts/write-stub-package-jsons.ts","line":62,"symbol":"processedDirs","kind":"constant","lang":"typescript","code":"const processedDirs = new Set<string>();"} {"repo":"zod","file":"scripts/write-stub-package-jsons.ts","line":76,"symbol":"packageJsonPath","kind":"constant","lang":"typescript","code":"const packageJsonPath = join(zodPackageRoot, dir, \"package.json\");"} {"repo":"zod","file":"vitest.compile.config.ts","line":5,"symbol":"__dirname","kind":"constant","lang":"typescript","code":"const __dirname = dirname(fileURLToPath(import.meta.url));"} {"repo":"zod","file":"vitest.config.ts","line":5,"symbol":"__dirname","kind":"constant","lang":"typescript","code":"const __dirname = dirname(fileURLToPath(import.meta.url));"}