Repository: colinhacks/zod
Pull request #4594 (2025-06-01 09:34:59)

feat(locale): Add Pashto (ps) locale support
This PR adds Pashto (ps) locale support to Zod, enabling validation error messages.


Patch:
diff --git a/packages/bench/index.ts b/packages/bench/index.ts
index 6cc9b088..730a141f 100644
--- a/packages/bench/index.ts
+++ b/packages/bench/index.ts
@@ -6,6 +6,7 @@ async function run() {
   const files = process.argv[2].split(",").map((file) => import.meta.resolve(`./${file}`).replace("file://", ""));
 
   for (const file of files) {
+    // await $`pnpm tsx --conditions @zod/source ${file}`;
     await $`pnpm tsx ${file}`;
   }
 }
diff --git a/packages/bench/object-moltar.ts b/packages/bench/object-moltar.ts
index 146dbabc..573a2e20 100644
--- a/packages/bench/object-moltar.ts
+++ b/packages/bench/object-moltar.ts
@@ -1,5 +1,5 @@
 import * as z4 from "zod/v4";
-import * as z4lib from "./node_modules/zod/dist/esm/v4/index.js";
+import * as z4lib from "./node_modules/zod4/dist/esm/v4/classic/index.js";
 import * as z3 from "zod3";
 import { metabench } from "./metabench.js";
 
@@ -24,7 +24,7 @@ const z4LibSchema = z4lib.object({
   string: z4lib.string(),
   longString: z4lib.string(),
   boolean: z4lib.boolean(),
-  deeplyNested: z4lib.strictObject({
+  deeplyNested: z4lib.object({
     foo: z4lib.string(),
     num: z4lib.number(),
     bool: z4lib.boolean(),
@@ -38,40 +38,40 @@ const z4Schema = z4.object({
   string: z4.string(),
   longString: z4.string(),
   boolean: z4.boolean(),
-  deeplyNested: z4.strictObject({
+  deeplyNested: z4.object({
     foo: z4.string(),
     num: z4.number(),
     bool: z4.boolean(),
   }),
 });
 
-const z4SchemaStrict = z4.strictObject({
-  number: z4.number(),
-  negNumber: z4.number(),
-  maxNumber: z4.number(),
-  string: z4.string(),
-  longString: z4.string(),
-  boolean: z4.boolean(),
-  deeplyNested: z4.strictObject({
-    foo: z4.string(),
-    num: z4.number(),
-    bool: z4.boolean(),
-  }),
-});
+// const z4SchemaStrict = z4.strictObject({
+//   number: z4.number(),
+//   negNumber: z4.number(),
+//   maxNumber: z4.number(),
+//   string: z4.string(),
+//   longString: z4.string(),
+//   boolean: z4.boolean(),
+//   deeplyNested: z4.strictObject({
+//     foo: z4.string(),
+//     num: z4.number(),
+//     bool: z4.boolean(),
+//   }),
+// });
 
-const z4SchemaLoose = z4.object({
-  number: z4.number(),
-  negNumber: z4.number(),
-  maxNumber: z4.number(),
-  string: z4.string(),
-  longString: z4.string(),
-  boolean: z4.boolean(),
-  deeplyNested: z4.object({
-    foo: z4.string(),
-    num: z4.number(),
-    bool: z4.boolean(),
-  }),
-});
+// const z4SchemaLoose = z4.object({
+//   number: z4.number(),
+//   negNumber: z4.number(),
+//   maxNumber: z4.number(),
+//   string: z4.string(),
+//   longString: z4.string(),
+//   boolean: z4.boolean(),
+//   deeplyNested: z4.object({
+//     foo: z4.string(),
+//     num: z4.number(),
+//     bool: z4.boolean(),
+//   }),
+// });
 
 const DATA = Array.from({ length: 1000 }, () =>
   Object.freeze({
@@ -97,9 +97,9 @@ const bench = metabench("z.object() safeParse", {
   zod3() {
     for (const _ of DATA) z3Schema.parse(_);
   },
-  // zod4lib() {
-  //   for (const _ of DATA) z4LibSchema.parse(_);
-  // },
+  zod4lib() {
+    for (const _ of DATA) z4LibSchema.parse(_);
+  },
   zod4(){
     for (const _ of DATA) z4Schema.parse(_);
   }
diff --git a/packages/bench/package.json b/packages/bench/package.json
index 7ab71989..305c8429 100644
--- a/packages/bench/package.json
+++ b/packages/bench/package.json
@@ -6,8 +6,8 @@
     "arktype": "^2.1.19",
     "valibot": "^1.0.0",
     "zod": "workspace:*",
-    "zodnext": "npm:zod@^3.25.0",
-    "zod3": "npm:zod@^3.23.7"
+    "zod3": "npm:zod@~3.24.0",
+    "zod4": "npm:zod@latest"
   },
   "scripts": {
     "bench": "tsx --conditions @zod/source index.ts"
diff --git a/packages/bench/tsconfig.bench.json b/packages/bench/tsconfig.bench.json
index a9cff31d..de0ddba5 100644
--- a/packages/bench/tsconfig.bench.json
+++ b/packages/bench/tsconfig.bench.json
@@ -4,7 +4,7 @@
     "noEmit": true,
     "extendedDiagnostics": true,
     "traceResolution": true,
-    "customConditions": [],
+    "customConditions": ["@zod/source"],
     "skipDefaultLibCheck": true,
     "skipLibCheck": true,
   }
diff --git a/packages/docs/components/ecosystem-v3.tsx b/packages/docs/components/ecosystem-v3.tsx
index 32da01b9..a640a3a3 100644
--- a/packages/docs/components/ecosystem-v3.tsx
+++ b/packages/docs/components/ecosystem-v3.tsx
@@ -195,8 +195,8 @@ const formIntegrations: ZodResource[] = [
     slug: "schalkventer/frrm",
   },
   {
-    name: "@regle/schemas",
-    url: "https://github.com/victorgarciaesgi/regle/tree/main/packages/schemas",
+    name: "regle",
+    url: "https://github.com/victorgarciaesgi/regle",
     description: "Headless form validation library for Vue.js.",
     slug: "victorgarciaesgi/regle",
     v4: true,
diff --git a/packages/docs/components/ecosystem.tsx b/packages/docs/components/ecosystem.tsx
index aad67859..7a89faa2 100644
--- a/packages/docs/components/ecosystem.tsx
+++ b/packages/docs/components/ecosystem.tsx
@@ -37,6 +37,13 @@ const apiLibraries: ZodResource[] = [
     slug: "RobinTail/express-zod-api",
     v4: true,
   },
+  {
+    name: "Zod Sockets",
+    url: "https://github.com/RobinTail/zod-sockets",
+    description: "Socket.IO solution with I/O validation, an AsyncAPI generator, and a type-safe events map.",
+    slug: "RobinTail/zod-sockets",
+    v4: true,
+  },
 
   // https://github.com/honojs/middleware/tree/main/packages/zod-validator
   // {
@@ -49,8 +56,8 @@ const apiLibraries: ZodResource[] = [
 
 const formIntegrations: ZodResource[] = [
   {
-    name: "@regle/schemas",
-    url: "https://github.com/victorgarciaesgi/regle/tree/main/packages/schemas",
+    name: "regle",
+    url: "https://github.com/victorgarciaesgi/regle",
     description: "Headless form validation library for Vue.js.",
     slug: "victorgarciaesgi/regle",
   },
@@ -61,6 +68,12 @@ const formIntegrations: ZodResource[] = [
       "A type-safe form validation library utilizing web fundamentals to progressively enhance HTML Forms with full support for server frameworks like Remix and Next.js.",
     slug: "edmundhung/conform",
   },
+  {
+    name: "Superforms",
+    url: "https://superforms.rocks",
+    description: "Making SvelteKit forms a pleasure to use!",
+    slug: "ciscoheat/sveltekit-superforms",
+  },
 ];
 
 const zodToXConverters: ZodResource[] = [];
diff --git a/packages/docs/content/api.mdx b/packages/docs/content/api.mdx
index 651c0efa..a3bb3138 100644
--- a/packages/docs/content/api.mdx
+++ b/packages/docs/content/api.mdx
@@ -52,9 +52,9 @@ schema.parse(null);      // => "null"
 
   | Zod API                  | Coercion                   |
   |--------------------------|----------------------------|
-  | `z.coerce.string()`      | `new String(value)`        |
-  | `z.coerce.number()`      | `new Number(value)`        |
-  | `z.coerce.boolean()`     | `new Boolean(value)`       |
+  | `z.coerce.string()`      | `String(value)`            |
+  | `z.coerce.number()`      | `Number(value)`            |
+  | `z.coerce.boolean()`     | `Boolean(value)`           |
   | `z.coerce.bigint()`      | `BigInt(value)`            |
   | `z.coerce.date()`        | `new Date(value)`          |
 
@@ -89,7 +89,6 @@ const tuna = z.literal("tuna");
 const twelve = z.literal(12);
 const twobig = z.literal(2n);
 const tru = z.literal(true);
-const terrific = z.literal(Symbol("terrific"));
 ```
 
 To represent the JavaScript literals `null` and `undefined`:
@@ -124,6 +123,8 @@ colors.values; // => Set<"red" | "green" | "blue">
 </Tab>
 </Tabs>
 
+
+
 ## Strings
 
 {/* Zod provides a handful of built-in string validation and transform APIs.
@@ -308,7 +309,7 @@ schema.parse("mailto:noreply@zod.dev"); // ✅
 schema.parse("sup"); // ✅
 ```
 
-As you can see this is quite permissive. Internally this uses the `new URL()` constructor to valid inputs; this behavior may differ across platforms and runtimes but it's the mostly rigorous way to validate URIs/URLs on any given JS runtime/engine. 
+As you can see this is quite permissive. Internally this uses the `new URL()` constructor to validate inputs; this behavior may differ across platforms and runtimes but it's the mostly rigorous way to validate URIs/URLs on any given JS runtime/engine. 
 
 To validate the hostname against a specific regex:
 
@@ -450,6 +451,36 @@ const cidrv6 = z.string().cidrv6();
 cidrv6.parse("2001:db8::/32"); // ✅
 ```
 
+## Template literals
+
+> **New in Zod 4**
+
+To define a template literal schema:
+
+```ts
+const schema = z.templateLiteral("hello, ", z.string(), "!");
+// `hello, ${string}!`
+```
+
+The `z.templateLiteral` API can handle any number of string literals (e.g. `"hello"`) and schemas. Any schema with an inferred type that's assignable to `string | number | bigint | boolean | null | undefined` can be passed.
+
+```ts
+z.templateLiteral([ "hi there" ]);
+// `hi there`
+
+z.templateLiteral([ "email: ", z.string() ]);
+// `email: ${string}`
+
+z.templateLiteral([ "high", z.literal(5) ]);
+// `high5`
+
+z.templateLiteral([ z.nullable(z.literal("grassy")) ]);
+// `grassy` | `null`
+
+z.templateLiteral([ z.number(), z.enum(["px", "em", "rem"]) ]);
+// `${number}px` | `${number}em` | `${number}rem`
+```
+
 ## Numbers
 
 Use `z.number()` to validate numbers. It allows any finite number.
@@ -704,7 +735,7 @@ const SalmonAndTroutOnly = FishEnum.extract(["Salmon", "Trout"]);
 </Tab>
 </Tabs>
 
-## Stringbool
+## Stringbools [#stringbool]
 
 > **💎 New in Zod 4**
 
@@ -718,7 +749,7 @@ strbool.parse("1")            // => true
 strbool.parse("yes")          // => true
 strbool.parse("on")           // => true
 strbool.parse("y")            // => true
-strbool.parse("enable")       // => true
+strbool.parse("enabled")      // => true
 
 strbool.parse("false");       // => false
 strbool.parse("0");           // => false
@@ -748,6 +779,7 @@ z.stringbool({
 });
 ```
 
+
 ## Optionals
 
 To make a schema *optional* (that is, to allow `undefined` inputs).
@@ -849,29 +881,6 @@ No value will pass validation.
 z.never(); // inferred type: `never`
 ```
 
-## Template literals
-
-
-> **💎 New in Zod 4**
-
-Zod 4 finally implements one of the last remaining unrepresented features of TypeScript's type system: template literals. Virtually all primitive schemas can be used in `z.templateLiteral`: strings, string formats like `z.email()`, numbers, booleans, enums, literals (of the non-template variety), optional/nullable, and other template literals.
-
-```ts
-const hello = z.templateLiteral(["hello, ", z.string()]);
-// `hello, ${string}`
-
-const cssUnits = z.enum(["px", "em", "rem", "%"]);
-const css = z.templateLiteral([z.number(), cssUnits ]);
-// `${number}px` | `${number}em` | `${number}rem` | `${number}%`
-
-const email = z.templateLiteral([
-  z.string().min(1),
-  "@",
-  z.string().max(64),
-]);
-// `${string}@${string}` (the min/max refinements are enforced!)
-```
-
 ## Objects
 
 To define an object type:
@@ -950,7 +959,7 @@ Dog.parse({ name: "Yeller", extraKey: true });
 
 To define a *catchall schema* that will be used to validate any unrecognized keys:
 
-```
+```ts z.object
 const DogWithStrings = z.object({
   name: z.string(),
   age: z.number().optional(),
@@ -1020,12 +1029,24 @@ const DogWithBreed = z.extend(Dog, {
 </Tabs>
 
 <Callout>
-  This API can be used to overwrite existing fields! Be careful with this power! 
-  
-  
-  If the two schemas share keys, B will override A.
+  This API can be used to overwrite existing fields! Be careful with this power! If the two schemas share keys, B will override A.
 </Callout>
 
+Despite the existence of the `.extend` API, the recommended way to extend an object schema is to create an entirely new schema by destructuring the original schema's `shape` property.
+
+```ts
+const DogWithBreed = z.object({
+  ...Dog.shape,
+  breed: z.string(),
+});
+```
+
+This is a clean and powerful approach with a lot of advantages. 
+
+1. It uses language-level features ([destructuring syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring)) instead of library-specific APIs
+2. It works in Zod and Zod Mini — no method required
+3. It's more `tsc`-efficient — the `.extend()` method can be expensive on large schemas, and due to [a TypeScript limitation](https://github.com/microsoft/TypeScript/pull/61505) it gets quadratically more expensive when calls are chained
+4. If you wish, you can change the strictness level of the resulting schema by using `z.strictObject()` or `z.looseObject()`
 
 ### `.pick()`
 
@@ -1207,11 +1228,11 @@ Due to TypeScript limitations, recursive type inference can be finicky, and it o
 const Activity = z.object({
   name: z.string(),
   get subactivities() {
-    // ^ ❌ 'subactivities' implicitly has return type 'any' because it does not 
-    // // have a return type annotation and is referenced directly or indirectly 
+    // ^ ❌ 'subactivities' implicitly has return type 'any' because it does not
+    // have a return type annotation and is referenced directly or indirectly
     // in one of its return expressions.ts(7023)
 
-    return z.union([z.null(), Activity]);
+    return z.nullable(z.array(Activity));
   },
 });
 ```
@@ -1221,12 +1242,14 @@ In these cases, you can resolve the error with a type annotation on the offendin
 ```ts
 const Activity = z.object({
   name: z.string(),
-  get subactivities(): z.ZodUnion<[z.ZodNull, typeof Activity]> { // ✅
-    return z.union([z.null(), Activity]); 
+  get subactivities(): z.ZodNullable<z.ZodArray<typeof Activity>> {
+    return z.nullable(z.array(Activity));
   },
 });
 ```
 
+{/* Some general rules of thumb for avoiding circularity  */}
+
 {/* 
 <Accordions>
   <Accordion title="Resolving type errors in recursive schemas">
@@ -1274,7 +1297,7 @@ const Activity = z.object({
       name: z.string(),
       get subactivities() {
         // ^ ❌ 'subactivities' implicitly has return type 'any' because it does not 
-        // // have a return type annotation and is referenced directly or indirectly 
+        // have a return type annotation and is referenced directly or indirectly 
         // in one of its return expressions.ts(7023)
 
         return z.union([z.null(), Activity]);
@@ -1507,10 +1530,10 @@ type c = z.infer<typeof c>; // => number
 This can be useful for intersecting two object types. 
 
 ```ts
-const Person = z.intersection({ name: z.string() });
+const Person = z.object({ name: z.string() });
 type Person = z.infer<typeof Person>;
 
-const Employee = z.intersection({ role: z.string() });
+const Employee = z.object({ role: z.string() });
 type Employee = z.infer<typeof Employee>;
 
 const EmployedPerson = z.intersection(Person, Employee);
@@ -1766,8 +1789,8 @@ By default, validation issues from checks are considered *continuable*; that is,
 <Tab value="Zod">
 ```ts
 const myString = z.string()
-  .refine((val) => val.length > 8)
-  .refine((val) => val === val.toLowerCase());
+  .refine((val) => val.length > 8, { error: "Too short!" })
+  .refine((val) => val === val.toLowerCase(), { error: "Must be lowercase" });
   
 
 const result = myString.safeParse("OH NO");
@@ -1781,8 +1804,8 @@ result.error.issues;
 <Tab value="Zod Mini">
 ```ts zod/v4-mini
 const myString = z.string().check(
-  z.refine((val) => val.length > 8),
-  z.refine((val) => val === val.toLowerCase())
+  z.refine((val) => val.length > 8, { error: "Too short!" }),
+  z.refine((val) => val === val.toLowerCase(), { error: "Must be lowercase" })
 );
 
 const result = z.safeParse(myString, "OH NO");
@@ -1801,8 +1824,8 @@ To mark a particular refinement as *non-continuable*, use the `abort` parameter.
 <Tab value="Zod">
 ```ts
 const myString = z.string()
-  .refine((val) => val.length > 8, { abort: true })
-  .refine((val) => val === val.toLowerCase());
+  .refine((val) => val.length > 8, { error: "Too short!", abort: true })
+  .refine((val) => val === val.toLowerCase(), { error: "Must be lowercase", abort: true });
 
 
 const result = myString.safeParse("OH NO");
@@ -1813,8 +1836,8 @@ result.error!.issues;
 <Tab value="Zod Mini">
 ```ts zod/v4-mini
 const myString = z.string().check(
-  z.refine((val) => val.length > 8, { abort: true }),
-  z.refine((val) => val === val.toLowerCase(), { abort: true })
+  z.refine((val) => val.length > 8, { error: "Too short!", abort: true }),
+  z.refine((val) => val === val.toLowerCase(), { error: "Must be lowercase", abort: true })
 );
 
 const result = z.safeParse(myString, "OH NO");
@@ -2335,7 +2358,7 @@ type Cat = { name: string };
 type Dog = { name: string };
 
 const pluto: Dog = { name: "pluto" };
-const simba: Cat = fido; // works fine
+const simba: Cat = pluto; // works fine
 ```
 
 In some cases, it can be desirable to simulate [nominal typing](https://en.wikipedia.org/wiki/Nominal_type_system) inside TypeScript. This can be achieved with *branded types* (also known as "opaque types").
@@ -2384,7 +2407,7 @@ type ReadonlyUser = z.infer<typeof ReadonlyUser>;
 </Tab>
 </Tabs>
 
-This returns a new schema that wraps the original. The new schema's inferred type will be marked as `readonly`. Note that this only affects objects, arrays, tuples, `Set`, and `Map` in TypeScript:
+The inferred type of the new schemas will be marked as `readonly`. Note that in TypeScript, this only affects objects, arrays, tuples, `Set`, and `Map`:
 
 <Tabs groupId="lib" items={["Zod", "Zod Mini"]}>
 <Tab value="Zod">
@@ -2407,7 +2430,7 @@ z.readonly(z.set(z.string())); // ReadonlySet<string>
 </Tab>
 </Tabs>
 
-Inputs will be parsed using the original schema, then the result will be frozen with [`Object.freeze()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze) to prevent modifications.
+Inputs will be parsed like normal, then the result will be frozen with [`Object.freeze()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze) to prevent modifications.
 
 <Tabs groupId="lib" items={["Zod", "Zod Mini"]}>
 <Tab value="Zod">
@@ -2424,36 +2447,6 @@ result.name = "simba"; // throws TypeError
 </Tab>
 </Tabs>
 
-## Template literals
-
-> **New in Zod 4**
-
-To define a template literal schema:
-
-```ts
-const schema = z.templateLiteral("hello, ", z.string(), "!");
-// `hello, ${string}!`
-```
-
-The `z.templateLiteral` API can handle any number of string literals (e.g. `"hello"`) and schemas. Any schema with an inferred type that's assignable to `string | number | bigint | boolean | null | undefined` can be passed.
-
-```ts
-z.templateLiteral([ "hi there" ]); 
-// `hi there`
-
-z.templateLiteral([ "email: ", z.string()]); 
-// `email: ${string}`
-
-z.templateLiteral([ "high", z.literal(5) ]); 
-// `high5`
-
-z.templateLiteral([ z.nullable(z.literal("grassy")) ]); 
-// `grassy` | `null`
-
-z.templateLiteral([ z.number(), z.enum(["px", "em", "rem"]) ]); 
-// `${number}px` | `${number}em` | `${number}rem`
-```
-
 ## JSON
 
 To validate any JSON-encodable value:
@@ -2524,7 +2517,7 @@ Function schemas have an `.implement()` method which accepts a function and retu
 
 ```ts
 const computeTrimmedLength = MyFunction.implement((input) => {
-  // TypeScript knows x is a string!
+  // TypeScript knows input is a string!
   return input.trim().length;
 });
 
diff --git a/packages/docs/content/error-customization.mdx b/packages/docs/content/error-customization.mdx
index bb5a458e..659e9114 100644
--- a/packages/docs/content/error-customization.mdx
+++ b/packages/docs/content/error-customization.mdx
@@ -353,6 +353,7 @@ The following locales are available:
 - `nl` — Dutch
 - `no` — Norwegian
 - `ota` — Türkî
+- `ps` — Pashto
 - `pl` — Polish
 - `pt` — Portuguese
 - `ru` — Russian
diff --git a/packages/docs/content/json-schema.mdx b/packages/docs/content/json-schema.mdx
index 64a0e4f0..a53334bf 100644
--- a/packages/docs/content/json-schema.mdx
+++ b/packages/docs/content/json-schema.mdx
@@ -289,6 +289,16 @@ z.toJSONSchema(emailSchema);
 </Tab>
 </Tabs>
 
+All metadata fields get copied into the resulting JSON Schema. 
+
+```ts
+const schema = z.string().meta({
+  whatever: 1234
+});
+
+z.toJSONSchema(schema);
+// => { type: "string", whatever: 1234 }
+```
 
 ### `unrepresentable` 
 
diff --git a/packages/docs/content/metadata.mdx b/packages/docs/content/metadata.mdx
index 743c3563..08dff615 100644
--- a/packages/docs/content/metadata.mdx
+++ b/packages/docs/content/metadata.mdx
@@ -79,11 +79,15 @@ For convenience, Zod provides a global registry (`z.globalRegistry`) that can be
 
 ```ts
 export interface GlobalMeta {
-  id?: string;
-  title?: string;
-  description?: string;
-  examples?: T[]; // T is the output type of the schema you are registering
-  [k: string]: unknown; // accepts other properties too
+  id?: string ;
+  title?: string ;
+  description?: string ;
+  example?: unknown ;
+  examples?: 
+    | unknown[] // array-style (JSON Schema)
+    | Record<string, { value: unknown; [k: string]: unknown }>;  // map-style (OpenAPI)
+  deprecated?: boolean ;
+  [k: string]: unknown;
 }
 ```
 
diff --git a/packages/docs/content/packages/core.mdx b/packages/docs/content/packages/core.mdx
index 5ff29a8b..c7dd158e 100644
--- a/packages/docs/content/packages/core.mdx
+++ b/packages/docs/content/packages/core.mdx
@@ -418,7 +418,7 @@ export type $ZodIssue =
   | $ZodIssueCustom;
   ```
 
-For details on each type, refer to [the implementation](https://github.com/colinhacks/zod/blob/v4/packages/core/src/errors.ts).
+For details on each type, refer to [the implementation](https://github.com/colinhacks/zod/blob/main/packages/zod/src/v4/core/errors.ts).
 
 
 {/* ## Best practices
diff --git a/packages/docs/content/v4/index.mdx b/packages/docs/content/v4/index.mdx
index bd318149..f47b6de4 100644
--- a/packages/docs/content/v4/index.mdx
+++ b/packages/docs/content/v4/index.mdx
@@ -750,7 +750,7 @@ strbool.parse("1")            // => true
 strbool.parse("yes")          // => true
 strbool.parse("on")           // => true
 strbool.parse("y")            // => true
-strbool.parse("enable")       // => true
+strbool.parse("enabled")      // => true
 
 strbool.parse("false");       // => false
 strbool.parse("0");           // => false
diff --git a/packages/zod/README.md b/packages/zod/README.md
index 52ba194f..addbb833 100644
--- a/packages/zod/README.md
+++ b/packages/zod/README.md
@@ -138,7 +138,7 @@ When validation fails, the `.parse()` method will throw a `ZodError` instance wi
 try {
   Player.parse({ username: 42, xp: "100" });
 } catch (err) {
-  if (error instanceof z.ZodError) {
+  if (err instanceof z.ZodError) {
     err.issues;
     /* [
       {
diff --git a/packages/zod/package.json b/packages/zod/package.json
index bdf658b2..09344fc2 100644
--- a/packages/zod/package.json
+++ b/packages/zod/package.json
@@ -1,6 +1,6 @@
 {
   "name": "zod",
-  "version": "3.25.46",
+  "version": "3.25.57",
   "type": "module",
   "author": "Colin McDonnell <zod@colinhacks.com>",
   "description": "TypeScript-first schema declaration and validation library with static type inference",
diff --git a/packages/zod/src/v4/classic/coerce.ts b/packages/zod/src/v4/classic/coerce.ts
index c5cf0c62..9549d6b5 100644
--- a/packages/zod/src/v4/classic/coerce.ts
+++ b/packages/zod/src/v4/classic/coerce.ts
@@ -1,27 +1,27 @@
 import * as core from "zod/v4/core";
 import * as schemas from "./schemas.js";
 
-export interface ZodCoercedString<T = unknown> extends schemas._ZodString<T> {}
+export interface ZodCoercedString<T = unknown> extends schemas._ZodString<core.$ZodStringInternals<T>> {}
 export function string<T = unknown>(params?: string | core.$ZodStringParams): ZodCoercedString<T> {
   return core._coercedString(schemas.ZodString, params) as any;
 }
 
-export interface ZodCoercedNumber<T = unknown> extends schemas._ZodNumber<T> {}
+export interface ZodCoercedNumber<T = unknown> extends schemas._ZodNumber<core.$ZodNumberInternals<T>> {}
 export function number<T = unknown>(params?: string | core.$ZodNumberParams): ZodCoercedNumber<T> {
   return core._coercedNumber(schemas.ZodNumber, params) as ZodCoercedNumber<T>;
 }
 
-export interface ZodCoercedBoolean<T = unknown> extends schemas._ZodBoolean<T> {}
+export interface ZodCoercedBoolean<T = unknown> extends schemas._ZodBoolean<core.$ZodBooleanInternals<T>> {}
 export function boolean<T = unknown>(params?: string | core.$ZodBooleanParams): ZodCoercedBoolean<T> {
   return core._coercedBoolean(schemas.ZodBoolean, params) as ZodCoercedBoolean<T>;
 }
 
-export interface ZodCoercedBigInt<T = unknown> extends schemas._ZodBigInt<T> {}
+export interface ZodCoercedBigInt<T = unknown> extends schemas._ZodBigInt<core.$ZodBigIntInternals<T>> {}
 export function bigint<T = unknown>(params?: string | core.$ZodBigIntParams): ZodCoercedBigInt<T> {
   return core._coercedBigint(schemas.ZodBigInt, params) as ZodCoercedBigInt<T>;
 }
 
-export interface ZodCoercedDate<T = unknown> extends schemas._ZodDate<T> {}
+export interface ZodCoercedDate<T = unknown> extends schemas._ZodDate<core.$ZodDateInternals<T>> {}
 export function date<T = unknown>(params?: string | core.$ZodDateParams): ZodCoercedDate<T> {
   return core._coercedDate(schemas.ZodDate, params) as ZodCoercedDate<T>;
 }
diff --git a/packages/zod/src/v4/classic/schemas.ts b/packages/zod/src/v4/classic/schemas.ts
index 84711961..b1cb77f6 100644
--- a/packages/zod/src/v4/classic/schemas.ts
+++ b/packages/zod/src/v4/classic/schemas.ts
@@ -17,17 +17,24 @@ export interface RefinementCtx<T = unknown> extends core.ParsePayload<T> {
   addIssue(arg: string | core.$ZodRawIssue | Partial<core.$ZodIssueCustom>): void;
 }
 
-export interface ZodType<out Output = unknown, out Input = unknown> extends core.$ZodType<Output, Input> {
-  def: this["_zod"]["def"];
+export interface ZodType<
+  out Output = unknown,
+  out Input = unknown,
+  out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>,
+> extends core.$ZodType<Output, Input, Internals> {
+  def: Internals["def"];
+  type: Internals["def"]["type"];
+
   /** @deprecated Use `.def` instead. */
-  _def: this["_zod"]["def"];
-  // /** @deprecated Use `z.output<typeof schema>` instead. */
-  _output: core.output<this>;
-  // /** @deprecated Use `z.input<typeof schema>` instead. */
-  _input: core.input<this>;
+  _def: Internals["def"];
+  /** @deprecated Use `z.output<typeof schema>` instead. */
+  _output: Internals["output"];
+  /** @deprecated Use `z.input<typeof schema>` instead. */
+  _input: Internals["input"];
+
   // base methods
   check(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;
-  clone(def?: this["_zod"]["def"], params?: { parent: boolean }): this;
+  clone(def?: Internals["def"], params?: { parent: boolean }): this;
   register<R extends core.$ZodRegistry>(
     registry: R,
     ...meta: this extends R["_schema"]
@@ -65,13 +72,13 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
   nonoptional(params?: string | core.$ZodNonOptionalParams): ZodNonOptional<this>;
   nullable(): ZodNullable<this>;
   nullish(): ZodOptional<ZodNullable<this>>;
-  default(def: util.NoUndefined<core.output<this>>): ZodDefault<this>;
+  default(def: core.output<this>): ZodDefault<this>;
   default(def: () => util.NoUndefined<core.output<this>>): ZodDefault<this>;
   prefault(def: () => core.input<this>): ZodPrefault<this>;
   prefault(def: core.input<this>): ZodPrefault<this>;
   array(): ZodArray<this>;
-  or<T extends core.$ZodType>(option: T): ZodUnion<[this, T]>;
-  and<T extends core.$ZodType>(incoming: T): ZodIntersection<this, T>;
+  or<T extends core.SomeType>(option: T): ZodUnion<[this, T]>;
+  and<T extends core.SomeType>(incoming: T): ZodIntersection<this, T>;
   transform<NewOut>(
     transform: (arg: core.output<this>, ctx: RefinementCtx<core.output<this>>) => NewOut | Promise<NewOut>
   ): ZodPipe<this, ZodTransform<Awaited<NewOut>, core.output<this>>>;
@@ -110,6 +117,9 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
   isNullable(): boolean;
 }
 
+export interface _ZodType<out Internals extends core.$ZodTypeInternals = core.$ZodTypeInternals>
+  extends ZodType<any, any, Internals> {}
+
 export const ZodType: core.$constructor<ZodType> = /*@__PURE__*/ core.$constructor("ZodType", (inst, def) => {
   core.$ZodType.init(inst, def);
   inst.def = def;
@@ -193,16 +203,12 @@ export const ZodType: core.$constructor<ZodType> = /*@__PURE__*/ core.$construct
 });
 
 // ZodString
-export interface _ZodString<Input = unknown> extends ZodType {
-  _zod: core.$ZodStringInternals<Input>;
-
+export interface _ZodString<T extends core.$ZodStringInternals<unknown> = core.$ZodStringInternals<unknown>>
+  extends _ZodType<T> {
   format: string | null;
   minLength: number | null;
   maxLength: number | null;
 
-  // /** @deprecated Use `z.jsonString()` instead. */
-  // json(params?: string | core.$ZodCheckJSONStringParams): this;
-
   // miscellaneous checks
   regex(regex: RegExp, params?: string | core.$ZodCheckRegexParams): this;
   includes(value: string, params?: core.$ZodCheckIncludesParams): this;
@@ -251,11 +257,9 @@ export const _ZodString: core.$constructor<_ZodString> = /*@__PURE__*/ core.$con
   inst.toUpperCase = () => inst.check(checks.toUpperCase());
 });
 
-export interface ZodString extends _ZodString<string> {
+export interface ZodString extends _ZodString<core.$ZodStringInternals<string>> {
   // string format checks
-  // email(): ZodString;
-  // email(params?: string): ZodString;
-  // email(params?: StringFormatParams): ZodString;
+
   /** @deprecated Use `z.email()` instead. */
   email(params?: string | core.$ZodCheckEmailParams): this;
   /** @deprecated Use `z.url()` instead. */
@@ -366,9 +370,8 @@ export function string(params?: string | core.$ZodStringParams): ZodString {
 }
 
 // ZodStringFormat
-export interface ZodStringFormat<Format extends core.$ZodStringFormats = core.$ZodStringFormats> extends _ZodString {
-  _zod: core.$ZodStringFormatInternals<Format>;
-}
+export interface ZodStringFormat<Format extends core.$ZodStringFormats = core.$ZodStringFormats>
+  extends _ZodString<core.$ZodStringFormatInternals<Format>> {}
 export const ZodStringFormat: core.$constructor<ZodStringFormat> = /*@__PURE__*/ core.$constructor(
   "ZodStringFormat",
   (inst, def) => {
@@ -672,9 +675,8 @@ export function jwt(params?: string | core.$ZodJWTParams): ZodJWT {
 }
 
 // ZodNumber
-export interface _ZodNumber<Input = unknown> extends ZodType {
-  _zod: core.$ZodNumberInternals<Input>;
-
+export interface _ZodNumber<Internals extends core.$ZodNumberInternals = core.$ZodNumberInternals>
+  extends _ZodType<Internals> {
   gt(value: number, params?: string | core.$ZodCheckGreaterThanParams): this;
   /** Identical to .min() */
   gte(value: number, params?: string | core.$ZodCheckGreaterThanParams): this;
@@ -707,7 +709,7 @@ export interface _ZodNumber<Input = unknown> extends ZodType {
   format: string | null;
 }
 
-export interface ZodNumber extends _ZodNumber<number> {}
+export interface ZodNumber extends _ZodNumber<core.$ZodNumberInternals<number>> {}
 
 export const ZodNumber: core.$constructor<ZodNumber> = /*@__PURE__*/ core.$constructor("ZodNumber", (inst, def) => {
   core.$ZodNumber.init(inst, def);
@@ -788,10 +790,8 @@ export function uint32(params?: string | core.$ZodCheckNumberFormatParams): ZodU
 }
 
 // boolean
-export interface _ZodBoolean<T = unknown> extends ZodType {
-  _zod: core.$ZodBooleanInternals<T>;
-}
-export interface ZodBoolean extends _ZodBoolean<boolean> {}
+export interface _ZodBoolean<T extends core.$ZodBooleanInternals = core.$ZodBooleanInternals> extends _ZodType<T> {}
+export interface ZodBoolean extends _ZodBoolean<core.$ZodBooleanInternals<boolean>> {}
 export const ZodBoolean: core.$constructor<ZodBoolean> = /*@__PURE__*/ core.$constructor("ZodBoolean", (inst, def) => {
   core.$ZodBoolean.init(inst, def);
   ZodType.init(inst, def);
@@ -802,9 +802,7 @@ export function boolean(params?: string | core.$ZodBooleanParams): ZodBoolean {
 }
 
 // bigint
-export interface _ZodBigInt<T = unknown> extends ZodType {
-  _zod: core.$ZodBigIntInternals<T>;
-
+export interface _ZodBigInt<T extends core.$ZodBigIntInternals = core.$ZodBigIntInternals> extends _ZodType<T> {
   gte(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
   /** Alias of `.gte()` */
   min(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
@@ -824,7 +822,7 @@ export interface _ZodBigInt<T = unknown> extends ZodType {
   format: string | null;
 }
 
-export interface ZodBigInt extends _ZodBigInt<bigint> {}
+export interface ZodBigInt extends _ZodBigInt<core.$ZodBigIntInternals<bigint>> {}
 export const ZodBigInt: core.$constructor<ZodBigInt> = /*@__PURE__*/ core.$constructor("ZodBigInt", (inst, def) => {
   core.$ZodBigInt.init(inst, def);
   ZodType.init(inst, def);
@@ -877,9 +875,7 @@ export function uint64(params?: string | core.$ZodBigIntFormatParams): ZodBigInt
 }
 
 // symbol
-export interface ZodSymbol extends ZodType {
-  _zod: core.$ZodSymbolInternals;
-}
+export interface ZodSymbol extends _ZodType<core.$ZodSymbolInternals> {}
 export const ZodSymbol: core.$constructor<ZodSymbol> = /*@__PURE__*/ core.$constructor("ZodSymbol", (inst, def) => {
   core.$ZodSymbol.init(inst, def);
   ZodType.init(inst, def);
@@ -890,9 +886,7 @@ export function symbol(params?: string | core.$ZodSymbolParams): ZodSymbol {
 }
 
 // ZodUndefined
-export interface ZodUndefined extends ZodType {
-  _zod: core.$ZodUndefinedInternals;
-}
+export interface ZodUndefined extends _ZodType<core.$ZodUndefinedInternals> {}
 export const ZodUndefined: core.$constructor<ZodUndefined> = /*@__PURE__*/ core.$constructor(
   "ZodUndefined",
   (inst, def) => {
@@ -907,9 +901,7 @@ function _undefined(params?: string | core.$ZodUndefinedParams): ZodUndefined {
 export { _undefined as undefined };
 
 // ZodNull
-export interface ZodNull extends ZodType {
-  _zod: core.$ZodNullInternals;
-}
+export interface ZodNull extends _ZodType<core.$ZodNullInternals> {}
 export const ZodNull: core.$constructor<ZodNull> = /*@__PURE__*/ core.$constructor("ZodNull", (inst, def) => {
   core.$ZodNull.init(inst, def);
   ZodType.init(inst, def);
@@ -921,9 +913,7 @@ function _null(params?: string | core.$ZodNullParams): ZodNull {
 export { _null as null };
 
 // ZodAny
-export interface ZodAny extends ZodType {
-  _zod: core.$ZodAnyInternals;
-}
+export interface ZodAny extends _ZodType<core.$ZodAnyInternals> {}
 export const ZodAny: core.$constructor<ZodAny> = /*@__PURE__*/ core.$constructor("ZodAny", (inst, def) => {
   core.$ZodAny.init(inst, def);
   ZodType.init(inst, def);
@@ -934,9 +924,7 @@ export function any(): ZodAny {
 }
 
 // ZodUnknown
-export interface ZodUnknown extends ZodType {
-  _zod: core.$ZodUnknownInternals;
-}
+export interface ZodUnknown extends _ZodType<core.$ZodUnknownInternals> {}
 export const ZodUnknown: core.$constructor<ZodUnknown> = /*@__PURE__*/ core.$constructor("ZodUnknown", (inst, def) => {
   core.$ZodUnknown.init(inst, def);
   ZodType.init(inst, def);
@@ -947,9 +935,7 @@ export function unknown(): ZodUnknown {
 }
 
 // ZodNever
-export interface ZodNever extends ZodType {
-  _zod: core.$ZodNeverInternals;
-}
+export interface ZodNever extends _ZodType<core.$ZodNeverInternals> {}
 export const ZodNever: core.$constructor<ZodNever> = /*@__PURE__*/ core.$constructor("ZodNever", (inst, def) => {
   core.$ZodNever.init(inst, def);
   ZodType.init(inst, def);
@@ -960,9 +946,7 @@ export function never(params?: string | core.$ZodNeverParams): ZodNever {
 }
 
 // ZodVoid
-export interface ZodVoid extends ZodType {
-  _zod: core.$ZodVoidInternals;
-}
+export interface ZodVoid extends _ZodType<core.$ZodVoidInternals> {}
 export const ZodVoid: core.$constructor<ZodVoid> = /*@__PURE__*/ core.$constructor("ZodVoid", (inst, def) => {
   core.$ZodVoid.init(inst, def);
   ZodType.init(inst, def);
@@ -974,9 +958,7 @@ function _void(params?: string | core.$ZodVoidParams): ZodVoid {
 export { _void as void };
 
 // ZodDate
-export interface _ZodDate<T = unknown> extends ZodType {
-  _zod: core.$ZodDateInternals<T>;
-
+export interface _ZodDate<T extends core.$ZodDateInternals = core.$ZodDateInternals> extends _ZodType<T> {
   min(value: number | Date, params?: string | core.$ZodCheckGreaterThanParams): this;
   max(value: number | Date, params?: string | core.$ZodCheckLessThanParams): this;
 
@@ -986,7 +968,7 @@ export interface _ZodDate<T = unknown> extends ZodType {
   maxDate: Date | null;
 }
 
-export interface ZodDate extends _ZodDate<Date> {}
+export interface ZodDate extends _ZodDate<core.$ZodDateInternals<Date>> {}
 export const ZodDate: core.$constructor<ZodDate> = /*@__PURE__*/ core.$constructor("ZodDate", (inst, def) => {
   core.$ZodDate.init(inst, def);
   ZodType.init(inst, def);
@@ -1004,9 +986,9 @@ export function date(params?: string | core.$ZodDateParams): ZodDate {
 }
 
 // ZodArray
-export interface ZodArray<T extends core.$ZodType = core.$ZodType> extends ZodType {
-  _zod: core.$ZodArrayInternals<T>;
-
+export interface ZodArray<T extends core.SomeType = core.$ZodType>
+  extends _ZodType<core.$ZodArrayInternals<T>>,
+    core.$ZodArray<T> {
   element: T;
   min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
   nonempty(params?: string | core.$ZodCheckMinLengthParams): this;
@@ -1028,8 +1010,8 @@ export const ZodArray: core.$constructor<ZodArray> = /*@__PURE__*/ core.$constru
   inst.unwrap = () => inst.element;
 });
 
-export function array<T extends core.$ZodType>(element: T, params?: string | core.$ZodArrayParams): ZodArray<T> {
-  return core._array(ZodArray, element, params) as any;
+export function array<T extends core.SomeType>(element: T, params?: string | core.$ZodArrayParams): ZodArray<T> {
+  return core._array(ZodArray, element as any, params) as any;
 }
 
 // .keyof
@@ -1044,13 +1026,13 @@ export interface ZodObject<
   /** @ts-ignore Cast variance */
   out Shape extends core.$ZodShape = core.$ZodLooseShape,
   out Config extends core.$ZodObjectConfig = core.$ZodObjectConfig,
-> extends ZodType {
-  _zod: core.$ZodObjectInternals<Shape, Config>;
+> extends _ZodType<core.$ZodObjectInternals<Shape, Config>>,
+    core.$ZodObject<Shape, Config> {
   shape: Shape;
 
   keyof(): ZodEnum<util.ToEnum<keyof Shape & string>>;
   /** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
-  catchall<T extends core.$ZodType>(schema: T): ZodObject<Shape, core.$catchall<T>>;
+  catchall<T extends core.SomeType>(schema: T): ZodObject<Shape, core.$catchall<T>>;
 
   /** @deprecated Use `z.looseObject()` or `.loose()` instead. */
   passthrough(): ZodObject<Shape, core.$loose>;
@@ -1063,7 +1045,7 @@ export interface ZodObject<
   /** This is the default behavior. This method call is likely unnecessary. */
   strip(): ZodObject<Shape, core.$strict>;
 
-  extend<U extends core.$ZodLooseShape & Partial<Record<keyof Shape, core.$ZodType>>>(
+  extend<U extends core.$ZodLooseShape & Partial<Record<keyof Shape, core.SomeType>>>(
     shape: U
   ): ZodObject<util.Extend<Shape, U>, Config>;
 
@@ -1130,7 +1112,7 @@ export const ZodObject: core.$constructor<ZodObject> = /*@__PURE__*/ core.$const
     return Object.fromEntries(Object.entries(inst._zod.def.shape));
   });
   inst.keyof = () => _enum(Object.keys(inst._zod.def.shape)) as any;
-  inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall }) as any;
+  inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall: catchall as any as core.$ZodType }) as any;
   inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
   // inst.nonstrict = () => inst.clone({ ...inst._zod.def, catchall: api.unknown() });
   inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
@@ -1147,10 +1129,10 @@ export const ZodObject: core.$constructor<ZodObject> = /*@__PURE__*/ core.$const
   inst.required = (...args: any[]) => util.required(ZodNonOptional, inst, args[0] as object);
 });
 
-export function object<T extends core.$ZodLooseShape = Partial<Record<never, core.$ZodType>>>(
+export function object<T extends core.$ZodLooseShape = Partial<Record<never, core.SomeType>>>(
   shape?: T,
   params?: string | core.$ZodObjectParams
-): ZodObject<util.Writeable<T> & {}, core.$strip> {
+): ZodObject<util.Writeable<T>, core.$strip> {
   const def: core.$ZodObjectDef = {
     type: "object",
     get shape() {
@@ -1170,12 +1152,10 @@ export function strictObject<T extends core.$ZodLooseShape>(
 ): ZodObject<T, core.$strict> {
   return new ZodObject({
     type: "object",
-
     get shape() {
       util.assignProp(this, "shape", { ...shape });
       return this.shape;
     },
-
     catchall: never(),
     ...util.normalizeParams(params),
   }) as any;
@@ -1189,20 +1169,19 @@ export function looseObject<T extends core.$ZodLooseShape>(
 ): ZodObject<T, core.$loose> {
   return new ZodObject({
     type: "object",
-
     get shape() {
       util.assignProp(this, "shape", { ...shape });
       return this.shape;
     },
-
     catchall: unknown(),
     ...util.normalizeParams(params),
   }) as any;
 }
 
 // ZodUnion
-export interface ZodUnion<T extends readonly core.$ZodType[] = readonly core.$ZodType[]> extends ZodType {
-  _zod: core.$ZodUnionInternals<T>;
+export interface ZodUnion<T extends readonly core.SomeType[] = readonly core.$ZodType[]>
+  extends _ZodType<core.$ZodUnionInternals<T>>,
+    core.$ZodUnion<T> {
   options: T;
 }
 export const ZodUnion: core.$constructor<ZodUnion> = /*@__PURE__*/ core.$constructor("ZodUnion", (inst, def) => {
@@ -1211,20 +1190,21 @@ export const ZodUnion: core.$constructor<ZodUnion> = /*@__PURE__*/ core.$constru
   inst.options = def.options;
 });
 
-export function union<const T extends readonly core.$ZodType[]>(
+export function union<const T extends readonly core.SomeType[]>(
   options: T,
   params?: string | core.$ZodUnionParams
 ): ZodUnion<T> {
   return new ZodUnion({
     type: "union",
-    options,
+    options: options as any as core.$ZodType[],
     ...util.normalizeParams(params),
-  }) as ZodUnion<T>;
+  }) as any;
 }
 
 // ZodDiscriminatedUnion
-export interface ZodDiscriminatedUnion<Options extends readonly core.$ZodType[] = readonly core.$ZodType[]>
-  extends ZodUnion<Options> {
+export interface ZodDiscriminatedUnion<Options extends readonly core.SomeType[] = readonly core.$ZodType[]>
+  extends ZodUnion<Options>,
+    core.$ZodDiscriminatedUnion<Options> {
   _zod: core.$ZodDiscriminatedUnionInternals<Options>;
 }
 export const ZodDiscriminatedUnion: core.$constructor<ZodDiscriminatedUnion> = /*@__PURE__*/ core.$constructor(
@@ -1252,10 +1232,9 @@ export function discriminatedUnion<
 }
 
 // ZodIntersection
-export interface ZodIntersection<A extends core.$ZodType = core.$ZodType, B extends core.$ZodType = core.$ZodType>
-  extends ZodType {
-  _zod: core.$ZodIntersectionInternals<A, B>;
-}
+export interface ZodIntersection<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType>
+  extends _ZodType<core.$ZodIntersectionInternals<A, B>>,
+    core.$ZodIntersection<A, B> {}
 export const ZodIntersection: core.$constructor<ZodIntersection> = /*@__PURE__*/ core.$constructor(
   "ZodIntersection",
   (inst, def) => {
@@ -1264,24 +1243,24 @@ export const ZodIntersection: core.$constructor<ZodIntersection> = /*@__PURE__*/
   }
 );
 
-export function intersection<T extends core.$ZodType, U extends core.$ZodType>(
+export function intersection<T extends core.SomeType, U extends core.SomeType>(
   left: T,
   right: U
 ): ZodIntersection<T, U> {
   return new ZodIntersection({
     type: "intersection",
-    left,
-    right,
-  }) as ZodIntersection<T, U>;
+    left: left as any as core.$ZodType,
+    right: right as any as core.$ZodType,
+  }) as any;
 }
 
 // ZodTuple
 export interface ZodTuple<
-  T extends util.TupleItems = util.TupleItems,
-  Rest extends core.$ZodType | null = core.$ZodType | null,
-> extends ZodType {
-  _zod: core.$ZodTupleInternals<T, Rest>;
-  rest<Rest extends core.$ZodType>(rest: Rest): ZodTuple<T, Rest>;
+  T extends util.TupleItems = readonly core.$ZodType[],
+  Rest extends core.SomeType | null = core.$ZodType | null,
+> extends _ZodType<core.$ZodTupleInternals<T, Rest>>,
+    core.$ZodTuple<T, Rest> {
+  rest<Rest extends core.SomeType = core.$ZodType>(rest: Rest): ZodTuple<T, Rest>;
 }
 export const ZodTuple: core.$constructor<ZodTuple> = /*@__PURE__*/ core.$constructor("ZodTuple", (inst, def) => {
   core.$ZodTuple.init(inst, def);
@@ -1289,23 +1268,23 @@ export const ZodTuple: core.$constructor<ZodTuple> = /*@__PURE__*/ core.$constru
   inst.rest = (rest) =>
     inst.clone({
       ...inst._zod.def,
-      rest,
+      rest: rest as any as core.$ZodType,
     }) as any;
 });
 
-export function tuple<T extends readonly [core.$ZodType, ...core.$ZodType[]]>(
+export function tuple<T extends readonly [core.SomeType, ...core.SomeType[]]>(
   items: T,
   params?: string | core.$ZodTupleParams
 ): ZodTuple<T, null>;
-export function tuple<T extends readonly [core.$ZodType, ...core.$ZodType[]], Rest extends core.$ZodType>(
+export function tuple<T extends readonly [core.SomeType, ...core.SomeType[]], Rest extends core.SomeType>(
   items: T,
   rest: Rest,
   params?: string | core.$ZodTupleParams
 ): ZodTuple<T, Rest>;
 export function tuple(items: [], params?: string | core.$ZodTupleParams): ZodTuple<[], null>;
 export function tuple(
-  items: core.$ZodType[],
-  _paramsOrRest?: string | core.$ZodTupleParams | core.$ZodType,
+  items: core.SomeType[],
+  _paramsOrRest?: string | core.$ZodTupleParams | core.SomeType,
   _params?: string | core.$ZodTupleParams
 ) {
   const hasRest = _paramsOrRest instanceof core.$ZodType;
@@ -1313,7 +1292,7 @@ export function tuple(
   const rest = hasRest ? _paramsOrRest : null;
   return new ZodTuple({
     type: "tuple",
-    items,
+    items: items as any as core.$ZodType[],
     rest,
     ...util.normalizeParams(params),
   });
@@ -1322,9 +1301,9 @@ export function tuple(
 // ZodRecord
 export interface ZodRecord<
   Key extends core.$ZodRecordKey = core.$ZodRecordKey,
-  Value extends core.$ZodType = core.$ZodType,
-> extends ZodType {
-  _zod: core.$ZodRecordInternals<Key, Value>;
+  Value extends core.SomeType = core.$ZodType,
+> extends _ZodType<core.$ZodRecordInternals<Key, Value>>,
+    core.$ZodRecord<Key, Value> {
   keyType: Key;
   valueType: Value;
 }
@@ -1336,7 +1315,7 @@ export const ZodRecord: core.$constructor<ZodRecord> = /*@__PURE__*/ core.$const
   inst.valueType = def.valueType;
 });
 
-export function record<Key extends core.$ZodRecordKey, Value extends core.$ZodType>(
+export function record<Key extends core.$ZodRecordKey, Value extends core.SomeType>(
   keyType: Key,
   valueType: Value,
   params?: string | core.$ZodRecordParams
@@ -1344,12 +1323,12 @@ export function record<Key extends core.$ZodRecordKey, Value extends core.$ZodTy
   return new ZodRecord({
     type: "record",
     keyType,
-    valueType,
+    valueType: valueType as any as core.$ZodType,
     ...util.normalizeParams(params),
-  }) as ZodRecord<Key, Value>;
+  }) as any;
 }
-
-export function partialRecord<Key extends core.$ZodRecordKey, Value extends core.$ZodType>(
+// type alksjf = core.output<core.$ZodRecordKey>;
+export function partialRecord<Key extends core.$ZodRecordKey, Value extends core.SomeType>(
   keyType: Key,
   valueType: Value,
   params?: string | core.$ZodRecordParams
@@ -1357,16 +1336,15 @@ export function partialRecord<Key extends core.$ZodRecordKey, Value extends core
   return new ZodRecord({
     type: "record",
     keyType: union([keyType, never()]),
-    valueType,
+    valueType: valueType as any as core.$ZodType,
     ...util.normalizeParams(params),
-  }) as ZodRecord<ZodUnion<[Key, ZodNever]>, Value>;
+  }) as any;
 }
 
 // ZodMap
-export interface ZodMap<Key extends core.$ZodType = core.$ZodType, Value extends core.$ZodType = core.$ZodType>
-  extends ZodType {
-  _zod: core.$ZodMapInternals<Key, Value>;
-
+export interface ZodMap<Key extends core.SomeType = core.$ZodType, Value extends core.SomeType = core.$ZodType>
+  extends _ZodType<core.$ZodMapInternals<Key, Value>>,
+    core.$ZodMap<Key, Value> {
   keyType: Key;
   valueType: Value;
 }
@@ -1377,22 +1355,23 @@ export const ZodMap: core.$constructor<ZodMap> = /*@__PURE__*/ core.$constructor
   inst.valueType = def.valueType;
 });
 
-export function map<Key extends core.$ZodType, Value extends core.$ZodType>(
+export function map<Key extends core.SomeType, Value extends core.SomeType>(
   keyType: Key,
   valueType: Value,
   params?: string | core.$ZodMapParams
 ): ZodMap<Key, Value> {
   return new ZodMap({
     type: "map",
-    keyType,
-    valueType,
+    keyType: keyType as any as core.$ZodType,
+    valueType: valueType as any as core.$ZodType,
     ...util.normalizeParams(params),
-  }) as ZodMap<Key, Value>;
+  }) as any;
 }
 
 // ZodSet
-export interface ZodSet<T extends core.$ZodType = core.$ZodType> extends ZodType {
-  _zod: core.$ZodSetInternals<T>;
+export interface ZodSet<T extends core.SomeType = core.$ZodType>
+  extends _ZodType<core.$ZodSetInternals<T>>,
+    core.$ZodSet<T> {
   min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
   /** */
   nonempty(params?: string | core.$ZodCheckMinSizeParams): this;
@@ -1409,22 +1388,23 @@ export const ZodSet: core.$constructor<ZodSet> = /*@__PURE__*/ core.$constructor
   inst.size = (...args) => inst.check(core._size(...args));
 });
 
-export function set<Value extends core.$ZodType>(
+export function set<Value extends core.SomeType>(
   valueType: Value,
   params?: string | core.$ZodSetParams
 ): ZodSet<Value> {
   return new ZodSet({
     type: "set",
-    valueType,
+    valueType: valueType as any as core.$ZodType,
     ...util.normalizeParams(params),
-  }) as ZodSet<Value>;
+  }) as any;
 }
 
 // ZodEnum
-// @ts
-export interface ZodEnum<T extends util.EnumLike = util.EnumLike> extends ZodType {
-  _zod: core.$ZodEnumInternals<T>;
-
+export interface ZodEnum<
+  /** @ts-ignore Cast variance */
+  out T extends util.EnumLike = util.EnumLike,
+> extends _ZodType<core.$ZodEnumInternals<T>>,
+    core.$ZodEnum<T> {
   enum: T;
   options: Array<T[keyof T]>;
 
@@ -1509,8 +1489,9 @@ export function nativeEnum<T extends util.EnumLike>(entries: T, params?: string
 }
 
 // ZodLiteral
-export interface ZodLiteral<T extends util.Primitive = util.Primitive> extends ZodType {
-  _zod: core.$ZodLiteralInternals<T>;
+export interface ZodLiteral<T extends util.Primitive = util.Primitive>
+  extends _ZodType<core.$ZodLiteralInternals<T>>,
+    core.$ZodLiteral<T> {
   values: Set<T>;
   /** @legacy Use `.values` instead. Accessing this property will throw an error if the literal accepts multiple values. */
   value: T;
@@ -1529,7 +1510,7 @@ export const ZodLiteral: core.$constructor<ZodLiteral> = /*@__PURE__*/ core.$con
   });
 });
 
-export function literal<const T extends Array<util.Literal>>(
+export function literal<const T extends ReadonlyArray<util.Literal>>(
   value: T,
   params?: string | core.$ZodLiteralParams
 ): ZodLiteral<T[number]>;
@@ -1546,9 +1527,7 @@ export function literal(value: any, params: any) {
 }
 
 // ZodFile
-export interface ZodFile extends ZodType {
-  _zod: core.$ZodFileInternals;
-
+export interface ZodFile extends _ZodType<core.$ZodFileInternals>, core.$ZodFile {
   min(size: number, params?: string | core.$ZodCheckMinSizeParams): this;
   max(size: number, params?: string | core.$ZodCheckMaxSizeParams): this;
   mime(types: util.MimeTypes | Array<util.MimeTypes>, params?: string | core.$ZodCheckMimeTypeParams): this;
@@ -1567,9 +1546,9 @@ export function file(params?: string | core.$ZodFileParams): ZodFile {
 }
 
 // ZodTransform
-export interface ZodTransform<O = unknown, I = unknown> extends ZodType {
-  _zod: core.$ZodTransformInternals<O, I>;
-}
+export interface ZodTransform<O = unknown, I = unknown>
+  extends _ZodType<core.$ZodTransformInternals<O, I>>,
+    core.$ZodTransform<O, I> {}
 export const ZodTransform: core.$constructor<ZodTransform> = /*@__PURE__*/ core.$constructor(
   "ZodTransform",
   (inst, def) => {
@@ -1616,9 +1595,9 @@ export function transform<I = unknown, O = I>(
 }
 
 // ZodOptional
-export interface ZodOptional<T extends core.$ZodType = core.$ZodType> extends ZodType {
-  _zod: core.$ZodOptionalInternals<T>;
-
+export interface ZodOptional<T extends core.SomeType = core.$ZodType>
+  extends _ZodType<core.$ZodOptionalInternals<T>>,
+    core.$ZodOptional<T> {
   unwrap(): T;
 }
 export const ZodOptional: core.$constructor<ZodOptional> = /*@__PURE__*/ core.$constructor(
@@ -1631,17 +1610,17 @@ export const ZodOptional: core.$constructor<ZodOptional> = /*@__PURE__*/ core.$c
   }
 );
 
-export function optional<T extends core.$ZodType>(innerType: T): ZodOptional<T> {
+export function optional<T extends core.SomeType>(innerType: T): ZodOptional<T> {
   return new ZodOptional({
     type: "optional",
-    innerType,
-  }) as ZodOptional<T>;
+    innerType: innerType as any as core.$ZodType,
+  }) as any;
 }
 
 // ZodNullable
-export interface ZodNullable<T extends core.$ZodType = core.$ZodType> extends ZodType {
-  _zod: core.$ZodNullableInternals<T>;
-
+export interface ZodNullable<T extends core.SomeType = core.$ZodType>
+  extends _ZodType<core.$ZodNullableInternals<T>>,
+    core.$ZodNullable<T> {
   unwrap(): T;
 }
 export const ZodNullable: core.$constructor<ZodNullable> = /*@__PURE__*/ core.$constructor(
@@ -1654,22 +1633,22 @@ export const ZodNullable: core.$constructor<ZodNullable> = /*@__PURE__*/ core.$c
   }
 );
 
-export function nullable<T extends core.$ZodType>(innerType: T): ZodNullable<T> {
+export function nullable<T extends core.SomeType>(innerType: T): ZodNullable<T> {
   return new ZodNullable({
     type: "nullable",
-    innerType,
-  }) as ZodNullable<T>;
+    innerType: innerType as any as core.$ZodType,
+  }) as any;
 }
 
 // nullish
-export function nullish<T extends core.$ZodType>(innerType: T): ZodOptional<ZodNullable<T>> {
+export function nullish<T extends core.SomeType>(innerType: T): ZodOptional<ZodNullable<T>> {
   return optional(nullable(innerType));
 }
 
 // ZodDefault
-export interface ZodDefault<T extends core.$ZodType = core.$ZodType> extends ZodType {
-  _zod: core.$ZodDefaultInternals<T>;
-
+export interface ZodDefault<T extends core.SomeType = core.$ZodType>
+  extends _ZodType<core.$ZodDefaultInternals<T>>,
+    core.$ZodDefault<T> {
   unwrap(): T;
   /** @deprecated Use `.unwrap()` instead. */
   removeDefault(): T;
@@ -1682,22 +1661,23 @@ export const ZodDefault: core.$constructor<ZodDefault> = /*@__PURE__*/ core.$con
   inst.removeDefault = inst.unwrap;
 });
 
-export function _default<T extends core.$ZodType>(
+export function _default<T extends core.SomeType>(
   innerType: T,
   defaultValue: util.NoUndefined<core.output<T>> | (() => util.NoUndefined<core.output<T>>)
 ): ZodDefault<T> {
   return new ZodDefault({
     type: "default",
-    innerType,
+    innerType: innerType as any as core.$ZodType,
     get defaultValue() {
       return typeof defaultValue === "function" ? (defaultValue as Function)() : defaultValue;
     },
-  }) as any as ZodDefault<T>;
+  }) as any;
 }
 
 // ZodPrefault
-export interface ZodPrefault<T extends core.$ZodType = core.$ZodType> extends ZodType {
-  _zod: core.$ZodPrefaultInternals<T>;
+export interface ZodPrefault<T extends core.SomeType = core.$ZodType>
+  extends _ZodType<core.$ZodPrefaultInternals<T>>,
+    core.$ZodPrefault<T> {
   unwrap(): T;
 }
 export const ZodPrefault: core.$constructor<ZodPrefault> = /*@__PURE__*/ core.$constructor(
@@ -1709,23 +1689,23 @@ export const ZodPrefault: core.$constructor<ZodPrefault> = /*@__PURE__*/ core.$c
   }
 );
 
-export function prefault<T extends core.$ZodType>(
+export function prefault<T extends core.SomeType>(
   innerType: T,
   defaultValue: core.input<T> | (() => core.input<T>)
 ): ZodPrefault<T> {
   return new ZodPrefault({
     type: "prefault",
-    innerType,
+    innerType: innerType as any as core.$ZodType,
     get defaultValue() {
       return typeof defaultValue === "function" ? (defaultValue as Function)() : defaultValue;
     },
-  }) as ZodPrefault<T>;
+  }) as any;
 }
 
 // ZodNonOptional
-export interface ZodNonOptional<T extends core.$ZodType = core.$ZodType> extends ZodType {
-  _zod: core.$ZodNonOptionalInternals<T>;
-
+export interface ZodNonOptional<T extends core.SomeType = core.$ZodType>
+  extends _ZodType<core.$ZodNonOptionalInternals<T>>,
+    core.$ZodNonOptional<T> {
   unwrap(): T;
 }
 export const ZodNonOptional: core.$constructor<ZodNonOptional> = /*@__PURE__*/ core.$constructor(
@@ -1738,21 +1718,21 @@ export const ZodNonOptional: core.$constructor<ZodNonOptional> = /*@__PURE__*/ c
   }
 );
 
-export function nonoptional<T extends core.$ZodType>(
+export function nonoptional<T extends core.SomeType>(
   innerType: T,
   params?: string | core.$ZodNonOptionalParams
 ): ZodNonOptional<T> {
   return new ZodNonOptional({
     type: "nonoptional",
-    innerType,
+    innerType: innerType as any as core.$ZodType,
     ...util.normalizeParams(params),
-  }) as ZodNonOptional<T>;
+  }) as any;
 }
 
 // ZodSuccess
-export interface ZodSuccess<T extends core.$ZodType = core.$ZodType> extends ZodType {
-  _zod: core.$ZodSuccessInternals<T>;
-
+export interface ZodSuccess<T extends core.SomeType = core.$ZodType>
+  extends _ZodType<core.$ZodSuccessInternals<T>>,
+    core.$ZodSuccess<T> {
   unwrap(): T;
 }
 export const ZodSuccess: core.$constructor<ZodSuccess> = /*@__PURE__*/ core.$constructor("ZodSuccess", (inst, def) => {
@@ -1762,17 +1742,17 @@ export const ZodSuccess: core.$constructor<ZodSuccess> = /*@__PURE__*/ core.$con
   inst.unwrap = () => inst._zod.def.innerType;
 });
 
-export function success<T extends core.$ZodType>(innerType: T): ZodSuccess<T> {
+export function success<T extends core.SomeType>(innerType: T): ZodSuccess<T> {
   return new ZodSuccess({
     type: "success",
-    innerType,
-  }) as ZodSuccess<T>;
+    innerType: innerType as any as core.$ZodType,
+  }) as any;
 }
 
 // ZodCatch
-export interface ZodCatch<T extends core.$ZodType = core.$ZodType> extends ZodType {
-  _zod: core.$ZodCatchInternals<T>;
-
+export interface ZodCatch<T extends core.SomeType = core.$ZodType>
+  extends _ZodType<core.$ZodCatchInternals<T>>,
+    core.$ZodCatch<T> {
   unwrap(): T;
   /** @deprecated Use `.unwrap()` instead. */
   removeCatch(): T;
@@ -1785,24 +1765,22 @@ export const ZodCatch: core.$constructor<ZodCatch> = /*@__PURE__*/ core.$constru
   inst.removeCatch = inst.unwrap;
 });
 
-function _catch<T extends core.$ZodType>(
+function _catch<T extends core.SomeType>(
   innerType: T,
   catchValue: core.output<T> | ((ctx: core.$ZodCatchCtx) => core.output<T>)
 ): ZodCatch<T> {
   return new ZodCatch({
     type: "catch",
-    innerType,
+    innerType: innerType as any as core.$ZodType,
     catchValue: (typeof catchValue === "function" ? catchValue : () => catchValue) as (
       ctx: core.$ZodCatchCtx
     ) => core.output<T>,
-  }) as ZodCatch<T>;
+  }) as any;
 }
 export { _catch as catch };
 
 // ZodNaN
-export interface ZodNaN extends ZodType {
-  _zod: core.$ZodNaNInternals;
-}
+export interface ZodNaN extends _ZodType<core.$ZodNaNInternals>, core.$ZodNaN {}
 export const ZodNaN: core.$constructor<ZodNaN> = /*@__PURE__*/ core.$constructor("ZodNaN", (inst, def) => {
   core.$ZodNaN.init(inst, def);
   ZodType.init(inst, def);
@@ -1813,10 +1791,9 @@ export function nan(params?: string | core.$ZodNaNParams): ZodNaN {
 }
 
 // ZodPipe
-export interface ZodPipe<A extends core.$ZodType = core.$ZodType, B extends core.$ZodType = core.$ZodType>
-  extends ZodType {
-  _zod: core.$ZodPipeInternals<A, B>;
-
+export interface ZodPipe<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType>
+  extends _ZodType<core.$ZodPipeInternals<A, B>>,
+    core.$ZodPipe<A, B> {
   in: A;
   out: B;
 }
@@ -1829,23 +1806,22 @@ export const ZodPipe: core.$constructor<ZodPipe> = /*@__PURE__*/ core.$construct
 });
 
 export function pipe<
-  const A extends core.$ZodType,
+  const A extends core.SomeType,
   B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>,
 >(in_: A, out: B | core.$ZodType<unknown, core.output<A>>): ZodPipe<A, B>;
-export function pipe(in_: core.$ZodType, out: core.$ZodType) {
+export function pipe(in_: core.SomeType, out: core.SomeType) {
   return new ZodPipe({
     type: "pipe",
-    in: in_,
-    out,
-
+    in: in_ as unknown as core.$ZodType,
+    out: out as unknown as core.$ZodType,
     // ...util.normalizeParams(params),
   });
 }
 
 // ZodReadonly
-export interface ZodReadonly<T extends core.$ZodType = core.$ZodType> extends ZodType {
-  _zod: core.$ZodReadonlyInternals<T>;
-}
+export interface ZodReadonly<T extends core.SomeType = core.$ZodType>
+  extends _ZodType<core.$ZodReadonlyInternals<T>>,
+    core.$ZodReadonly<T> {}
 export const ZodReadonly: core.$constructor<ZodReadonly> = /*@__PURE__*/ core.$constructor(
   "ZodReadonly",
   (inst, def) => {
@@ -1854,17 +1830,17 @@ export const ZodReadonly: core.$constructor<ZodReadonly> = /*@__PURE__*/ core.$c
   }
 );
 
-export function readonly<T extends core.$ZodType>(innerType: T): ZodReadonly<T> {
+export function readonly<T extends core.SomeType>(innerType: T): ZodReadonly<T> {
   return new ZodReadonly({
     type: "readonly",
-    innerType,
-  }) as ZodReadonly<T>;
+    innerType: innerType as any as core.$ZodType,
+  }) as any;
 }
 
 // ZodTemplateLiteral
-export interface ZodTemplateLiteral<Template extends string = string> extends ZodType {
-  _zod: core.$ZodTemplateLiteralInternals<Template>;
-}
+export interface ZodTemplateLiteral<Template extends string = string>
+  extends _ZodType<core.$ZodTemplateLiteralInternals<Template>>,
+    core.$ZodTemplateLiteral<Template> {}
 export const ZodTemplateLiteral: core.$constructor<ZodTemplateLiteral> = /*@__PURE__*/ core.$constructor(
   "ZodTemplateLiteral",
   (inst, def) => {
@@ -1885,9 +1861,9 @@ export function templateLiteral<const Parts extends core.$ZodTemplateLiteralPart
 }
 
 // ZodLazy
-export interface ZodLazy<T extends core.$ZodType = core.$ZodType> extends ZodType {
-  _zod: core.$ZodLazyInternals<T>;
-
+export interface ZodLazy<T extends core.SomeType = core.$ZodType>
+  extends _ZodType<core.$ZodLazyInternals<T>>,
+    core.$ZodLazy<T> {
   unwrap(): T;
 }
 export const ZodLazy: core.$constructor<ZodLazy> = /*@__PURE__*/ core.$constructor("ZodLazy", (inst, def) => {
@@ -1897,17 +1873,17 @@ export const ZodLazy: core.$constructor<ZodLazy> = /*@__PURE__*/ core.$construct
   inst.unwrap = () => inst._zod.def.getter();
 });
 
-export function lazy<T extends core.$ZodType>(getter: () => T): ZodLazy<T> {
+export function lazy<T extends core.SomeType>(getter: () => T): ZodLazy<T> {
   return new ZodLazy({
     type: "lazy",
-    getter,
-  }) as ZodLazy<T>;
+    getter: getter as any,
+  }) as any;
 }
 
 // ZodPromise
-export interface ZodPromise<T extends core.$ZodType = core.$ZodType> extends ZodType {
-  _zod: core.$ZodPromiseInternals<T>;
-
+export interface ZodPromise<T extends core.SomeType = core.$ZodType>
+  extends _ZodType<core.$ZodPromiseInternals<T>>,
+    core.$ZodPromise<T> {
   unwrap(): T;
 }
 export const ZodPromise: core.$constructor<ZodPromise> = /*@__PURE__*/ core.$constructor("ZodPromise", (inst, def) => {
@@ -1917,17 +1893,17 @@ export const ZodPromise: core.$constructor<ZodPromise> = /*@__PURE__*/ core.$con
   inst.unwrap = () => inst._zod.def.innerType;
 });
 
-export function promise<T extends core.$ZodType>(innerType: T): ZodPromise<T> {
+export function promise<T extends core.SomeType>(innerType: T): ZodPromise<T> {
   return new ZodPromise({
     type: "promise",
-    innerType,
-  }) as ZodPromise<T>;
+    innerType: innerType as any as core.$ZodType,
+  }) as any;
 }
 
 // ZodCustom
-export interface ZodCustom<O = unknown, I = unknown> extends ZodType {
-  _zod: core.$ZodCustomInternals<O, I>;
-}
+export interface ZodCustom<O = unknown, I = unknown>
+  extends _ZodType<core.$ZodCustomInternals<O, I>>,
+    core.$ZodCustom<O, I> {}
 export const ZodCustom: core.$constructor<ZodCustom> = /*@__PURE__*/ core.$constructor("ZodCustom", (inst, def) => {
   core.$ZodCustom.init(inst, def);
   ZodType.init(inst, def);
@@ -1955,7 +1931,7 @@ export function refine<T>(
   fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>,
   _params: string | core.$ZodCustomParams = {}
 ): core.$ZodCheck<T> {
-  return core._custom(ZodCustom, fn, _params);
+  return core._refine(ZodCustom, fn, _params);
 }
 
 // superRefine
@@ -2008,27 +1984,32 @@ function _instanceof<T extends typeof util.Class>(
 export { _instanceof as instanceof };
 
 // stringbool
-export const stringbool: (_params?: string | core.$ZodStringBoolParams) => ZodPipe<ZodUnknown, ZodBoolean> = (
-  ...args
-) =>
+export const stringbool: (
+  _params?: string | core.$ZodStringBoolParams
+) => ZodPipe<ZodPipe<ZodString, ZodTransform<boolean, string>>, ZodBoolean> = (...args) =>
   core._stringbool(
     {
       Pipe: ZodPipe,
       Boolean: ZodBoolean,
-      Unknown: ZodUnknown,
+      String: ZodString,
+      Transform: ZodTransform,
     },
     ...args
   ) as any;
 
 // json
-export type ZodJSONSchema = ZodUnion<
+type _ZodJSONSchema = ZodUnion<
   [ZodString, ZodNumber, ZodBoolean, ZodNull, ZodArray<ZodJSONSchema>, ZodRecord<ZodString, ZodJSONSchema>]
-> & {
-  _zod: {
-    input: util.JSONType;
-    output: util.JSONType;
-  };
-};
+>;
+type _ZodJSONSchemaInternals = _ZodJSONSchema["_zod"];
+
+export interface ZodJSONSchemaInternals extends _ZodJSONSchemaInternals {
+  output: util.JSONType;
+  input: util.JSONType;
+}
+export interface ZodJSONSchema extends _ZodJSONSchema {
+  _zod: ZodJSONSchemaInternals;
+}
 
 export function json(params?: string | core.$ZodCustomParams): ZodJSONSchema {
   const jsonSchema: any = lazy(() => {
@@ -2041,9 +2022,9 @@ export function json(params?: string | core.$ZodCustomParams): ZodJSONSchema {
 // preprocess
 
 // /** @deprecated Use `z.pipe()` and `z.transform()` instead. */
-export function preprocess<A, U extends core.$ZodType>(
-  fn: (arg: unknown, ctx: RefinementCtx) => A,
+export function preprocess<A, U extends core.SomeType, B = unknown>(
+  fn: (arg: B, ctx: RefinementCtx) => A,
   schema: U
-): ZodPipe<ZodTransform<A, unknown>, U> {
-  return pipe(transform(fn as any), schema as any);
+): ZodPipe<ZodTransform<A, B>, U> {
+  return pipe(transform(fn as any), schema as any) as any;
 }
diff --git a/packages/zod/src/v4/core/api.ts b/packages/zod/src/v4/core/api.ts
index 6f1da375..ab6efb75 100644
--- a/packages/zod/src/v4/core/api.ts
+++ b/packages/zod/src/v4/core/api.ts
@@ -1050,7 +1050,7 @@ export function _array<T extends schemas.$ZodType>(
     //   return element;
     // },
     ...util.normalizeParams(params),
-  }) as schemas.$ZodArray<T>;
+  }) as any;
 }
 
 export type $ZodObjectParams = TypeParams<schemas.$ZodObject, "shape" | "catchall">;
@@ -1434,22 +1434,39 @@ export function _custom<O = unknown, I = O>(
   fn: (data: O) => unknown,
   _params: string | $ZodCustomParams | undefined
 ): schemas.$ZodCustom<O, I> {
+  const norm = util.normalizeParams(_params);
+  norm.abort ??= true; // default to abort:false
   const schema = new Class({
     type: "custom",
     check: "custom",
     fn: fn as any,
-    ...util.normalizeParams(_params),
+    ...norm,
   });
 
   return schema as any;
 }
 
-export function _refine<T>(
+// export function _refine<T>(
+//   Class: util.SchemaClass<schemas.$ZodCustom>,
+//   fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>,
+//   _params: string | $ZodCustomParams = {}
+// ): checks.$ZodCheck<T> {
+//   return _custom(Class, fn, _params);
+// }
+// same as _custom but deafults to abort:false
+export function _refine<O = unknown, I = O>(
   Class: util.SchemaClass<schemas.$ZodCustom>,
-  fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>,
-  _params: string | $ZodCustomParams = {}
-): checks.$ZodCheck<T> {
-  return _custom(Class, fn, _params);
+  fn: (data: O) => unknown,
+  _params: string | $ZodCustomParams | undefined
+): schemas.$ZodCustom<O, I> {
+  const schema = new Class({
+    type: "custom",
+    check: "custom",
+    fn: fn as any,
+    ...util.normalizeParams(_params),
+  });
+
+  return schema as any;
 }
 
 // export type $ZodCustomParams = CheckTypeParams<schemas.$ZodCustom, "fn">
@@ -1461,9 +1478,9 @@ export interface $ZodStringBoolParams extends TypeParams {
   truthy?: string[];
   falsy?: string[];
   /**
-   * Options `"sensitive"`, `"insensitive"`
+   * Options: `"sensitive"`, `"insensitive"`
    *
-   * Defaults to `"insensitive"`
+   * @default `"insensitive"`
    */
   case?: "sensitive" | "insensitive" | undefined;
 }
@@ -1472,66 +1489,69 @@ export function _stringbool(
   Classes: {
     Pipe?: typeof schemas.$ZodPipe;
     Boolean?: typeof schemas.$ZodBoolean;
-    Unknown?: typeof schemas.$ZodUnknown;
+    Transform?: typeof schemas.$ZodTransform;
+    String?: typeof schemas.$ZodString;
   },
   _params?: string | $ZodStringBoolParams
-): schemas.$ZodPipe<schemas.$ZodUnknown, schemas.$ZodBoolean<boolean>> {
+): schemas.$ZodPipe<
+  schemas.$ZodPipe<schemas.$ZodString, schemas.$ZodTransform<boolean, string>>,
+  schemas.$ZodBoolean<boolean>
+> {
   const { case: _case, error, truthy, falsy } = util.normalizeParams(_params);
 
-  const trueValues = new Set(truthy ?? ["true", "1", "yes", "on", "y", "enabled"]);
-  const falseValues = new Set(falsy ?? ["false", "0", "no", "off", "n", "disabled"]);
+  let truthyArray = truthy ?? ["true", "1", "yes", "on", "y", "enabled"];
+  let falsyArray = falsy ?? ["false", "0", "no", "off", "n", "disabled"];
+  if (_case !== "sensitive") {
+    truthyArray = truthyArray.map((v) => (typeof v === "string" ? v.toLowerCase() : v));
+    falsyArray = falsyArray.map((v) => (typeof v === "string" ? v.toLowerCase() : v));
+  }
+
+  const truthySet = new Set(truthyArray);
+  const falsySet = new Set(falsyArray);
 
   const _Pipe = Classes.Pipe ?? schemas.$ZodPipe;
   const _Boolean = Classes.Boolean ?? schemas.$ZodBoolean;
-  const _Unknown = Classes.Unknown ?? schemas.$ZodUnknown;
+  const _String = Classes.String ?? schemas.$ZodString;
+  const _Transform = Classes.Transform ?? schemas.$ZodTransform;
 
-  const inst = new _Unknown({
-    type: "unknown",
-    checks: [
-      {
-        _zod: {
-          check: (ctx: any) => {
-            if (typeof ctx.value === "string") {
-              let data: string = ctx.value;
-              if (_case !== "sensitive") data = data.toLowerCase();
-              if (trueValues.has(data)) {
-                ctx.value = true;
-              } else if (falseValues.has(data)) {
-                ctx.value = false;
-              } else {
-                ctx.issues.push({
-                  code: "invalid_value",
-                  expected: "stringbool",
-                  values: [...trueValues, ...falseValues],
-                  input: ctx.value,
-                  inst,
-                });
-              }
-            } else {
-              ctx.issues.push({
-                code: "invalid_type",
-                expected: "string",
-                input: ctx.value,
-              });
-            }
-          },
-          def: {
-            check: "custom",
-          },
-          onattach: [],
-        },
-      },
-    ],
+  const tx = new _Transform({
+    type: "transform",
+    transform: (input, payload: schemas.ParsePayload<unknown>) => {
+      let data: string = input as string;
+      if (_case !== "sensitive") data = data.toLowerCase();
+      if (truthySet.has(data)) {
+        return true;
+      } else if (falsySet.has(data)) {
+        return false;
+      } else {
+        payload.issues.push({
+          code: "invalid_value",
+          expected: "stringbool",
+          values: [...truthySet, ...falsySet],
+          input: payload.value,
+          inst: tx,
+        });
+        return {} as never;
+      }
+    },
     error,
   });
 
-  return new _Pipe({
+  const innerPipe = new _Pipe({
     type: "pipe",
-    in: inst,
+    in: new _String({ type: "string", error }),
+    out: tx,
+    error,
+  });
+
+  const outerPipe = new _Pipe({
+    type: "pipe",
+    in: innerPipe,
     out: new _Boolean({
       type: "boolean",
       error,
     }),
     error,
-  }) as any;
+  });
+  return outerPipe as any;
 }
diff --git a/packages/zod/src/v4/core/checks.ts b/packages/zod/src/v4/core/checks.ts
index 867bdfad..3aceb60c 100644
--- a/packages/zod/src/v4/core/checks.ts
+++ b/packages/zod/src/v4/core/checks.ts
@@ -51,7 +51,7 @@ export interface $ZodCheckLessThanDef extends $ZodCheckDef {
 
 export interface $ZodCheckLessThanInternals<T extends util.Numeric = util.Numeric> extends $ZodCheckInternals<T> {
   def: $ZodCheckLessThanDef;
-  issc: errors.$ZodIssueTooSmall<T>;
+  issc: errors.$ZodIssueTooBig<T>;
 }
 
 const numericOriginMap = {
@@ -622,6 +622,7 @@ export const $ZodCheckMaxLength: core.$constructor<$ZodCheckMaxLength> = /*@__PU
         origin,
         code: "too_big",
         maximum: def.maximum,
+        inclusive: true,
         input,
         inst,
         continue: !def.abort,
@@ -672,6 +673,7 @@ export const $ZodCheckMinLength: core.$constructor<$ZodCheckMinLength> = /*@__PU
         origin,
         code: "too_small",
         minimum: def.minimum,
+        inclusive: true,
         input,
         inst,
         continue: !def.abort,
@@ -952,7 +954,8 @@ export const $ZodCheckIncludes: core.$constructor<$ZodCheckIncludes> = /*@__PURE
   (inst, def) => {
     $ZodCheck.init(inst, def);
 
-    const pattern = new RegExp(util.escapeRegex(def.includes));
+    const escapedRegex = util.escapeRegex(def.includes);
+    const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
     def.pattern = pattern;
     inst._zod.onattach.push((inst) => {
       const bag = inst._zod.bag as schemas.$ZodStringInternals<unknown>["bag"];
diff --git a/packages/zod/src/v4/core/core.ts b/packages/zod/src/v4/core/core.ts
index 099c2656..9fba3846 100644
--- a/packages/zod/src/v4/core/core.ts
+++ b/packages/zod/src/v4/core/core.ts
@@ -26,7 +26,7 @@ export /*@__NO_SIDE_EFFECTS__*/ function $constructor<T extends ZodTrait, D = T[
     initializer(inst, def);
     // support prototype modifications
     for (const k in _.prototype) {
-      Object.defineProperty(inst, k, { value: (_.prototype as any)[k].bind(inst) });
+      if (!(k in inst)) Object.defineProperty(inst, k, { value: (_.prototype as any)[k].bind(inst) });
     }
     inst._zod.constr = _;
     inst._zod.def = def;
@@ -64,8 +64,8 @@ export type $brand<T extends string | number | symbol = string | number | symbol
   [$brand]: { [k in T]: true };
 };
 
-export type $ZodBranded<T extends schemas.$ZodType, Brand extends string | number | symbol> = T &
-  Record<"_zod", Record<"~output", output<T> & $brand<Brand>>>;
+export type $ZodBranded<T extends schemas.SomeType, Brand extends string | number | symbol> = T &
+  Record<"_zod", Record<"output", output<T> & $brand<Brand>>>;
 
 export class $ZodAsyncError extends Error {
   constructor() {
@@ -75,22 +75,38 @@ export class $ZodAsyncError extends Error {
 
 ////////////////////////////  TYPE HELPERS  ///////////////////////////////////
 
-// export type input<T extends schemas.$ZodType> = T["_zod"] extends { "~input": any }
+// 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"];
+export type input<T> = T extends { _zod: { input: any } } ? Required<T["_zod"]>["input"] : unknown;
+export type output<T> = T extends { _zod: { output: any } } ? Required<T["_zod"]>["output"] : unknown;
+
+// Mk2
+// export type input<T> = T extends { _zod: { "~input": any } }
+//   ? T["_zod"]["~input"]
+//   : T extends { _zod: { input: any } }
+//     ? T["_zod"]["input"]
+//     : never;
+// export type output<T> = T extends { _zod: { "~output": any } }
+//   ? T["_zod"]["~output"]
+//   : T extends { _zod: { output: any } }
+//     ? T["_zod"]["output"]
+//     : never;
+// Mk 3
+// export type input<T extends schemas.$ZodType> = T["_zod"]["input"];
+// export type output<T extends schemas.$ZodType> = T["_zod"]["output"];
+// Mk 4
+// export type input<T extends schemas.$ZodType> = T[] extends { _zod: { "~input": any } }
 //   ? T["_zod"]["~input"]
-//   : T["_zod"]["input"];
-// export type output<T extends schemas.$ZodType> = T["_zod"] extends { "~output": any }
+//   : T extends { _zod: { input: any } }
+//     ? T["_zod"]["input"]
+//     : never;
+// export type output<T extends schemas.$ZodType> = T extends { _zod: { "~output": any } }
 //   ? T["_zod"]["~output"]
-//   : T["_zod"]["output"];
-export type input<T> = T extends { _zod: { "~input": any } }
-  ? T["_zod"]["~input"]
-  : T extends { _zod: { input: any } }
-    ? T["_zod"]["input"]
-    : never;
-export type output<T> = T extends { _zod: { "~output": any } }
-  ? T["_zod"]["~output"]
-  : T extends { _zod: { output: any } }
-    ? T["_zod"]["output"]
-    : never;
+//   : T extends { _zod: { output: any } }
+//     ? T["_zod"]["output"]
+//     : never;
 
 export type { output as infer };
 
diff --git a/packages/zod/src/v4/core/doc.ts b/packages/zod/src/v4/core/doc.ts
index 9cb6a508..9591fe7a 100644
--- a/packages/zod/src/v4/core/doc.ts
+++ b/packages/zod/src/v4/core/doc.ts
@@ -39,7 +39,6 @@ export class Doc {
     const content = this?.content ?? [``];
     const lines = [...content.map((x) => `  ${x}`)];
     // console.log(lines.join("\n"));
-    // console.dir("COMPILE", {depth: null});
     return new F(...args, lines.join("\n"));
   }
 }
diff --git a/packages/zod/src/v4/core/registries.ts b/packages/zod/src/v4/core/registries.ts
index 5e67b7f6..870ad97f 100644
--- a/packages/zod/src/v4/core/registries.ts
+++ b/packages/zod/src/v4/core/registries.ts
@@ -12,10 +12,16 @@ export type $replace<Meta, S extends $ZodType> = Meta extends $output
     ? core.input<S>
     : Meta extends (infer M)[]
       ? $replace<M, S>[]
-      : // handle objecs
-        Meta extends object
-        ? { [K in keyof Meta]: $replace<Meta[K], S> }
-        : Meta;
+      : Meta extends (...args: infer P) => infer R
+        ? (
+            ...args: {
+              [K in keyof P]: $replace<P[K], S>; // tuple
+            }
+          ) => $replace<R, S>
+        : // handle objects
+          Meta extends object
+          ? { [K in keyof Meta]: $replace<Meta[K], S> }
+          : Meta;
 
 type MetadataType = Record<string, unknown> | undefined;
 export class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema extends $ZodType = $ZodType> {
diff --git a/packages/zod/src/v4/core/schemas.ts b/packages/zod/src/v4/core/schemas.ts
index 29e4c57e..07c83973 100644
--- a/packages/zod/src/v4/core/schemas.ts
+++ b/packages/zod/src/v4/core/schemas.ts
@@ -81,8 +81,7 @@ export interface $ZodTypeDef {
   checks?: checks.$ZodCheck<never>[];
 }
 
-/** @internal */
-export interface $ZodTypeInternals<out O = unknown, out I = unknown> {
+export interface _$ZodTypeInternals {
   /** The `@zod/core` version of this schema */
   version: typeof version;
 
@@ -93,11 +92,6 @@ export interface $ZodTypeInternals<out O = unknown, out I = unknown> {
   /** @internal Randomly generated ID for this schema. */
   id: string;
 
-  /** @internal The inferred output type */
-  output: O; //extends { $out: infer O } ? O : Out;
-  /** @internal The inferred input type */
-  input: I; //extends { $in: infer I } ? I : In;
-
   /** @internal List of deferred initializers. */
   deferred: util.AnyFunc[] | undefined;
 
@@ -150,10 +144,29 @@ export interface $ZodTypeInternals<out O = unknown, out I = unknown> {
   /** @internal The parent of this schema. Only set during certain clone operations. */
   parent?: $ZodType | undefined;
 }
+/** @internal */
+export interface $ZodTypeInternals<out O = unknown, out I = unknown> extends _$ZodTypeInternals {
+  /** @internal The inferred output type */
+  output: O; //extends { $out: infer O } ? O : Out;
+  /** @internal The inferred input type */
+  input: I; //extends { $in: infer I } ? I : In;
+}
+
+export type $ZodStandardSchema<T> = StandardSchemaV1.Props<core.input<T>, core.output<T>>;
+
+export type SomeType = { _zod: _$ZodTypeInternals };
 
-export interface $ZodType<O = unknown, I = unknown> {
-  _zod: $ZodTypeInternals<O, I>;
-  "~standard": StandardSchemaV1.Props<core.input<this>, core.output<this>>;
+export interface $ZodType<
+  O = unknown,
+  I = unknown,
+  Internals extends $ZodTypeInternals<O, I> = $ZodTypeInternals<O, I>,
+> {
+  _zod: Internals;
+  "~standard": $ZodStandardSchema<this>;
+}
+export interface _$ZodType<T extends $ZodTypeInternals = $ZodTypeInternals>
+  extends $ZodType<T["output"], T["input"], T> {
+  // _zod: T;
 }
 
 export const $ZodType: core.$constructor<$ZodType> = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def) => {
@@ -287,8 +300,8 @@ export interface $ZodStringInternals<Input> extends $ZodTypeInternals<string, In
   }>;
 }
 
-export interface $ZodString<Input = unknown> extends $ZodType {
-  _zod: $ZodStringInternals<Input>;
+export interface $ZodString<Input = unknown> extends _$ZodType<$ZodStringInternals<Input>> {
+  // _zod: $ZodStringInternals<Input>;
 }
 
 export const $ZodString: core.$constructor<$ZodString> = /*@__PURE__*/ core.$constructor("$ZodString", (inst, def) => {
@@ -428,6 +441,7 @@ export const $ZodURL: core.$constructor<$ZodURL> = /*@__PURE__*/ core.$construct
             pattern: regexes.hostname.source,
             input: payload.value,
             inst,
+            continue: !def.abort,
           });
         }
       }
@@ -442,6 +456,7 @@ export const $ZodURL: core.$constructor<$ZodURL> = /*@__PURE__*/ core.$construct
             pattern: def.protocol.source,
             input: payload.value,
             inst,
+            continue: !def.abort,
           });
         }
       }
@@ -453,6 +468,7 @@ export const $ZodURL: core.$constructor<$ZodURL> = /*@__PURE__*/ core.$construct
         format: "url",
         input: payload.value,
         inst,
+        continue: !def.abort,
       });
     }
   };
@@ -706,6 +722,7 @@ export const $ZodIPv6: core.$constructor<$ZodIPv6> = /*@__PURE__*/ core.$constru
         format: "ipv6",
         input: payload.value,
         inst,
+        continue: !def.abort,
       });
     }
   };
@@ -767,6 +784,7 @@ export const $ZodCIDRv6: core.$constructor<$ZodCIDRv6> = /*@__PURE__*/ core.$con
           format: "cidrv6",
           input: payload.value,
           inst,
+          continue: !def.abort,
         });
       }
     };
@@ -810,6 +828,7 @@ export const $ZodBase64: core.$constructor<$ZodBase64> = /*@__PURE__*/ core.$con
         format: "base64",
         input: payload.value,
         inst,
+        continue: !def.abort,
       });
     };
   }
@@ -848,6 +867,7 @@ export const $ZodBase64URL: core.$constructor<$ZodBase64URL> = /*@__PURE__*/ cor
         format: "base64url",
         input: payload.value,
         inst,
+        continue: !def.abort,
       });
     };
   }
@@ -906,6 +926,7 @@ export const $ZodJWT: core.$constructor<$ZodJWT> = /*@__PURE__*/ core.$construct
       format: "jwt",
       input: payload.value,
       inst,
+      continue: !def.abort,
     });
   };
 });
@@ -1431,20 +1452,19 @@ export const $ZodDate: core.$constructor<$ZodDate> = /*@__PURE__*/ core.$constru
 /////////////////////////////////////////
 /////////////////////////////////////////
 
-export interface $ZodArrayDef<T extends $ZodType = $ZodType> extends $ZodTypeDef {
+export interface $ZodArrayDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
   type: "array";
   element: T;
 }
 
-export interface $ZodArrayInternals<T extends $ZodType = $ZodType>
+export interface $ZodArrayInternals<T extends SomeType = $ZodType>
   extends $ZodTypeInternals<core.output<T>[], core.input<T>[]> {
   def: $ZodArrayDef<T>;
   isst: errors.$ZodIssueInvalidType;
 }
 
-export interface $ZodArray<T extends $ZodType = $ZodType> extends $ZodType {
-  _zod: $ZodArrayInternals<T>;
-}
+export interface $ZodArray<T extends SomeType = $ZodType>
+  extends $ZodType<core.output<T>[], core.input<T>[], $ZodArrayInternals<T>> {}
 
 function handleArrayResult(result: ParsePayload<any>, final: ParsePayload<any[]>, index: number) {
   if (result.issues.length) {
@@ -1504,76 +1524,18 @@ export const $ZodArray: core.$constructor<$ZodArray> = /*@__PURE__*/ core.$const
 //////////////////////////////////////////
 //////////////////////////////////////////
 
-export type $ZodShape = Readonly<{ [k: string]: $ZodType }>;
-
-export interface $ZodObjectDef<Shape extends $ZodShape = $ZodShape> extends $ZodTypeDef {
-  type: "object";
-  shape: Shape;
-  catchall?: $ZodType | undefined;
-}
-
-export interface $ZodObjectInternals<
-  /** @ts-ignore Cast variance */
-  out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>,
-  out Config extends $ZodObjectConfig = $ZodObjectConfig,
-> extends $ZodTypeInternals<
-    $InferObjectOutputFallback<Shape, Config["out"]>,
-    $InferObjectInputFallback<Shape, Config["in"]>
-  > {
-  def: $ZodObjectDef<Shape>;
-  config: Config;
-  isst: errors.$ZodIssueInvalidType | errors.$ZodIssueUnrecognizedKeys;
-  propValues: util.PropValues;
-  // special keys only used for objects
-  // not defined on $ZodTypeInternals (base interface) because it breaks cyclical inference
-  // the z.infer<> util checks for these first when extracting inferred type
-  "~output": $InferObjectOutput<Shape, Config["out"]>;
-  "~input": $InferObjectInput<Shape, Config["in"]>;
-}
-export type $ZodLooseShape = Record<string, any>;
-
 type OptionalOutSchema = { _zod: { optout: "optional" } };
 type OptionalInSchema = { _zod: { optin: "optional" } };
 
-export type $InferObjectOutputFallback<
-  T extends $ZodLooseShape,
-  Extra extends Record<string, unknown>,
-> = string extends keyof T
-  ? object
-  : keyof (T & Extra) extends never
-    ? Record<string, never>
-    : util.Prettify<
-        {
-          // this is a simplified fallback type
-          // there is no support for key optionality
-          -readonly [k in keyof T]: core.output<T[k]>;
-        } & Extra
-      >;
-
-export type $InferObjectInputFallback<
-  T extends $ZodLooseShape,
-  Extra extends Record<string, unknown>,
-> = string extends keyof T
-  ? object
-  : keyof (T & Extra) extends never
-    ? Record<string, never>
-    : util.Prettify<
-        {
-          // this is a simplified fallback type
-          // there is no support for key optionality
-          -readonly [k in keyof T]: core.input<T[k]>;
-        } & Extra
-      >;
-
 export type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T
   ? object
   : keyof (T & Extra) extends never
     ? Record<string, never>
     : util.Prettify<
         {
-          -readonly [k in keyof T as T[k] extends OptionalOutSchema ? never : k]: core.output<T[k]>;
+          -readonly [k in keyof T as T[k] extends OptionalOutSchema ? never : k]: T[k]["_zod"]["output"];
         } & {
-          -readonly [k in keyof T as T[k] extends OptionalOutSchema ? k : never]?: core.output<T[k]>;
+          -readonly [k in keyof T as T[k] extends OptionalOutSchema ? k : never]?: T[k]["_zod"]["output"];
         } & Extra
       >;
 
@@ -1583,9 +1545,9 @@ export type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<str
     ? Record<string, never>
     : util.Prettify<
         {
-          -readonly [k in keyof T as T[k] extends OptionalInSchema ? never : k]: core.input<T[k]>;
+          -readonly [k in keyof T as T[k] extends OptionalInSchema ? never : k]: T[k]["_zod"]["input"];
         } & {
-          -readonly [k in keyof T as T[k] extends OptionalInSchema ? k : never]?: core.input<T[k]>;
+          -readonly [k in keyof T as T[k] extends OptionalInSchema ? k : never]?: T[k]["_zod"]["input"];
         } & Extra
       >;
 
@@ -1634,19 +1596,43 @@ export type $strip = {
   out: {};
   in: {};
 };
-export type $catchall<T extends $ZodType> = {
+export type $catchall<T extends SomeType> = {
   out: { [k: string]: core.output<T> };
   in: { [k: string]: core.input<T> };
 };
+
+export type $ZodShape = Readonly<{ [k: string]: $ZodType }>;
+
+export interface $ZodObjectDef<Shape extends $ZodShape = $ZodShape> extends $ZodTypeDef {
+  type: "object";
+  shape: Shape;
+  catchall?: $ZodType | undefined;
+}
+
+export interface $ZodObjectInternals<
+  /** @ts-ignore Cast variance */
+  out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>,
+  out Config extends $ZodObjectConfig = $ZodObjectConfig,
+> extends _$ZodTypeInternals {
+  def: $ZodObjectDef<Shape>;
+  config: Config;
+  isst: errors.$ZodIssueInvalidType | errors.$ZodIssueUnrecognizedKeys;
+  propValues: util.PropValues;
+  output: $InferObjectOutput<Shape, Config["out"]>;
+  input: $InferObjectInput<Shape, Config["in"]>;
+}
+export type $ZodLooseShape = Record<string, any>;
+
 export interface $ZodObject<
   /** @ts-ignore Cast variance */
   out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>,
   out Params extends $ZodObjectConfig = $ZodObjectConfig,
-> extends $ZodType {
-  _zod: $ZodObjectInternals<Shape, Params>;
+> extends $ZodType<any, any, $ZodObjectInternals<Shape, Params>> {
+  "~standard": $ZodStandardSchema<this>;
 }
 
 export const $ZodObject: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, def) => {
+  // requires cast because technically $ZodObject doesn't extend
   $ZodType.init(inst, def);
 
   const _normalized = util.cached(() => {
@@ -1858,21 +1844,22 @@ export const $ZodObject: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$con
 //////////                    ///////////
 /////////////////////////////////////////
 /////////////////////////////////////////
-export type $InferUnionOutput<T extends $ZodType> = T extends any ? core.output<T> : never;
-export type $InferUnionInput<T extends $ZodType> = T extends any ? core.input<T> : never;
-export interface $ZodUnionDef<Options extends readonly $ZodType[] = readonly $ZodType[]> extends $ZodTypeDef {
+// use generic to distribute union types
+export type $InferUnionOutput<T extends SomeType> = T extends any ? core.output<T> : never;
+export type $InferUnionInput<T extends SomeType> = T extends any ? core.input<T> : never;
+export interface $ZodUnionDef<Options extends readonly SomeType[] = readonly $ZodType[]> extends $ZodTypeDef {
   type: "union";
   options: Options;
 }
 
-export interface $ZodUnionInternals<T extends readonly $ZodType[] = readonly $ZodType[]>
+export interface $ZodUnionInternals<T extends readonly SomeType[] = readonly $ZodType[]>
   extends $ZodTypeInternals<$InferUnionOutput<T[number]>, $InferUnionInput<T[number]>> {
   def: $ZodUnionDef<T>;
   isst: errors.$ZodIssueInvalidUnion;
   pattern: T[number]["_zod"]["pattern"];
 }
 
-export interface $ZodUnion<T extends readonly $ZodType[] = readonly $ZodType[]> extends $ZodType {
+export interface $ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends $ZodType {
   _zod: $ZodUnionInternals<T>;
 }
 
@@ -1948,19 +1935,19 @@ export const $ZodUnion: core.$constructor<$ZodUnion> = /*@__PURE__*/ core.$const
 //////////////////////////////////////////////////////
 //////////////////////////////////////////////////////
 
-export interface $ZodDiscriminatedUnionDef<Options extends readonly $ZodType[] = readonly $ZodType[]>
+export interface $ZodDiscriminatedUnionDef<Options extends readonly SomeType[] = readonly $ZodType[]>
   extends $ZodUnionDef<Options> {
   discriminator: string;
   unionFallback?: boolean;
 }
 
-export interface $ZodDiscriminatedUnionInternals<Options extends readonly $ZodType[] = readonly $ZodType[]>
+export interface $ZodDiscriminatedUnionInternals<Options extends readonly SomeType[] = readonly $ZodType[]>
   extends $ZodUnionInternals<Options> {
   def: $ZodDiscriminatedUnionDef<Options>;
   propValues: util.PropValues;
 }
 
-export interface $ZodDiscriminatedUnion<T extends readonly $ZodType[] = readonly $ZodType[]> extends $ZodType {
+export interface $ZodDiscriminatedUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends $ZodType {
   _zod: $ZodDiscriminatedUnionInternals<T>;
 }
 
@@ -1974,7 +1961,6 @@ export const $ZodDiscriminatedUnion: core.$constructor<$ZodDiscriminatedUnion> =
       const propValues: util.PropValues = {};
       for (const option of def.options) {
         const pv = option._zod.propValues;
-        console.dir(pv, { depth: null });
         if (!pv || Object.keys(pv).length === 0)
           throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
         for (const [k, v] of Object.entries(pv!)) {
@@ -2047,19 +2033,20 @@ export const $ZodDiscriminatedUnion: core.$constructor<$ZodDiscriminatedUnion> =
 ////////////////////////////////////////////////
 ////////////////////////////////////////////////
 
-export interface $ZodIntersectionDef extends $ZodTypeDef {
+export interface $ZodIntersectionDef<Left extends SomeType = $ZodType, Right extends SomeType = $ZodType>
+  extends $ZodTypeDef {
   type: "intersection";
-  left: $ZodType;
-  right: $ZodType;
+  left: Left;
+  right: Right;
 }
 
-export interface $ZodIntersectionInternals<A extends $ZodType = $ZodType, B extends $ZodType = $ZodType>
+export interface $ZodIntersectionInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType>
   extends $ZodTypeInternals<core.output<A> & core.output<B>, core.input<A> & core.input<B>> {
-  def: $ZodIntersectionDef;
+  def: $ZodIntersectionDef<A, B>;
   isst: never;
 }
 
-export interface $ZodIntersection<A extends $ZodType = $ZodType, B extends $ZodType = $ZodType> extends $ZodType {
+export interface $ZodIntersection<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
   _zod: $ZodIntersectionInternals<A, B>;
 }
 
@@ -2171,40 +2158,40 @@ function handleIntersectionResults(result: ParsePayload, left: ParsePayload, rig
 /////////////////////////////////////////
 
 export interface $ZodTupleDef<
-  T extends util.TupleItems = util.TupleItems,
-  Rest extends $ZodType | null = $ZodType | null,
+  T extends util.TupleItems = readonly $ZodType[],
+  Rest extends SomeType | null = $ZodType | null,
 > extends $ZodTypeDef {
   type: "tuple";
   items: T;
   rest: Rest;
 }
 
-export type $InferTupleInputType<T extends util.TupleItems, Rest extends $ZodType | null> = [
+export type $InferTupleInputType<T extends util.TupleItems, Rest extends SomeType | null> = [
   ...TupleInputTypeWithOptionals<T>,
-  ...(Rest extends $ZodType ? core.input<Rest>[] : []),
+  ...(Rest extends SomeType ? core.input<Rest>[] : []),
 ];
 type TupleInputTypeNoOptionals<T extends util.TupleItems> = {
   [k in keyof T]: core.input<T[k]>;
 };
 type TupleInputTypeWithOptionals<T extends util.TupleItems> = T extends readonly [
-  ...infer Prefix extends $ZodType[],
-  infer Tail extends $ZodType,
+  ...infer Prefix extends SomeType[],
+  infer Tail extends SomeType,
 ]
   ? Tail["_zod"]["optin"] extends "optional"
-    ? [...TupleInputTypeWithOptionals<Prefix>, Tail["_zod"]["input"]?]
+    ? [...TupleInputTypeWithOptionals<Prefix>, core.input<Tail>?]
     : TupleInputTypeNoOptionals<T>
   : [];
 
-export type $InferTupleOutputType<T extends util.TupleItems, Rest extends $ZodType | null> = [
+export type $InferTupleOutputType<T extends util.TupleItems, Rest extends SomeType | null> = [
   ...TupleOutputTypeWithOptionals<T>,
-  ...(Rest extends $ZodType ? core.output<Rest>[] : []),
+  ...(Rest extends SomeType ? core.output<Rest>[] : []),
 ];
 type TupleOutputTypeNoOptionals<T extends util.TupleItems> = {
   [k in keyof T]: core.output<T[k]>;
 };
 type TupleOutputTypeWithOptionals<T extends util.TupleItems> = T extends readonly [
-  ...infer Prefix extends $ZodType[],
-  infer Tail extends $ZodType,
+  ...infer Prefix extends SomeType[],
+  infer Tail extends SomeType,
 ]
   ? Tail["_zod"]["optout"] extends "optional"
     ? [...TupleOutputTypeWithOptionals<Prefix>, core.output<Tail>?]
@@ -2212,15 +2199,17 @@ type TupleOutputTypeWithOptionals<T extends util.TupleItems> = T extends readonl
   : [];
 
 export interface $ZodTupleInternals<
-  T extends util.TupleItems = util.TupleItems,
-  Rest extends $ZodType | null = $ZodType | null,
+  T extends util.TupleItems = readonly $ZodType[],
+  Rest extends SomeType | null = $ZodType | null,
 > extends $ZodTypeInternals<$InferTupleOutputType<T, Rest>, $InferTupleInputType<T, Rest>> {
   def: $ZodTupleDef<T, Rest>;
   isst: errors.$ZodIssueInvalidType | errors.$ZodIssueTooBig<unknown[]> | errors.$ZodIssueTooSmall<unknown[]>;
 }
 
-export interface $ZodTuple<T extends util.TupleItems = util.TupleItems, Rest extends $ZodType | null = $ZodType | null>
-  extends $ZodType {
+export interface $ZodTuple<
+  T extends util.TupleItems = readonly $ZodType[],
+  Rest extends SomeType | null = $ZodType | null,
+> extends $ZodType {
   _zod: $ZodTupleInternals<T, Rest>;
 }
 
@@ -2318,15 +2307,16 @@ function handleTupleResult(result: ParsePayload, final: ParsePayload<any[]>, ind
 //////////////////////////////////////////
 
 export type $ZodRecordKey = $ZodType<string | number | symbol, string | number | symbol>; // $HasValues | $HasPattern;
-export interface $ZodRecordDef extends $ZodTypeDef {
+export interface $ZodRecordDef<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType>
+  extends $ZodTypeDef {
   type: "record";
-  keyType: $ZodRecordKey;
-  valueType: $ZodType;
+  keyType: Key;
+  valueType: Value;
 }
 
 export type $InferZodRecordOutput<
   Key extends $ZodRecordKey = $ZodRecordKey,
-  Value extends $ZodType = $ZodType,
+  Value extends SomeType = $ZodType,
 > = undefined extends Key["_zod"]["values"]
   ? string extends core.output<Key>
     ? Record<core.output<Key>, core.output<Value>>
@@ -2339,7 +2329,7 @@ export type $InferZodRecordOutput<
 
 export type $InferZodRecordInput<
   Key extends $ZodRecordKey = $ZodRecordKey,
-  Value extends $ZodType = $ZodType,
+  Value extends SomeType = $ZodType,
 > = undefined extends Key["_zod"]["values"]
   ? string extends core.input<Key>
     ? Record<core.input<Key>, core.input<Value>>
@@ -2350,13 +2340,13 @@ export type $InferZodRecordInput<
         : Partial<Record<core.input<Key>, core.input<Value>>>
   : Record<core.input<Key>, core.input<Value>>;
 
-export interface $ZodRecordInternals<Key extends $ZodRecordKey = $ZodRecordKey, Value extends $ZodType = $ZodType>
+export interface $ZodRecordInternals<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType>
   extends $ZodTypeInternals<$InferZodRecordOutput<Key, Value>, $InferZodRecordInput<Key, Value>> {
-  def: $ZodRecordDef;
+  def: $ZodRecordDef<Key, Value>;
   isst: errors.$ZodIssueInvalidType | errors.$ZodIssueInvalidKey<Record<PropertyKey, unknown>>;
 }
 
-export interface $ZodRecord<Key extends $ZodRecordKey = $ZodRecordKey, Value extends $ZodType = $ZodType>
+export interface $ZodRecord<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType>
   extends $ZodType {
   _zod: $ZodRecordInternals<Key, Value>;
 }
@@ -2476,19 +2466,19 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
 //////////                   //////////
 ///////////////////////////////////////
 ///////////////////////////////////////
-export interface $ZodMapDef extends $ZodTypeDef {
+export interface $ZodMapDef<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType> extends $ZodTypeDef {
   type: "map";
-  keyType: $ZodType;
-  valueType: $ZodType;
+  keyType: Key;
+  valueType: Value;
 }
 
-export interface $ZodMapInternals<Key extends $ZodType = $ZodType, Value extends $ZodType = $ZodType>
+export interface $ZodMapInternals<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType>
   extends $ZodTypeInternals<Map<core.output<Key>, core.output<Value>>, Map<core.input<Key>, core.input<Value>>> {
-  def: $ZodMapDef;
+  def: $ZodMapDef<Key, Value>;
   isst: errors.$ZodIssueInvalidType | errors.$ZodIssueInvalidKey | errors.$ZodIssueInvalidElement<unknown>;
 }
 
-export interface $ZodMap<Key extends $ZodType = $ZodType, Value extends $ZodType = $ZodType> extends $ZodType {
+export interface $ZodMap<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType> extends $ZodType {
   _zod: $ZodMapInternals<Key, Value>;
 }
 
@@ -2576,18 +2566,18 @@ function handleMapResult(
 //////////                   //////////
 ///////////////////////////////////////
 ///////////////////////////////////////
-export interface $ZodSetDef extends $ZodTypeDef {
+export interface $ZodSetDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
   type: "set";
-  valueType: $ZodType;
+  valueType: T;
 }
 
-export interface $ZodSetInternals<T extends $ZodType = $ZodType>
+export interface $ZodSetInternals<T extends SomeType = $ZodType>
   extends $ZodTypeInternals<Set<core.output<T>>, Set<core.input<T>>> {
-  def: $ZodSetDef;
+  def: $ZodSetDef<T>;
   isst: errors.$ZodIssueInvalidType;
 }
 
-export interface $ZodSet<T extends $ZodType = $ZodType> extends $ZodType {
+export interface $ZodSet<T extends SomeType = $ZodType> extends $ZodType {
   _zod: $ZodSetInternals<T>;
 }
 
@@ -2856,7 +2846,6 @@ export const $ZodTransform: core.$constructor<$ZodTransform> = /*@__PURE__*/ cor
     $ZodType.init(inst, def);
     inst._zod.parse = (payload, _ctx) => {
       const _out = def.transform(payload.value, payload);
-
       if (_ctx.async) {
         const output = _out instanceof Promise ? _out : Promise.resolve(_out);
         return output.then((output) => {
@@ -2882,12 +2871,12 @@ export const $ZodTransform: core.$constructor<$ZodTransform> = /*@__PURE__*/ cor
 //////////                        //////////
 ////////////////////////////////////////////
 ////////////////////////////////////////////
-export interface $ZodOptionalDef<T extends $ZodType = $ZodType> extends $ZodTypeDef {
+export interface $ZodOptionalDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
   type: "optional";
   innerType: T;
 }
 
-export interface $ZodOptionalInternals<T extends $ZodType = $ZodType>
+export interface $ZodOptionalInternals<T extends SomeType = $ZodType>
   extends $ZodTypeInternals<core.output<T> | undefined, core.input<T> | undefined> {
   def: $ZodOptionalDef<T>;
   optin: "optional";
@@ -2897,7 +2886,7 @@ export interface $ZodOptionalInternals<T extends $ZodType = $ZodType>
   pattern: T["_zod"]["pattern"];
 }
 
-export interface $ZodOptional<T extends $ZodType = $ZodType> extends $ZodType {
+export interface $ZodOptional<T extends SomeType = $ZodType> extends $ZodType {
   _zod: $ZodOptionalInternals<T>;
 }
 
@@ -2932,12 +2921,12 @@ export const $ZodOptional: core.$constructor<$ZodOptional> = /*@__PURE__*/ core.
 //////////                        //////////
 ////////////////////////////////////////////
 ////////////////////////////////////////////
-export interface $ZodNullableDef<T extends $ZodType = $ZodType> extends $ZodTypeDef {
+export interface $ZodNullableDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
   type: "nullable";
   innerType: T;
 }
 
-export interface $ZodNullableInternals<T extends $ZodType = $ZodType>
+export interface $ZodNullableInternals<T extends SomeType = $ZodType>
   extends $ZodTypeInternals<core.output<T> | null, core.input<T> | null> {
   def: $ZodNullableDef<T>;
   optin: T["_zod"]["optin"];
@@ -2947,7 +2936,7 @@ export interface $ZodNullableInternals<T extends $ZodType = $ZodType>
   pattern: T["_zod"]["pattern"];
 }
 
-export interface $ZodNullable<T extends $ZodType = $ZodType> extends $ZodType {
+export interface $ZodNullable<T extends SomeType = $ZodType> extends $ZodType {
   _zod: $ZodNullableInternals<T>;
 }
 
@@ -2982,14 +2971,14 @@ export const $ZodNullable: core.$constructor<$ZodNullable> = /*@__PURE__*/ core.
 //////////                        //////////
 ////////////////////////////////////////////
 ////////////////////////////////////////////
-export interface $ZodDefaultDef<T extends $ZodType = $ZodType> extends $ZodTypeDef {
+export interface $ZodDefaultDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
   type: "default";
   innerType: T;
   /** The default value. May be a getter. */
   defaultValue: util.NoUndefined<core.output<T>>;
 }
 
-export interface $ZodDefaultInternals<T extends $ZodType = $ZodType>
+export interface $ZodDefaultInternals<T extends SomeType = $ZodType>
   extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, core.input<T> | undefined> {
   def: $ZodDefaultDef<T>;
   optin: "optional";
@@ -2997,7 +2986,7 @@ export interface $ZodDefaultInternals<T extends $ZodType = $ZodType>
   values: T["_zod"]["values"];
 }
 
-export interface $ZodDefault<T extends $ZodType = $ZodType> extends $ZodType {
+export interface $ZodDefault<T extends SomeType = $ZodType> extends $ZodType {
   _zod: $ZodDefaultInternals<T>;
 }
 
@@ -3042,14 +3031,14 @@ function handleDefaultResult(payload: ParsePayload, def: $ZodDefaultDef) {
 ////////////////////////////////////////////
 ////////////////////////////////////////////
 
-export interface $ZodPrefaultDef<T extends $ZodType = $ZodType> extends $ZodTypeDef {
+export interface $ZodPrefaultDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
   type: "prefault";
   innerType: T;
   /** The default value. May be a getter. */
   defaultValue: core.input<T>;
 }
 
-export interface $ZodPrefaultInternals<T extends $ZodType = $ZodType>
+export interface $ZodPrefaultInternals<T extends SomeType = $ZodType>
   extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, core.input<T> | undefined> {
   def: $ZodPrefaultDef<T>;
   optin: "optional";
@@ -3057,7 +3046,7 @@ export interface $ZodPrefaultInternals<T extends $ZodType = $ZodType>
   values: T["_zod"]["values"];
 }
 
-export interface $ZodPrefault<T extends $ZodType = $ZodType> extends $ZodType {
+export interface $ZodPrefault<T extends SomeType = $ZodType> extends $ZodType {
   _zod: $ZodPrefaultInternals<T>;
 }
 
@@ -3085,19 +3074,19 @@ export const $ZodPrefault: core.$constructor<$ZodPrefault> = /*@__PURE__*/ core.
 //////////                           //////////
 ///////////////////////////////////////////////
 ///////////////////////////////////////////////
-export interface $ZodNonOptionalDef<T extends $ZodType = $ZodType> extends $ZodTypeDef {
+export interface $ZodNonOptionalDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
   type: "nonoptional";
   innerType: T;
 }
 
-export interface $ZodNonOptionalInternals<T extends $ZodType = $ZodType>
+export interface $ZodNonOptionalInternals<T extends SomeType = $ZodType>
   extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, util.NoUndefined<core.input<T>>> {
   def: $ZodNonOptionalDef<T>;
   isst: errors.$ZodIssueInvalidType;
   values: T["_zod"]["values"];
 }
 
-export interface $ZodNonOptional<T extends $ZodType = $ZodType> extends $ZodType {
+export interface $ZodNonOptional<T extends SomeType = $ZodType> extends $ZodType {
   _zod: $ZodNonOptionalInternals<T>;
 }
 
@@ -3180,17 +3169,17 @@ function handleNonOptionalResult(payload: ParsePayload, inst: $ZodNonOptional) {
 //////////                         //////////
 /////////////////////////////////////////////
 /////////////////////////////////////////////
-export interface $ZodSuccessDef extends $ZodTypeDef {
+export interface $ZodSuccessDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
   type: "success";
-  innerType: $ZodType;
+  innerType: T;
 }
 
-export interface $ZodSuccessInternals<T extends $ZodType = $ZodType> extends $ZodTypeInternals<boolean, core.input<T>> {
-  def: $ZodSuccessDef;
+export interface $ZodSuccessInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<boolean, core.input<T>> {
+  def: $ZodSuccessDef<T>;
   isst: never;
 }
 
-export interface $ZodSuccess<T extends $ZodType = $ZodType> extends $ZodType {
+export interface $ZodSuccess<T extends SomeType = $ZodType> extends $ZodType {
   _zod: $ZodSuccessInternals<T>;
 }
 
@@ -3226,15 +3215,15 @@ export interface $ZodCatchCtx extends ParsePayload {
   /** @deprecated Use `ctx.value` */
   input: unknown;
 }
-export interface $ZodCatchDef extends $ZodTypeDef {
+export interface $ZodCatchDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
   type: "catch";
-  innerType: $ZodType;
+  innerType: T;
   catchValue: (ctx: $ZodCatchCtx) => unknown;
 }
 
-export interface $ZodCatchInternals<T extends $ZodType = $ZodType>
+export interface $ZodCatchInternals<T extends SomeType = $ZodType>
   extends $ZodTypeInternals<core.output<T>, core.input<T> | util.Whatever> {
-  def: $ZodCatchDef;
+  def: $ZodCatchDef<T>;
   // qin: T["_zod"]["qin"];
   // qout: T["_zod"]["qout"];
 
@@ -3244,7 +3233,7 @@ export interface $ZodCatchInternals<T extends $ZodType = $ZodType>
   values: T["_zod"]["values"];
 }
 
-export interface $ZodCatch<T extends $ZodType = $ZodType> extends $ZodType {
+export interface $ZodCatch<T extends SomeType = $ZodType> extends $ZodType {
   _zod: $ZodCatchInternals<T>;
 }
 
@@ -3334,13 +3323,13 @@ export const $ZodNaN: core.$constructor<$ZodNaN> = /*@__PURE__*/ core.$construct
 //////////                        //////////
 ////////////////////////////////////////////
 ////////////////////////////////////////////
-export interface $ZodPipeDef<A extends $ZodType = $ZodType, B extends $ZodType = $ZodType> extends $ZodTypeDef {
+export interface $ZodPipeDef<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodTypeDef {
   type: "pipe";
   in: A;
   out: B;
 }
 
-export interface $ZodPipeInternals<A extends $ZodType = $ZodType, B extends $ZodType = $ZodType>
+export interface $ZodPipeInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType>
   extends $ZodTypeInternals<core.output<B>, core.input<A>> {
   def: $ZodPipeDef<A, B>;
   isst: never;
@@ -3349,7 +3338,7 @@ export interface $ZodPipeInternals<A extends $ZodType = $ZodType, B extends $Zod
   optout: B["_zod"]["optout"];
 }
 
-export interface $ZodPipe<A extends $ZodType = $ZodType, B extends $ZodType = $ZodType> extends $ZodType {
+export interface $ZodPipe<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
   _zod: $ZodPipeInternals<A, B>;
 }
 
@@ -3372,7 +3361,6 @@ function handlePipeResult(left: ParsePayload, def: $ZodPipeDef, ctx: ParseContex
   if (util.aborted(left)) {
     return left;
   }
-
   return def.out._zod.run({ value: left.value, issues: left.issues }, ctx);
 }
 
@@ -3384,21 +3372,21 @@ function handlePipeResult(left: ParsePayload, def: $ZodPipeDef, ctx: ParseContex
 ////////////////////////////////////////////
 ////////////////////////////////////////////
 
-export interface $ZodReadonlyDef extends $ZodTypeDef {
+export interface $ZodReadonlyDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
   type: "readonly";
-  innerType: $ZodType;
+  innerType: T;
 }
 
-export interface $ZodReadonlyInternals<T extends $ZodType = $ZodType>
+export interface $ZodReadonlyInternals<T extends SomeType = $ZodType>
   extends $ZodTypeInternals<util.MakeReadonly<core.output<T>>, util.MakeReadonly<core.input<T>>> {
-  def: $ZodReadonlyDef;
+  def: $ZodReadonlyDef<T>;
   optin: T["_zod"]["optin"];
   optout: T["_zod"]["optout"];
   isst: never;
   propValues: T["_zod"]["propValues"];
 }
 
-export interface $ZodReadonly<T extends $ZodType = $ZodType> extends $ZodType {
+export interface $ZodReadonly<T extends SomeType = $ZodType> extends $ZodType {
   _zod: $ZodReadonlyInternals<T>;
 }
 
@@ -3463,12 +3451,38 @@ type AppendToTemplateLiteral<
   Suffix extends LiteralPart | $ZodType,
 > = Suffix extends LiteralPart
   ? `${Template}${UndefinedToEmptyString<Suffix>}`
-  : `${Template}${UndefinedToEmptyString<LiteralPart & core.output<Suffix & $ZodType>>}`;
+  : Suffix extends $ZodType
+    ? `${Template}${core.output<Suffix> extends infer T extends LiteralPart ? UndefinedToEmptyString<T> : never}`
+    : never;
 
+export type ConcatenateTupleOfStrings<T extends string[]> = T extends [
+  infer First extends string,
+  ...infer Rest extends string[],
+]
+  ? Rest extends string[]
+    ? First extends ""
+      ? ConcatenateTupleOfStrings<Rest>
+      : `${First}${ConcatenateTupleOfStrings<Rest>}`
+    : never
+  : "";
+export type ConvertPartsToStringTuple<Parts extends $ZodTemplateLiteralPart[]> = {
+  [K in keyof Parts]: Parts[K] extends LiteralPart
+    ? `${UndefinedToEmptyString<Parts[K]>}`
+    : Parts[K] extends $ZodType
+      ? `${core.output<Parts[K]> extends infer T extends LiteralPart ? UndefinedToEmptyString<T> : never}`
+      : never;
+};
+
+export type ToTemplateLiteral<Parts extends $ZodTemplateLiteralPart[]> = ConcatenateTupleOfStrings<
+  ConvertPartsToStringTuple<Parts>
+>;
+// type lkjasd = ConcatenateTupleOfStrings<["Hello", " ", "World", "!"]>; // "Hello World!"
 export type $PartsToTemplateLiteral<Parts extends $ZodTemplateLiteralPart[]> = [] extends Parts
   ? ``
-  : Parts extends [...infer Rest extends $ZodTemplateLiteralPart[], infer Last extends $ZodTemplateLiteralPart]
-    ? AppendToTemplateLiteral<$PartsToTemplateLiteral<Rest>, Last>
+  : Parts extends [...infer Rest, infer Last extends $ZodTemplateLiteralPart]
+    ? Rest extends $ZodTemplateLiteralPart[]
+      ? AppendToTemplateLiteral<$PartsToTemplateLiteral<Rest>, Last>
+      : never
     : never;
 
 export const $ZodTemplateLiteral: core.$constructor<$ZodTemplateLiteral> = /*@__PURE__*/ core.$constructor(
@@ -3534,18 +3548,18 @@ export const $ZodTemplateLiteral: core.$constructor<$ZodTemplateLiteral> = /*@__
 //////////                     //////////
 /////////////////////////////////////////
 /////////////////////////////////////////
-export interface $ZodPromiseDef extends $ZodTypeDef {
+export interface $ZodPromiseDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
   type: "promise";
-  innerType: $ZodType;
+  innerType: T;
 }
 
-export interface $ZodPromiseInternals<T extends $ZodType = $ZodType>
+export interface $ZodPromiseInternals<T extends SomeType = $ZodType>
   extends $ZodTypeInternals<core.output<T>, util.MaybeAsync<core.input<T>>> {
-  def: $ZodPromiseDef;
+  def: $ZodPromiseDef<T>;
   isst: never;
 }
 
-export interface $ZodPromise<T extends $ZodType = $ZodType> extends $ZodType {
+export interface $ZodPromise<T extends SomeType = $ZodType> extends $ZodType {
   _zod: $ZodPromiseInternals<T>;
 }
 
@@ -3568,14 +3582,14 @@ export const $ZodPromise: core.$constructor<$ZodPromise> = /*@__PURE__*/ core.$c
 //////////////////////////////////////////
 //////////////////////////////////////////
 
-export interface $ZodLazyDef extends $ZodTypeDef {
+export interface $ZodLazyDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
   type: "lazy";
-  getter: () => $ZodType;
+  getter: () => T;
 }
 
-export interface $ZodLazyInternals<T extends $ZodType = $ZodType>
+export interface $ZodLazyInternals<T extends SomeType = $ZodType>
   extends $ZodTypeInternals<core.output<T>, core.input<T>> {
-  def: $ZodLazyDef;
+  def: $ZodLazyDef<T>;
   isst: never;
   /** Auto-cached way to retrieve the inner schema */
   innerType: T;
@@ -3585,14 +3599,14 @@ export interface $ZodLazyInternals<T extends $ZodType = $ZodType>
   optout: T["_zod"]["optout"];
 }
 
-export interface $ZodLazy<T extends $ZodType = $ZodType> extends $ZodType {
+export interface $ZodLazy<T extends SomeType = $ZodType> extends $ZodType {
   _zod: $ZodLazyInternals<T>;
 }
 
 export const $ZodLazy: core.$constructor<$ZodLazy> = /*@__PURE__*/ core.$constructor("$ZodLazy", (inst, def) => {
   $ZodType.init(inst, def);
 
-  util.defineLazy(inst._zod, "innerType", () => def.getter());
+  util.defineLazy(inst._zod, "innerType", () => def.getter() as $ZodType);
   util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType._zod.pattern);
   util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType._zod.propValues);
   util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin);
diff --git a/packages/zod/src/v4/core/to-json-schema.ts b/packages/zod/src/v4/core/to-json-schema.ts
index bae260bf..d710d606 100644
--- a/packages/zod/src/v4/core/to-json-schema.ts
+++ b/packages/zod/src/v4/core/to-json-schema.ts
@@ -432,8 +432,13 @@ export class JSONSchemaGenerator {
             // do nothing (an undefined literal was stripped)
           } else if (vals.length === 1) {
             const val = vals[0];
+            json.type = val === null ? "null" : typeof val;
             json.const = val;
           } else {
+            if (vals.every((v) => typeof v === "number")) json.type = "number";
+            if (vals.every((v) => typeof v === "string")) json.type = "string";
+            if (vals.every((v) => typeof v === "boolean")) json.type = "string";
+            if (vals.every((v) => v === null)) json.type = "null";
             json.enum = vals;
           }
           break;
diff --git a/packages/zod/src/v4/core/util.ts b/packages/zod/src/v4/core/util.ts
index 314fa822..8be11918 100644
--- a/packages/zod/src/v4/core/util.ts
+++ b/packages/zod/src/v4/core/util.ts
@@ -143,7 +143,7 @@ export type Extend<A extends SomeObject, B extends SomeObject> = Flatten<
       }
 >;
 
-export type TupleItems = ReadonlyArray<schemas.$ZodType>;
+export type TupleItems = ReadonlyArray<schemas.SomeType>;
 export type AnyFunc = (...args: any[]) => any;
 export type IsProp<T, K extends keyof T> = T[K] extends AnyFunc ? never : K;
 export type MaybeAsync<T> = T | Promise<T>;
@@ -156,7 +156,7 @@ export type ExtractIndexSignature<T> = {
 };
 export type Keys<T extends object> = keyof OmitIndexSignature<T>;
 
-export type SchemaClass<T extends schemas.$ZodType> = {
+export type SchemaClass<T extends schemas.SomeType> = {
   new (def: T["_zod"]["def"]): T;
 };
 export type EnumValue = string | number; // | bigint | boolean | symbol;
@@ -179,13 +179,8 @@ export type SafeParseError<T> = {
   error: errors.$ZodError<T>;
 };
 
-// export type DiscriminatorMapElement = {
-//   values: Set<Primitive>;
-//   maps: DiscriminatorMap[];
-// };
 export type PropValues = Record<string, Set<Primitive>>;
 export type PrimitiveSet = Set<Primitive>;
-export type DiscriminatorMap = Map<Primitive, schemas.$ZodType>;
 
 // functions
 export function assertEqual<A, B>(val: AssertEqual<A, B>): AssertEqual<A, B> {
@@ -333,12 +328,27 @@ export const allowsEval: { value: boolean } = cached(() => {
   }
 });
 
-export function isPlainObject(data: any): data is Record<PropertyKey, unknown> {
-  return (
-    typeof data === "object" &&
-    data !== null &&
-    (Object.getPrototypeOf(data) === Object.prototype || Object.getPrototypeOf(data) === null)
-  );
+function _isObject(o: any) {
+  return Object.prototype.toString.call(o) === "[object Object]";
+}
+
+export function isPlainObject(o: any): o is Record<PropertyKey, unknown> {
+  if (isObject(o) === false) return false;
+
+  // modified constructor
+  const ctor = o.constructor;
+  if (ctor === undefined) return true;
+
+  // modified prototype
+  const prot = ctor.prototype;
+  if (isObject(prot) === false) return false;
+
+  // ctor doesn't have static `isPrototypeOf`
+  if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
+    return false;
+  }
+
+  return true;
 }
 
 export function numKeys(data: any): number {
diff --git a/packages/zod/src/v4/locales/index.ts b/packages/zod/src/v4/locales/index.ts
index aa329851..570653d4 100644
--- a/packages/zod/src/v4/locales/index.ts
+++ b/packages/zod/src/v4/locales/index.ts
@@ -22,6 +22,7 @@ export { default as ms } from "./ms.js";
 export { default as nl } from "./nl.js";
 export { default as no } from "./no.js";
 export { default as ota } from "./ota.js";
+export { default as ps } from "./ps.js";
 export { default as pl } from "./pl.js";
 export { default as pt } from "./pt.js";
 export { default as ru } from "./ru.js";
diff --git a/packages/zod/src/v4/locales/ja.ts b/packages/zod/src/v4/locales/ja.ts
index 646bacbd..3a602c96 100644
--- a/packages/zod/src/v4/locales/ja.ts
+++ b/packages/zod/src/v4/locales/ja.ts
@@ -78,18 +78,18 @@ const error: () => errors.$ZodErrorMap = () => {
         if (issue.values.length === 1) return `無効な入力: ${util.stringifyPrimitive(issue.values[0])}が期待されました`;
         return `無効な選択: ${util.joinValues(issue.values, "、")}のいずれかである必要があります`;
       case "too_big": {
-        const adj = issue.inclusive ? "<=" : "<";
+        const adj = issue.inclusive ? "以下である" : "より小さい";
         const sizing = getSizing(issue.origin);
         if (sizing)
-          return `大きすぎる値: ${issue.origin ?? "値"}は${issue.maximum.toString()}${sizing.unit ?? "要素"}${adj}である必要があります`;
-        return `大きすぎる値: ${issue.origin ?? "値"}は${issue.maximum.toString()}${adj}である必要があります`;
+          return `大きすぎる値: ${issue.origin ?? "値"}は${issue.maximum.toString()}${sizing.unit ?? "要素"}${adj}必要があります`;
+        return `大きすぎる値: ${issue.origin ?? "値"}は${issue.maximum.toString()}${adj}必要があります`;
       }
       case "too_small": {
-        const adj = issue.inclusive ? ">=" : ">";
+        const adj = issue.inclusive ? "以上である" : "より大きい";
         const sizing = getSizing(issue.origin);
         if (sizing)
-          return `小さすぎる値: ${issue.origin}は${issue.minimum.toString()}${sizing.unit}${adj}である必要があります`;
-        return `小さすぎる値: ${issue.origin}は${issue.minimum.toString()}${adj}である必要があります`;
+          return `小さすぎる値: ${issue.origin}は${issue.minimum.toString()}${sizing.unit}${adj}必要があります`;
+        return `小さすぎる値: ${issue.origin}は${issue.minimum.toString()}${adj}必要があります`;
       }
       case "invalid_format": {
         const _issue = issue as errors.$ZodStringFormatIssues;
diff --git a/packages/zod/src/v4/locales/ps.ts b/packages/zod/src/v4/locales/ps.ts
new file mode 100644
index 00000000..ba3a62eb
--- /dev/null
+++ b/packages/zod/src/v4/locales/ps.ts
@@ -0,0 +1,133 @@
+import type { $ZodStringFormats } from "../core/checks.js";
+import type * as errors from "../core/errors.js";
+import * as util from "../core/util.js";
+
+const error: () => errors.$ZodErrorMap = () => {
+  const Sizable: Record<string, { unit: string; verb: string }> = {
+    string: { unit: "توکي", verb: "ولري" },
+    file: { unit: "بایټس", verb: "ولري" },
+    array: { unit: "توکي", verb: "ولري" },
+    set: { unit: "توکي", verb: "ولري" },
+  };
+
+  function getSizing(origin: string): { unit: string; verb: string } | null {
+    return Sizable[origin] ?? null;
+  }
+
+  const parsedType = (data: any): string => {
+    const t = typeof data;
+
+    switch (t) {
+      case "number": {
+        return Number.isNaN(data) ? "NaN" : "عدد";
+      }
+      case "object": {
+        if (Array.isArray(data)) {
+          return "ارې";
+        }
+        if (data === null) {
+          return "null";
+        }
+        if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
+          return data.constructor.name;
+        }
+      }
+    }
+    return t;
+  };
+
+  const Nouns: {
+    [k in $ZodStringFormats | (string & {})]?: string;
+  } = {
+    regex: "ورودي",
+    email: "بریښنالیک",
+    url: "یو آر ال",
+    emoji: "ایموجي",
+    uuid: "UUID",
+    uuidv4: "UUIDv4",
+    uuidv6: "UUIDv6",
+    nanoid: "nanoid",
+    guid: "GUID",
+    cuid: "cuid",
+    cuid2: "cuid2",
+    ulid: "ULID",
+    xid: "XID",
+    ksuid: "KSUID",
+    datetime: "نیټه او وخت",
+    date: "نېټه",
+    time: "وخت",
+    duration: "موده",
+    ipv4: "د IPv4 پته",
+    ipv6: "د IPv6 پته",
+    cidrv4: "د IPv4 ساحه",
+    cidrv6: "د IPv6 ساحه",
+    base64: "base64-encoded متن",
+    base64url: "base64url-encoded متن",
+    json_string: "JSON متن",
+    e164: "د E.164 شمېره",
+    jwt: "JWT",
+    template_literal: "ورودي",
+  };
+
+  return (issue) => {
+    switch (issue.code) {
+      case "invalid_type":
+        return `ناسم ورودي: باید ${issue.expected} وای, مګر ${parsedType(issue.input)} ترلاسه شو`;
+      case "invalid_value":
+        if (issue.values.length === 1) {
+          return `ناسم ورودي: باید ${util.stringifyPrimitive(issue.values[0])} وای`;
+        }
+        return `ناسم انتخاب: باید یو له ${util.joinValues(issue.values, "|")} څخه وای`;
+      case "too_big": {
+        const adj = issue.inclusive ? "<=" : "<";
+        const sizing = getSizing(issue.origin);
+        if (sizing) {
+          return `ډیر لوی: ${issue.origin ?? "ارزښت"} باید ${adj}${issue.maximum.toString()} ${sizing.unit ?? "عنصرونه"} ولري`;
+        }
+        return `ډیر لوی: ${issue.origin ?? "ارزښت"} باید ${adj}${issue.maximum.toString()} وي`;
+      }
+      case "too_small": {
+        const adj = issue.inclusive ? ">=" : ">";
+        const sizing = getSizing(issue.origin);
+        if (sizing) {
+          return `ډیر کوچنی: ${issue.origin} باید ${adj}${issue.minimum.toString()} ${sizing.unit} ولري`;
+        }
+        return `ډیر کوچنی: ${issue.origin} باید ${adj}${issue.minimum.toString()} وي`;
+      }
+      case "invalid_format": {
+        const _issue = issue as errors.$ZodStringFormatIssues;
+        if (_issue.format === "starts_with") {
+          return `ناسم متن: باید د "${_issue.prefix}" سره پیل شي`;
+        }
+        if (_issue.format === "ends_with") {
+          return `ناسم متن: باید د "${_issue.suffix}" سره پای ته ورسيږي`;
+        }
+        if (_issue.format === "includes") {
+          return `ناسم متن: باید "${_issue.includes}" ولري`;
+        }
+        if (_issue.format === "regex") {
+          return `ناسم متن: باید د ${_issue.pattern} سره مطابقت ولري`;
+        }
+        return `${Nouns[_issue.format] ?? issue.format} ناسم دی`;
+      }
+      case "not_multiple_of":
+        return `ناسم عدد: باید د ${issue.divisor} مضرب وي`;
+      case "unrecognized_keys":
+        return `ناسم ${issue.keys.length > 1 ? "کلیډونه" : "کلیډ"}: ${util.joinValues(issue.keys, ", ")}`;
+      case "invalid_key":
+        return `ناسم کلیډ په ${issue.origin} کې`;
+      case "invalid_union":
+        return `ناسمه ورودي`;
+      case "invalid_element":
+        return `ناسم عنصر په ${issue.origin} کې`;
+      default:
+        return `ناسمه ورودي`;
+    }
+  };
+};
+
+export default function (): { localeError: errors.$ZodErrorMap } {
+  return {
+    localeError: error(),
+  };
+}
diff --git a/packages/zod/src/v4/mini/schemas.ts b/packages/zod/src/v4/mini/schemas.ts
index 12bd5529..dfef934e 100644
--- a/packages/zod/src/v4/mini/schemas.ts
+++ b/packages/zod/src/v4/mini/schemas.ts
@@ -2,11 +2,15 @@ import * as core from "zod/v4/core";
 import { util } from "zod/v4/core";
 import * as parse from "./parse.js";
 
-type SomeType = core.$ZodType;
+type SomeType = core.SomeType;
 
-export interface ZodMiniType<out Output = unknown, out Input = unknown> extends core.$ZodType<Output, Input> {
+export interface ZodMiniType<
+  out Output = unknown,
+  out Input = unknown,
+  out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>,
+> extends core.$ZodType<Output, Input, Internals> {
   check(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;
-  clone(def?: this["_zod"]["def"], params?: { parent: boolean }): this;
+  clone(def?: Internals["def"], params?: { parent: boolean }): this;
   register<R extends core.$ZodRegistry>(
     registry: R,
     ...meta: this extends R["_schema"]
@@ -17,9 +21,9 @@ export interface ZodMiniType<out Output = unknown, out Input = unknown> extends
   ): this;
   brand<T extends PropertyKey = PropertyKey>(
     value?: T
-  ): PropertyKey extends T ? this : this & Record<"_zod", Record<"~output", core.output<this> & core.$brand<T>>>;
+  ): PropertyKey extends T ? this : this & Record<"_zod", Record<"output", core.output<this> & core.$brand<T>>>;
 
-  def: this["_zod"]["def"];
+  def: Internals["def"];
 
   parse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): core.output<this>;
   safeParse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): util.SafeParseResult<core.output<this>>;
@@ -30,6 +34,9 @@ export interface ZodMiniType<out Output = unknown, out Input = unknown> extends
   ): Promise<util.SafeParseResult<core.output<this>>>;
 }
 
+interface _ZodMiniType<out Internals extends core.$ZodTypeInternals = core.$ZodTypeInternals>
+  extends ZodMiniType<any, any, Internals> {}
+
 export const ZodMiniType: core.$constructor<ZodMiniType> = /*@__PURE__*/ core.$constructor(
   "ZodMiniType",
   (inst, def) => {
@@ -64,10 +71,16 @@ export const ZodMiniType: core.$constructor<ZodMiniType> = /*@__PURE__*/ core.$c
   }
 );
 
-// ZodMiniString
-export interface ZodMiniString<Input = unknown> extends ZodMiniType {
-  _zod: core.$ZodStringInternals<Input>;
+export interface _ZodMiniString<T extends core.$ZodStringInternals<unknown> = core.$ZodStringInternals<unknown>>
+  extends _ZodMiniType<T>,
+    core.$ZodString<T["input"]> {
+  _zod: T;
 }
+
+// ZodMiniString
+export interface ZodMiniString<Input = unknown>
+  extends _ZodMiniString<core.$ZodStringInternals<Input>>,
+    core.$ZodString<Input> {}
 export const ZodMiniString: core.$constructor<ZodMiniString> = /*@__PURE__*/ core.$constructor(
   "ZodMiniString",
   (inst, def) => {
@@ -82,8 +95,9 @@ export function string(params?: string | core.$ZodStringParams): ZodMiniString<s
 
 // ZodMiniStringFormat
 export interface ZodMiniStringFormat<Format extends core.$ZodStringFormats = core.$ZodStringFormats>
-  extends ZodMiniString {
-  _zod: core.$ZodStringFormatInternals<Format>;
+  extends _ZodMiniString<core.$ZodStringFormatInternals<Format>>,
+    core.$ZodStringFormat<Format> {
+  // _zod: core.$ZodStringFormatInternals<Format>;
 }
 export const ZodMiniStringFormat: core.$constructor<ZodMiniStringFormat> = /*@__PURE__*/ core.$constructor(
   "ZodMiniStringFormat",
@@ -94,9 +108,7 @@ export const ZodMiniStringFormat: core.$constructor<ZodMiniStringFormat> = /*@__
 );
 
 // ZodMiniEmail
-export interface ZodMiniEmail extends ZodMiniStringFormat<"email"> {
-  _zod: core.$ZodEmailInternals;
-}
+export interface ZodMiniEmail extends _ZodMiniString<core.$ZodEmailInternals> {}
 export const ZodMiniEmail: core.$constructor<ZodMiniEmail> = /*@__PURE__*/ core.$constructor(
   "ZodMiniEmail",
   (inst, def) => {
@@ -110,8 +122,8 @@ export function email(params?: string | core.$ZodEmailParams): ZodMiniEmail {
 }
 
 // ZodMiniGUID
-export interface ZodMiniGUID extends ZodMiniStringFormat<"guid"> {
-  _zod: core.$ZodGUIDInternals;
+export interface ZodMiniGUID extends _ZodMiniString<core.$ZodGUIDInternals> {
+  // _zod: core.$ZodGUIDInternals;
 }
 export const ZodMiniGUID: core.$constructor<ZodMiniGUID> = /*@__PURE__*/ core.$constructor(
   "ZodMiniGUID",
@@ -126,8 +138,8 @@ export function guid(params?: string | core.$ZodGUIDParams): ZodMiniGUID {
 }
 
 // ZodMiniUUID
-export interface ZodMiniUUID extends ZodMiniStringFormat<"uuid"> {
-  _zod: core.$ZodUUIDInternals;
+export interface ZodMiniUUID extends _ZodMiniString<core.$ZodUUIDInternals> {
+  // _zod: core.$ZodUUIDInternals;
 }
 export const ZodMiniUUID: core.$constructor<ZodMiniUUID> = /*@__PURE__*/ core.$constructor(
   "ZodMiniUUID",
@@ -158,8 +170,8 @@ export function uuidv7(params?: string | core.$ZodUUIDv7Params): ZodMiniUUID {
 }
 
 // ZodMiniURL
-export interface ZodMiniURL extends ZodMiniStringFormat<"url"> {
-  _zod: core.$ZodURLInternals;
+export interface ZodMiniURL extends _ZodMiniString<core.$ZodURLInternals> {
+  // _zod: core.$ZodURLInternals;
 }
 export const ZodMiniURL: core.$constructor<ZodMiniURL> = /*@__PURE__*/ core.$constructor("ZodMiniURL", (inst, def) => {
   core.$ZodURL.init(inst, def);
@@ -171,8 +183,8 @@ export function url(params?: string | core.$ZodURLParams): ZodMiniURL {
 }
 
 // ZodMiniEmoji
-export interface ZodMiniEmoji extends ZodMiniStringFormat<"emoji"> {
-  _zod: core.$ZodEmojiInternals;
+export interface ZodMiniEmoji extends _ZodMiniString<core.$ZodEmojiInternals> {
+  // _zod: core.$ZodEmojiInternals;
 }
 export const ZodMiniEmoji: core.$constructor<ZodMiniEmoji> = /*@__PURE__*/ core.$constructor(
   "ZodMiniEmoji",
@@ -187,8 +199,8 @@ export function emoji(params?: string | core.$ZodEmojiParams): ZodMiniEmoji {
 }
 
 // ZodMiniNanoID
-export interface ZodMiniNanoID extends ZodMiniStringFormat<"nanoid"> {
-  _zod: core.$ZodNanoIDInternals;
+export interface ZodMiniNanoID extends _ZodMiniString<core.$ZodNanoIDInternals> {
+  // _zod: core.$ZodNanoIDInternals;
 }
 export const ZodMiniNanoID: core.$constructor<ZodMiniNanoID> = /*@__PURE__*/ core.$constructor(
   "ZodMiniNanoID",
@@ -203,8 +215,8 @@ export function nanoid(params?: string | core.$ZodNanoIDParams): ZodMiniNanoID {
 }
 
 // ZodMiniCUID
-export interface ZodMiniCUID extends ZodMiniStringFormat<"cuid"> {
-  _zod: core.$ZodCUIDInternals;
+export interface ZodMiniCUID extends _ZodMiniString<core.$ZodCUIDInternals> {
+  // _zod: core.$ZodCUIDInternals;
 }
 export const ZodMiniCUID: core.$constructor<ZodMiniCUID> = /*@__PURE__*/ core.$constructor(
   "ZodMiniCUID",
@@ -219,8 +231,8 @@ export function cuid(params?: string | core.$ZodCUIDParams): ZodMiniCUID {
 }
 
 // ZodMiniCUID2
-export interface ZodMiniCUID2 extends ZodMiniStringFormat<"cuid2"> {
-  _zod: core.$ZodCUID2Internals;
+export interface ZodMiniCUID2 extends _ZodMiniString<core.$ZodCUID2Internals> {
+  // _zod: core.$ZodCUID2Internals;
 }
 export const ZodMiniCUID2: core.$constructor<ZodMiniCUID2> = /*@__PURE__*/ core.$constructor(
   "ZodMiniCUID2",
@@ -235,8 +247,8 @@ export function cuid2(params?: string | core.$ZodCUID2Params): ZodMiniCUID2 {
 }
 
 // ZodMiniULID
-export interface ZodMiniULID extends ZodMiniStringFormat<"ulid"> {
-  _zod: core.$ZodULIDInternals;
+export interface ZodMiniULID extends _ZodMiniString<core.$ZodULIDInternals> {
+  // _zod: core.$ZodULIDInternals;
 }
 export const ZodMiniULID: core.$constructor<ZodMiniULID> = /*@__PURE__*/ core.$constructor(
   "ZodMiniULID",
@@ -251,8 +263,8 @@ export function ulid(params?: string | core.$ZodULIDParams): ZodMiniULID {
 }
 
 // ZodMiniXID
-export interface ZodMiniXID extends ZodMiniStringFormat<"xid"> {
-  _zod: core.$ZodXIDInternals;
+export interface ZodMiniXID extends _ZodMiniString<core.$ZodXIDInternals> {
+  // _zod: core.$ZodXIDInternals;
 }
 export const ZodMiniXID: core.$constructor<ZodMiniXID> = /*@__PURE__*/ core.$constructor("ZodMiniXID", (inst, def) => {
   core.$ZodXID.init(inst, def);
@@ -264,8 +276,8 @@ export function xid(params?: string | core.$ZodXIDParams): ZodMiniXID {
 }
 
 // ZodMiniKSUID
-export interface ZodMiniKSUID extends ZodMiniStringFormat<"ksuid"> {
-  _zod: core.$ZodKSUIDInternals;
+export interface ZodMiniKSUID extends _ZodMiniString<core.$ZodKSUIDInternals> {
+  // _zod: core.$ZodKSUIDInternals;
 }
 export const ZodMiniKSUID: core.$constructor<ZodMiniKSUID> = /*@__PURE__*/ core.$constructor(
   "ZodMiniKSUID",
@@ -280,8 +292,8 @@ export function ksuid(params?: string | core.$ZodKSUIDParams): ZodMiniKSUID {
 }
 
 // ZodMiniIPv4
-export interface ZodMiniIPv4 extends ZodMiniStringFormat<"ipv4"> {
-  _zod: core.$ZodIPv4Internals;
+export interface ZodMiniIPv4 extends _ZodMiniString<core.$ZodIPv4Internals> {
+  // _zod: core.$ZodIPv4Internals;
 }
 export const ZodMiniIPv4: core.$constructor<ZodMiniIPv4> = /*@__PURE__*/ core.$constructor(
   "ZodMiniIPv4",
@@ -296,8 +308,8 @@ export function ipv4(params?: string | core.$ZodIPv4Params): ZodMiniIPv4 {
 }
 
 // ZodMiniIPv6
-export interface ZodMiniIPv6 extends ZodMiniStringFormat<"ipv6"> {
-  _zod: core.$ZodIPv6Internals;
+export interface ZodMiniIPv6 extends _ZodMiniString<core.$ZodIPv6Internals> {
+  // _zod: core.$ZodIPv6Internals;
 }
 export const ZodMiniIPv6: core.$constructor<ZodMiniIPv6> = /*@__PURE__*/ core.$constructor(
   "ZodMiniIPv6",
@@ -312,8 +324,8 @@ export function ipv6(params?: string | core.$ZodIPv6Params): ZodMiniIPv6 {
 }
 
 // ZodMiniCIDRv4
-export interface ZodMiniCIDRv4 extends ZodMiniStringFormat<"cidrv4"> {
-  _zod: core.$ZodCIDRv4Internals;
+export interface ZodMiniCIDRv4 extends _ZodMiniString<core.$ZodCIDRv4Internals> {
+  // _zod: core.$ZodCIDRv4Internals;
 }
 export const ZodMiniCIDRv4: core.$constructor<ZodMiniCIDRv4> = /*@__PURE__*/ core.$constructor(
   "ZodMiniCIDRv4",
@@ -328,8 +340,8 @@ export function cidrv4(params?: string | core.$ZodCIDRv4Params): ZodMiniCIDRv4 {
 }
 
 // ZodMiniCIDRv6
-export interface ZodMiniCIDRv6 extends ZodMiniStringFormat<"cidrv6"> {
-  _zod: core.$ZodCIDRv6Internals;
+export interface ZodMiniCIDRv6 extends _ZodMiniString<core.$ZodCIDRv6Internals> {
+  // _zod: core.$ZodCIDRv6Internals;
 }
 export const ZodMiniCIDRv6: core.$constructor<ZodMiniCIDRv6> = /*@__PURE__*/ core.$constructor(
   "ZodMiniCIDRv6",
@@ -344,8 +356,8 @@ export function cidrv6(params?: string | core.$ZodCIDRv6Params): ZodMiniCIDRv6 {
 }
 
 // ZodMiniBase64
-export interface ZodMiniBase64 extends ZodMiniStringFormat<"base64"> {
-  _zod: core.$ZodBase64Internals;
+export interface ZodMiniBase64 extends _ZodMiniString<core.$ZodBase64Internals> {
+  // _zod: core.$ZodBase64Internals;
 }
 export const ZodMiniBase64: core.$constructor<ZodMiniBase64> = /*@__PURE__*/ core.$constructor(
   "ZodMiniBase64",
@@ -359,8 +371,8 @@ export function base64(params?: string | core.$ZodBase64Params): ZodMiniBase64 {
 }
 
 // ZodMiniBase64URL
-export interface ZodMiniBase64URL extends ZodMiniStringFormat<"base64url"> {
-  _zod: core.$ZodBase64URLInternals;
+export interface ZodMiniBase64URL extends _ZodMiniString<core.$ZodBase64URLInternals> {
+  // _zod: core.$ZodBase64URLInternals;
 }
 export const ZodMiniBase64URL: core.$constructor<ZodMiniBase64URL> = /*@__PURE__*/ core.$constructor(
   "ZodMiniBase64URL",
@@ -374,8 +386,8 @@ export function base64url(params?: string | core.$ZodBase64URLParams): ZodMiniBa
 }
 
 // ZodMiniE164
-export interface ZodMiniE164 extends ZodMiniStringFormat<"e164"> {
-  _zod: core.$ZodE164Internals;
+export interface ZodMiniE164 extends _ZodMiniString<core.$ZodE164Internals> {
+  // _zod: core.$ZodE164Internals;
 }
 export const ZodMiniE164: core.$constructor<ZodMiniE164> = /*@__PURE__*/ core.$constructor(
   "ZodMiniE164",
@@ -390,8 +402,8 @@ export function e164(params?: string | core.$ZodE164Params): ZodMiniE164 {
 }
 
 // ZodMiniJWT
-export interface ZodMiniJWT extends ZodMiniStringFormat<"jwt"> {
-  _zod: core.$ZodJWTInternals;
+export interface ZodMiniJWT extends _ZodMiniString<core.$ZodJWTInternals> {
+  // _zod: core.$ZodJWTInternals;
 }
 export const ZodMiniJWT: core.$constructor<ZodMiniJWT> = /*@__PURE__*/ core.$constructor("ZodMiniJWT", (inst, def) => {
   core.$ZodJWT.init(inst, def);
@@ -403,9 +415,14 @@ export function jwt(params?: string | core.$ZodJWTParams): ZodMiniJWT {
 }
 
 // ZodMiniNumber
-export interface ZodMiniNumber<Input = unknown> extends ZodMiniType {
-  _zod: core.$ZodNumberInternals<Input>;
-}
+interface _ZodMiniNumber<T extends core.$ZodNumberInternals<unknown> = core.$ZodNumberInternals<unknown>>
+  extends _ZodMiniType<T>,
+    core.$ZodNumber<T["input"]> {
+  _zod: T;
+}
+export interface ZodMiniNumber<Input = unknown>
+  extends _ZodMiniNumber<core.$ZodNumberInternals<Input>>,
+    core.$ZodNumber<Input> {}
 export const ZodMiniNumber: core.$constructor<ZodMiniNumber> = /*@__PURE__*/ core.$constructor(
   "ZodMiniNumber",
   (inst, def) => {
@@ -419,9 +436,7 @@ export function number(params?: string | core.$ZodNumberParams): ZodMiniNumber<n
 }
 
 // ZodMiniNumberFormat
-export interface ZodMiniNumberFormat extends ZodMiniNumber {
-  _zod: core.$ZodNumberFormatInternals;
-}
+export interface ZodMiniNumberFormat extends _ZodMiniNumber<core.$ZodNumberFormatInternals>, core.$ZodNumberFormat {}
 export const ZodMiniNumberFormat: core.$constructor<ZodMiniNumberFormat> = /*@__PURE__*/ core.$constructor(
   "ZodMiniNumberFormat",
   (inst, def) => {
@@ -461,8 +476,8 @@ export function uint32(params?: string | core.$ZodCheckNumberFormatParams): ZodM
 }
 
 // ZodMiniBoolean
-export interface ZodMiniBoolean<T = unknown> extends ZodMiniType {
-  _zod: core.$ZodBooleanInternals<T>;
+export interface ZodMiniBoolean<T = unknown> extends _ZodMiniType<core.$ZodBooleanInternals<T>> {
+  // _zod: core.$ZodBooleanInternals<T>;
 }
 export const ZodMiniBoolean: core.$constructor<ZodMiniBoolean> = /*@__PURE__*/ core.$constructor(
   "ZodMiniBoolean",
@@ -477,8 +492,8 @@ export function boolean(params?: string | core.$ZodBooleanParams): ZodMiniBoolea
 }
 
 // ZodMiniBigInt
-export interface ZodMiniBigInt<T = unknown> extends ZodMiniType {
-  _zod: core.$ZodBigIntInternals<T>;
+export interface ZodMiniBigInt<T = unknown> extends _ZodMiniType<core.$ZodBigIntInternals<T>>, core.$ZodBigInt<T> {
+  // _zod: core.$ZodBigIntInternals<T>;
 }
 export const ZodMiniBigInt: core.$constructor<ZodMiniBigInt> = /*@__PURE__*/ core.$constructor(
   "ZodMiniBigInt",
@@ -495,8 +510,8 @@ export function bigint(params?: string | core.$ZodBigIntParams): ZodMiniBigInt<b
 // bigint formats
 
 // ZodMiniBigIntFormat
-export interface ZodMiniBigIntFormat extends ZodMiniType {
-  _zod: core.$ZodBigIntFormatInternals;
+export interface ZodMiniBigIntFormat extends _ZodMiniType<core.$ZodBigIntFormatInternals> {
+  // _zod: core.$ZodBigIntFormatInternals;
 }
 export const ZodMiniBigIntFormat: core.$constructor<ZodMiniBigIntFormat> = /*@__PURE__*/ core.$constructor(
   "ZodMiniBigIntFormat",
@@ -519,8 +534,8 @@ export function uint64(params?: string | core.$ZodBigIntFormatParams): ZodMiniBi
 }
 
 // ZodMiniSymbol
-export interface ZodMiniSymbol extends ZodMiniType {
-  _zod: core.$ZodSymbolInternals;
+export interface ZodMiniSymbol extends _ZodMiniType<core.$ZodSymbolInternals> {
+  // _zod: core.$ZodSymbolInternals;
 }
 export const ZodMiniSymbol: core.$constructor<ZodMiniSymbol> = /*@__PURE__*/ core.$constructor(
   "ZodMiniSymbol",
@@ -535,8 +550,8 @@ export function symbol(params?: string | core.$ZodSymbolParams): ZodMiniSymbol {
 }
 
 // ZodMiniUndefined
-export interface ZodMiniUndefined extends ZodMiniType {
-  _zod: core.$ZodUndefinedInternals;
+export interface ZodMiniUndefined extends _ZodMiniType<core.$ZodUndefinedInternals> {
+  // _zod: core.$ZodUndefinedInternals;
 }
 export const ZodMiniUndefined: core.$constructor<ZodMiniUndefined> = /*@__PURE__*/ core.$constructor(
   "ZodMiniUndefined",
@@ -552,8 +567,8 @@ function _undefined(params?: string | core.$ZodUndefinedParams): ZodMiniUndefine
 export { _undefined as undefined };
 
 // ZodMiniNull
-export interface ZodMiniNull extends ZodMiniType {
-  _zod: core.$ZodNullInternals;
+export interface ZodMiniNull extends _ZodMiniType<core.$ZodNullInternals> {
+  // _zod: core.$ZodNullInternals;
 }
 export const ZodMiniNull: core.$constructor<ZodMiniNull> = /*@__PURE__*/ core.$constructor(
   "ZodMiniNull",
@@ -569,8 +584,8 @@ function _null(params?: string | core.$ZodNullParams): ZodMiniNull {
 export { _null as null };
 
 // ZodMiniAny
-export interface ZodMiniAny extends ZodMiniType {
-  _zod: core.$ZodAnyInternals;
+export interface ZodMiniAny extends _ZodMiniType<core.$ZodAnyInternals> {
+  // _zod: core.$ZodAnyInternals;
 }
 export const ZodMiniAny: core.$constructor<ZodMiniAny> = /*@__PURE__*/ core.$constructor("ZodMiniAny", (inst, def) => {
   core.$ZodAny.init(inst, def);
@@ -582,8 +597,8 @@ export function any(): ZodMiniAny {
 }
 
 // ZodMiniUnknown
-export interface ZodMiniUnknown extends ZodMiniType {
-  _zod: core.$ZodUnknownInternals;
+export interface ZodMiniUnknown extends _ZodMiniType<core.$ZodUnknownInternals> {
+  // _zod: core.$ZodUnknownInternals;
 }
 export const ZodMiniUnknown: core.$constructor<ZodMiniUnknown> = /*@__PURE__*/ core.$constructor(
   "ZodMiniUnknown",
@@ -598,8 +613,8 @@ export function unknown(): ZodMiniUnknown {
 }
 
 // ZodMiniNever
-export interface ZodMiniNever extends ZodMiniType {
-  _zod: core.$ZodNeverInternals;
+export interface ZodMiniNever extends _ZodMiniType<core.$ZodNeverInternals> {
+  // _zod: core.$ZodNeverInternals;
 }
 export const ZodMiniNever: core.$constructor<ZodMiniNever> = /*@__PURE__*/ core.$constructor(
   "ZodMiniNever",
@@ -614,8 +629,8 @@ export function never(params?: string | core.$ZodNeverParams): ZodMiniNever {
 }
 
 // ZodMiniVoid
-export interface ZodMiniVoid extends ZodMiniType {
-  _zod: core.$ZodVoidInternals;
+export interface ZodMiniVoid extends _ZodMiniType<core.$ZodVoidInternals> {
+  // _zod: core.$ZodVoidInternals;
 }
 export const ZodMiniVoid: core.$constructor<ZodMiniVoid> = /*@__PURE__*/ core.$constructor(
   "ZodMiniVoid",
@@ -631,8 +646,8 @@ function _void(params?: string | core.$ZodVoidParams): ZodMiniVoid {
 export { _void as void };
 
 // ZodMiniDate
-export interface ZodMiniDate<T = unknown> extends ZodMiniType {
-  _zod: core.$ZodDateInternals<T>;
+export interface ZodMiniDate<T = unknown> extends _ZodMiniType<core.$ZodDateInternals<T>> {
+  // _zod: core.$ZodDateInternals<T>;
 }
 
 export const ZodMiniDate: core.$constructor<ZodMiniDate> = /*@__PURE__*/ core.$constructor(
@@ -648,8 +663,10 @@ export function date(params?: string | core.$ZodDateParams): ZodMiniDate<Date> {
 }
 
 // ZodMiniArray
-export interface ZodMiniArray<T extends SomeType = SomeType> extends ZodMiniType {
-  _zod: core.$ZodArrayInternals<T>;
+export interface ZodMiniArray<T extends SomeType = core.$ZodType>
+  extends _ZodMiniType<core.$ZodArrayInternals<T>>,
+    core.$ZodArray<T> {
+  // _zod: core.$ZodArrayInternals<T>;
 }
 export const ZodMiniArray: core.$constructor<ZodMiniArray> = /*@__PURE__*/ core.$constructor(
   "ZodMiniArray",
@@ -663,12 +680,9 @@ export function array<T extends SomeType>(element: T, params?: string | core.$Zo
 export function array<T extends SomeType>(element: SomeType, params?: any): ZodMiniArray<T> {
   return new ZodMiniArray({
     type: "array",
-    element,
-    // get element() {
-    //   return element;
-    // },
+    element: element as core.$ZodType,
     ...util.normalizeParams(params),
-  }) as ZodMiniArray<T>;
+  }) as any;
 }
 
 // .keyof
@@ -682,8 +696,8 @@ export interface ZodMiniObject<
   /** @ts-ignore Cast variance */
   out Shape extends core.$ZodShape = core.$ZodShape,
   out Config extends core.$ZodObjectConfig = core.$ZodObjectConfig,
-> extends ZodMiniType {
-  _zod: core.$ZodObjectInternals<Shape, Config>;
+> extends ZodMiniType<any, any, core.$ZodObjectInternals<Shape, Config>>,
+    core.$ZodObject<Shape, Config> {
   shape: Shape;
 }
 export const ZodMiniObject: core.$constructor<ZodMiniObject> = /*@__PURE__*/ core.$constructor(
@@ -709,7 +723,6 @@ export function object<T extends core.$ZodLooseShape = Record<never, SomeType>>(
 }
 
 // strictObject
-
 export function strictObject<T extends core.$ZodLooseShape>(
   shape: T,
   params?: string | core.$ZodObjectParams
@@ -721,16 +734,12 @@ export function strictObject<T extends core.$ZodLooseShape>(
       util.assignProp(this, "shape", { ...shape });
       return this.shape;
     },
-    // get optional() {
-    //   return util.optionalKeys(shape);
-    // },
     catchall: never(),
     ...util.normalizeParams(params),
   }) as any;
 }
 
 // looseObject
-
 export function looseObject<T extends core.$ZodLooseShape>(
   shape: T,
   params?: string | core.$ZodObjectParams
@@ -840,8 +849,9 @@ export function required(schema: ZodMiniObject, mask?: object) {
 }
 
 // ZodMiniUnion
-export interface ZodMiniUnion<T extends readonly SomeType[] = readonly SomeType[]> extends ZodMiniType {
-  _zod: core.$ZodUnionInternals<T>;
+export interface ZodMiniUnion<T extends readonly SomeType[] = readonly core.$ZodType[]>
+  extends _ZodMiniType<core.$ZodUnionInternals<T>> {
+  // _zod: core.$ZodUnionInternals<T>;
 }
 export const ZodMiniUnion: core.$constructor<ZodMiniUnion> = /*@__PURE__*/ core.$constructor(
   "ZodMiniUnion",
@@ -857,13 +867,13 @@ export function union<const T extends readonly SomeType[]>(
 ): ZodMiniUnion<T> {
   return new ZodMiniUnion({
     type: "union",
-    options,
+    options: options as any as core.$ZodType[],
     ...util.normalizeParams(params),
-  }) as ZodMiniUnion<T>;
+  }) as any;
 }
 
 // ZodMiniDiscriminatedUnion
-export interface ZodMiniDiscriminatedUnion<Options extends readonly SomeType[] = readonly SomeType[]>
+export interface ZodMiniDiscriminatedUnion<Options extends readonly SomeType[] = readonly core.$ZodType[]>
   extends ZodMiniUnion<Options> {
   _zod: core.$ZodDiscriminatedUnionInternals<Options>;
 }
@@ -891,8 +901,9 @@ export function discriminatedUnion<
 }
 
 // ZodMiniIntersection
-export interface ZodMiniIntersection<A extends SomeType = SomeType, B extends SomeType = SomeType> extends ZodMiniType {
-  _zod: core.$ZodIntersectionInternals<A, B>;
+export interface ZodMiniIntersection<A extends SomeType = core.$ZodType, B extends SomeType = core.$ZodType>
+  extends _ZodMiniType<core.$ZodIntersectionInternals<A, B>> {
+  // _zod: core.$ZodIntersectionInternals<A, B>;
 }
 export const ZodMiniIntersection: core.$constructor<ZodMiniIntersection> = /*@__PURE__*/ core.$constructor(
   "ZodMiniIntersection",
@@ -905,17 +916,17 @@ export const ZodMiniIntersection: core.$constructor<ZodMiniIntersection> = /*@__
 export function intersection<T extends SomeType, U extends SomeType>(left: T, right: U): ZodMiniIntersection<T, U> {
   return new ZodMiniIntersection({
     type: "intersection",
-    left,
-    right,
-  }) as ZodMiniIntersection<T, U>;
+    left: left as any as core.$ZodType,
+    right: right as any as core.$ZodType,
+  }) as any;
 }
 
 // ZodMiniTuple
 export interface ZodMiniTuple<
-  T extends util.TupleItems = util.TupleItems,
-  Rest extends SomeType | null = SomeType | null,
-> extends ZodMiniType {
-  _zod: core.$ZodTupleInternals<T, Rest>;
+  T extends util.TupleItems = readonly core.$ZodType[],
+  Rest extends SomeType | null = core.$ZodType | null,
+> extends _ZodMiniType<core.$ZodTupleInternals<T, Rest>> {
+  // _zod: core.$ZodTupleInternals<T, Rest>;
 }
 export const ZodMiniTuple: core.$constructor<ZodMiniTuple> = /*@__PURE__*/ core.$constructor(
   "ZodMiniTuple",
@@ -925,11 +936,11 @@ export const ZodMiniTuple: core.$constructor<ZodMiniTuple> = /*@__PURE__*/ core.
   }
 );
 
-export function tuple<T extends readonly [SomeType, ...SomeType[]]>(
+export function tuple<const T extends readonly [SomeType, ...SomeType[]]>(
   items: T,
   params?: string | core.$ZodTupleParams
 ): ZodMiniTuple<T, null>;
-export function tuple<T extends readonly [SomeType, ...SomeType[]], Rest extends SomeType>(
+export function tuple<const T extends readonly [SomeType, ...SomeType[]], Rest extends SomeType>(
   items: T,
   rest: Rest,
   params?: string | core.$ZodTupleParams
@@ -945,16 +956,18 @@ export function tuple(
   const rest = hasRest ? _paramsOrRest : null;
   return new ZodMiniTuple({
     type: "tuple",
-    items,
+    items: items as any as core.$ZodType[],
     rest,
     ...util.normalizeParams(params),
   });
 }
 
 // ZodMiniRecord
-export interface ZodMiniRecord<Key extends core.$ZodRecordKey = core.$ZodRecordKey, Value extends SomeType = SomeType>
-  extends ZodMiniType {
-  _zod: core.$ZodRecordInternals<Key, Value>;
+export interface ZodMiniRecord<
+  Key extends core.$ZodRecordKey = core.$ZodRecordKey,
+  Value extends SomeType = core.$ZodType,
+> extends _ZodMiniType<core.$ZodRecordInternals<Key, Value>> {
+  // _zod: core.$ZodRecordInternals<Key, Value>;
 }
 export const ZodMiniRecord: core.$constructor<ZodMiniRecord> = /*@__PURE__*/ core.$constructor(
   "ZodMiniRecord",
@@ -972,9 +985,9 @@ export function record<Key extends core.$ZodRecordKey, Value extends SomeType>(
   return new ZodMiniRecord({
     type: "record",
     keyType,
-    valueType,
+    valueType: valueType as any as core.$ZodType,
     ...util.normalizeParams(params),
-  }) as ZodMiniRecord<Key, Value>;
+  }) as any;
 }
 export function partialRecord<Key extends core.$ZodRecordKey, Value extends SomeType>(
   keyType: Key,
@@ -984,14 +997,15 @@ export function partialRecord<Key extends core.$ZodRecordKey, Value extends Some
   return new ZodMiniRecord({
     type: "record",
     keyType: union([keyType, never()]),
-    valueType,
+    valueType: valueType as any as core.$ZodType,
     ...util.normalizeParams(params),
-  }) as ZodMiniRecord<ZodMiniUnion<[Key, ZodMiniNever]>, Value>;
+  }) as any;
 }
 
 // ZodMiniMap
-export interface ZodMiniMap<Key extends SomeType = SomeType, Value extends SomeType = SomeType> extends ZodMiniType {
-  _zod: core.$ZodMapInternals<Key, Value>;
+export interface ZodMiniMap<Key extends SomeType = core.$ZodType, Value extends SomeType = core.$ZodType>
+  extends _ZodMiniType<core.$ZodMapInternals<Key, Value>> {
+  // _zod: core.$ZodMapInternals<Key, Value>;
 }
 export const ZodMiniMap: core.$constructor<ZodMiniMap> = /*@__PURE__*/ core.$constructor("ZodMiniMap", (inst, def) => {
   core.$ZodMap.init(inst, def);
@@ -1005,15 +1019,15 @@ export function map<Key extends SomeType, Value extends SomeType>(
 ): ZodMiniMap<Key, Value> {
   return new ZodMiniMap({
     type: "map",
-    keyType,
-    valueType,
+    keyType: keyType as any as core.$ZodType,
+    valueType: valueType as any as core.$ZodType,
     ...util.normalizeParams(params),
-  }) as ZodMiniMap<Key, Value>;
+  }) as any;
 }
 
 // ZodMiniSet
-export interface ZodMiniSet<T extends SomeType = SomeType> extends ZodMiniType {
-  _zod: core.$ZodSetInternals<T>;
+export interface ZodMiniSet<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodSetInternals<T>> {
+  // _zod: core.$ZodSetInternals<T>;
 }
 export const ZodMiniSet: core.$constructor<ZodMiniSet> = /*@__PURE__*/ core.$constructor("ZodMiniSet", (inst, def) => {
   core.$ZodSet.init(inst, def);
@@ -1023,14 +1037,14 @@ export const ZodMiniSet: core.$constructor<ZodMiniSet> = /*@__PURE__*/ core.$con
 export function set<Value extends SomeType>(valueType: Value, params?: string | core.$ZodSetParams): ZodMiniSet<Value> {
   return new ZodMiniSet({
     type: "set",
-    valueType,
+    valueType: valueType as any as core.$ZodType,
     ...util.normalizeParams(params),
-  }) as ZodMiniSet<Value>;
+  }) as any;
 }
 
 // ZodMiniEnum
-export interface ZodMiniEnum<T extends util.EnumLike = util.EnumLike> extends ZodMiniType {
-  _zod: core.$ZodEnumInternals<T>;
+export interface ZodMiniEnum<T extends util.EnumLike = util.EnumLike> extends _ZodMiniType<core.$ZodEnumInternals<T>> {
+  // _zod: core.$ZodEnumInternals<T>;
 }
 export const ZodMiniEnum: core.$constructor<ZodMiniEnum> = /*@__PURE__*/ core.$constructor(
   "ZodMiniEnum",
@@ -1072,8 +1086,9 @@ export function nativeEnum<T extends util.EnumLike>(entries: T, params?: string
 }
 
 // ZodMiniLiteral
-export interface ZodMiniLiteral<T extends util.Primitive = util.Primitive> extends ZodMiniType {
-  _zod: core.$ZodLiteralInternals<T>;
+export interface ZodMiniLiteral<T extends util.Primitive = util.Primitive>
+  extends _ZodMiniType<core.$ZodLiteralInternals<T>> {
+  // _zod: core.$ZodLiteralInternals<T>;
 }
 export const ZodMiniLiteral: core.$constructor<ZodMiniLiteral> = /*@__PURE__*/ core.$constructor(
   "ZodMiniLiteral",
@@ -1083,7 +1098,7 @@ export const ZodMiniLiteral: core.$constructor<ZodMiniLiteral> = /*@__PURE__*/ c
   }
 );
 
-export function literal<const T extends Array<util.Literal>>(
+export function literal<const T extends ReadonlyArray<util.Literal>>(
   value: T,
   params?: string | core.$ZodLiteralParams
 ): ZodMiniLiteral<T[number]>;
@@ -1100,8 +1115,8 @@ export function literal(value: any, params: any) {
 }
 
 // ZodMiniFile
-export interface ZodMiniFile extends ZodMiniType {
-  _zod: core.$ZodFileInternals;
+export interface ZodMiniFile extends _ZodMiniType<core.$ZodFileInternals> {
+  // _zod: core.$ZodFileInternals;
 }
 export const ZodMiniFile: core.$constructor<ZodMiniFile> = /*@__PURE__*/ core.$constructor(
   "ZodMiniFile",
@@ -1116,8 +1131,8 @@ export function file(params?: string | core.$ZodFileParams): ZodMiniFile {
 }
 
 // ZodMiniTransform
-export interface ZodMiniTransform<O = unknown, I = unknown> extends ZodMiniType {
-  _zod: core.$ZodTransformInternals<O, I>;
+export interface ZodMiniTransform<O = unknown, I = unknown> extends _ZodMiniType<core.$ZodTransformInternals<O, I>> {
+  // _zod: core.$ZodTransformInternals<O, I>;
 }
 export const ZodMiniTransform: core.$constructor<ZodMiniTransform> = /*@__PURE__*/ core.$constructor(
   "ZodMiniTransform",
@@ -1137,8 +1152,10 @@ export function transform<I = unknown, O = I>(
 }
 
 // ZodMiniOptional
-export interface ZodMiniOptional<T extends SomeType = SomeType> extends ZodMiniType {
-  _zod: core.$ZodOptionalInternals<T>;
+export interface ZodMiniOptional<T extends SomeType = core.$ZodType>
+  extends _ZodMiniType<core.$ZodOptionalInternals<T>>,
+    core.$ZodOptional<T> {
+  // _zod: core.$ZodOptionalInternals<T>;
 }
 export const ZodMiniOptional: core.$constructor<ZodMiniOptional> = /*@__PURE__*/ core.$constructor(
   "ZodMiniOptional",
@@ -1151,13 +1168,14 @@ export const ZodMiniOptional: core.$constructor<ZodMiniOptional> = /*@__PURE__*/
 export function optional<T extends SomeType>(innerType: T): ZodMiniOptional<T> {
   return new ZodMiniOptional({
     type: "optional",
-    innerType,
-  }) as ZodMiniOptional<T>;
+    innerType: innerType as any as core.$ZodType,
+  }) as any;
 }
 
 // ZodMiniNullable
-export interface ZodMiniNullable<T extends SomeType = SomeType> extends ZodMiniType {
-  _zod: core.$ZodNullableInternals<T>;
+export interface ZodMiniNullable<T extends SomeType = core.$ZodType>
+  extends _ZodMiniType<core.$ZodNullableInternals<T>> {
+  // _zod: core.$ZodNullableInternals<T>;
 }
 export const ZodMiniNullable: core.$constructor<ZodMiniNullable> = /*@__PURE__*/ core.$constructor(
   "ZodMiniNullable",
@@ -1170,8 +1188,8 @@ export const ZodMiniNullable: core.$constructor<ZodMiniNullable> = /*@__PURE__*/
 export function nullable<T extends SomeType>(innerType: T): ZodMiniNullable<T> {
   return new ZodMiniNullable({
     type: "nullable",
-    innerType,
-  }) as ZodMiniNullable<T>;
+    innerType: innerType as any as core.$ZodType,
+  }) as any;
 }
 
 // nullish
@@ -1180,8 +1198,8 @@ export function nullish<T extends SomeType>(innerType: T): ZodMiniOptional<ZodMi
 }
 
 // ZodMiniDefault
-export interface ZodMiniDefault<T extends SomeType = SomeType> extends ZodMiniType {
-  _zod: core.$ZodDefaultInternals<T>;
+export interface ZodMiniDefault<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodDefaultInternals<T>> {
+  // _zod: core.$ZodDefaultInternals<T>;
 }
 export const ZodMiniDefault: core.$constructor<ZodMiniDefault> = /*@__PURE__*/ core.$constructor(
   "ZodMiniDefault",
@@ -1197,16 +1215,17 @@ export function _default<T extends SomeType>(
 ): ZodMiniDefault<T> {
   return new ZodMiniDefault({
     type: "default",
-    innerType,
+    innerType: innerType as any as core.$ZodType,
     get defaultValue() {
       return typeof defaultValue === "function" ? (defaultValue as Function)() : defaultValue;
     },
-  }) as ZodMiniDefault<T>;
+  }) as any;
 }
 
 // ZodMiniPrefault
-export interface ZodMiniPrefault<T extends SomeType = SomeType> extends ZodMiniType {
-  _zod: core.$ZodPrefaultInternals<T>;
+export interface ZodMiniPrefault<T extends SomeType = core.$ZodType>
+  extends _ZodMiniType<core.$ZodPrefaultInternals<T>> {
+  // _zod: core.$ZodPrefaultInternals<T>;
 }
 export const ZodMiniPrefault: core.$constructor<ZodMiniPrefault> = /*@__PURE__*/ core.$constructor(
   "ZodMiniPrefault",
@@ -1221,16 +1240,17 @@ export function prefault<T extends SomeType>(
 ): ZodMiniPrefault<T> {
   return new ZodMiniPrefault({
     type: "prefault",
-    innerType,
+    innerType: innerType as any as core.$ZodType,
     get defaultValue() {
       return typeof defaultValue === "function" ? (defaultValue as Function)() : defaultValue;
     },
-  }) as ZodMiniPrefault<T>;
+  }) as any;
 }
 
 // ZodMiniNonOptional
-export interface ZodMiniNonOptional<T extends SomeType = SomeType> extends ZodMiniType {
-  _zod: core.$ZodNonOptionalInternals<T>;
+export interface ZodMiniNonOptional<T extends SomeType = core.$ZodType>
+  extends _ZodMiniType<core.$ZodNonOptionalInternals<T>> {
+  // _zod: core.$ZodNonOptionalInternals<T>;
 }
 export const ZodMiniNonOptional: core.$constructor<ZodMiniNonOptional> = /*@__PURE__*/ core.$constructor(
   "ZodMiniNonOptional",
@@ -1246,14 +1266,14 @@ export function nonoptional<T extends SomeType>(
 ): ZodMiniNonOptional<T> {
   return new ZodMiniNonOptional({
     type: "nonoptional",
-    innerType,
+    innerType: innerType as any as core.$ZodType,
     ...util.normalizeParams(params),
-  }) as ZodMiniNonOptional<T>;
+  }) as any;
 }
 
 // ZodMiniSuccess
-export interface ZodMiniSuccess<T extends SomeType = SomeType> extends ZodMiniType {
-  _zod: core.$ZodSuccessInternals<T>;
+export interface ZodMiniSuccess<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodSuccessInternals<T>> {
+  // _zod: core.$ZodSuccessInternals<T>;
 }
 export const ZodMiniSuccess: core.$constructor<ZodMiniSuccess> = /*@__PURE__*/ core.$constructor(
   "ZodMiniSuccess",
@@ -1266,13 +1286,13 @@ export const ZodMiniSuccess: core.$constructor<ZodMiniSuccess> = /*@__PURE__*/ c
 export function success<T extends SomeType>(innerType: T): ZodMiniSuccess<T> {
   return new ZodMiniSuccess({
     type: "success",
-    innerType,
-  }) as ZodMiniSuccess<T>;
+    innerType: innerType as any as core.$ZodType,
+  }) as any;
 }
 
 // ZodMiniCatch
-export interface ZodMiniCatch<T extends SomeType = SomeType> extends ZodMiniType {
-  _zod: core.$ZodCatchInternals<T>;
+export interface ZodMiniCatch<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodCatchInternals<T>> {
+  // _zod: core.$ZodCatchInternals<T>;
 }
 export const ZodMiniCatch: core.$constructor<ZodMiniCatch> = /*@__PURE__*/ core.$constructor(
   "ZodMiniCatch",
@@ -1288,17 +1308,17 @@ function _catch<T extends SomeType>(
 ): ZodMiniCatch<T> {
   return new ZodMiniCatch({
     type: "catch",
-    innerType,
+    innerType: innerType as any as core.$ZodType,
     catchValue: (typeof catchValue === "function" ? catchValue : () => catchValue) as (
       ctx: core.$ZodCatchCtx
     ) => core.output<T>,
-  }) as ZodMiniCatch<T>;
+  }) as any;
 }
 export { _catch as catch };
 
 // ZodMiniNaN
-export interface ZodMiniNaN extends ZodMiniType {
-  _zod: core.$ZodNaNInternals;
+export interface ZodMiniNaN extends _ZodMiniType<core.$ZodNaNInternals> {
+  // _zod: core.$ZodNaNInternals;
 }
 export const ZodMiniNaN: core.$constructor<ZodMiniNaN> = /*@__PURE__*/ core.$constructor("ZodMiniNaN", (inst, def) => {
   core.$ZodNaN.init(inst, def);
@@ -1310,8 +1330,9 @@ export function nan(params?: string | core.$ZodNaNParams): ZodMiniNaN {
 }
 
 // ZodMiniPipe
-export interface ZodMiniPipe<A extends SomeType = SomeType, B extends SomeType = SomeType> extends ZodMiniType {
-  _zod: core.$ZodPipeInternals<A, B>;
+export interface ZodMiniPipe<A extends SomeType = core.$ZodType, B extends SomeType = core.$ZodType>
+  extends _ZodMiniType<core.$ZodPipeInternals<A, B>> {
+  // _zod: core.$ZodPipeInternals<A, B>;
 }
 export const ZodMiniPipe: core.$constructor<ZodMiniPipe> = /*@__PURE__*/ core.$constructor(
   "ZodMiniPipe",
@@ -1322,15 +1343,14 @@ export const ZodMiniPipe: core.$constructor<ZodMiniPipe> = /*@__PURE__*/ core.$c
 );
 
 export function pipe<
-  const A extends core.$ZodType,
+  const A extends SomeType,
   B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>,
->(in_: A, out: B | core.$ZodType<unknown, core.output<A>>, params?: string | core.$ZodPipeParams): ZodMiniPipe<A, B>;
-export function pipe(in_: core.$ZodType, out: core.$ZodType) {
+>(in_: A, out: B | core.$ZodType<unknown, core.output<A>>): ZodMiniPipe<A, B> {
   return new ZodMiniPipe({
     type: "pipe",
-    in: in_,
-    out,
-  });
+    in: in_ as any as core.$ZodType,
+    out: out as any as core.$ZodType,
+  }) as any;
 }
 
 // /** @deprecated Use `z.pipe()` and `z.transform()` instead. */
@@ -1343,8 +1363,9 @@ export function pipe(in_: core.$ZodType, out: core.$ZodType) {
 // }
 
 // ZodMiniReadonly
-export interface ZodMiniReadonly<T extends SomeType = SomeType> extends ZodMiniType {
-  _zod: core.$ZodReadonlyInternals<T>;
+export interface ZodMiniReadonly<T extends SomeType = core.$ZodType>
+  extends _ZodMiniType<core.$ZodReadonlyInternals<T>> {
+  // _zod: core.$ZodReadonlyInternals<T>;
 }
 export const ZodMiniReadonly: core.$constructor<ZodMiniReadonly> = /*@__PURE__*/ core.$constructor(
   "ZodMiniReadonly",
@@ -1357,13 +1378,14 @@ export const ZodMiniReadonly: core.$constructor<ZodMiniReadonly> = /*@__PURE__*/
 export function readonly<T extends SomeType>(innerType: T): ZodMiniReadonly<T> {
   return new ZodMiniReadonly({
     type: "readonly",
-    innerType,
-  }) as ZodMiniReadonly<T>;
+    innerType: innerType as any as core.$ZodType,
+  }) as any;
 }
 
 // ZodMiniTemplateLiteral
-export interface ZodMiniTemplateLiteral<Template extends string = string> extends ZodMiniType {
-  _zod: core.$ZodTemplateLiteralInternals<Template>;
+export interface ZodMiniTemplateLiteral<Template extends string = string>
+  extends _ZodMiniType<core.$ZodTemplateLiteralInternals<Template>> {
+  // _zod: core.$ZodTemplateLiteralInternals<Template>;
 }
 export const ZodMiniTemplateLiteral: core.$constructor<ZodMiniTemplateLiteral> = /*@__PURE__*/ core.$constructor(
   "ZodMiniTemplateLiteral",
@@ -1385,8 +1407,8 @@ export function templateLiteral<const Parts extends core.$ZodTemplateLiteralPart
 }
 
 // ZodMiniLazy
-export interface ZodMiniLazy<T extends SomeType = SomeType> extends ZodMiniType {
-  _zod: core.$ZodLazyInternals<T>;
+export interface ZodMiniLazy<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodLazyInternals<T>> {
+  // _zod: core.$ZodLazyInternals<T>;
 }
 export const ZodMiniLazy: core.$constructor<ZodMiniLazy> = /*@__PURE__*/ core.$constructor(
   "ZodMiniLazy",
@@ -1402,14 +1424,14 @@ export const ZodMiniLazy: core.$constructor<ZodMiniLazy> = /*@__PURE__*/ core.$c
 function _lazy<T extends SomeType>(getter: () => T): ZodMiniLazy<T> {
   return new ZodMiniLazy({
     type: "lazy",
-    getter,
-  }) as ZodMiniLazy<T>;
+    getter: getter as any,
+  }) as any;
 }
 export { _lazy as lazy };
 
 // ZodMiniPromise
-export interface ZodMiniPromise<T extends SomeType = SomeType> extends ZodMiniType {
-  _zod: core.$ZodPromiseInternals<T>;
+export interface ZodMiniPromise<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodPromiseInternals<T>> {
+  // _zod: core.$ZodPromiseInternals<T>;
 }
 export const ZodMiniPromise: core.$constructor<ZodMiniPromise> = /*@__PURE__*/ core.$constructor(
   "ZodMiniPromise",
@@ -1422,13 +1444,13 @@ export const ZodMiniPromise: core.$constructor<ZodMiniPromise> = /*@__PURE__*/ c
 export function promise<T extends SomeType>(innerType: T): ZodMiniPromise<T> {
   return new ZodMiniPromise({
     type: "promise",
-    innerType,
-  }) as ZodMiniPromise<T>;
+    innerType: innerType as any as core.$ZodType,
+  }) as any;
 }
 
 // ZodMiniCustom
-export interface ZodMiniCustom<O = unknown, I = unknown> extends ZodMiniType {
-  _zod: core.$ZodCustomInternals<O, I>;
+export interface ZodMiniCustom<O = unknown, I = unknown> extends _ZodMiniType<core.$ZodCustomInternals<O, I>> {
+  // _zod: core.$ZodCustomInternals<O, I>;
 }
 export const ZodMiniCustom: core.$constructor<ZodMiniCustom> = /*@__PURE__*/ core.$constructor(
   "ZodMiniCustom",
@@ -1450,20 +1472,12 @@ export function check<O = unknown>(fn: core.CheckFn<O>, params?: string | core.$
 }
 
 // ZodCustom
-function _custom<O = unknown, I = O>(
-  fn: (data: O) => unknown,
-  _params: string | core.$ZodCustomParams | undefined,
-  Class: util.Constructor<ZodMiniCustom, [core.$ZodCustomDef]>
+// custom schema
+export function custom<O = unknown, I = O>(
+  fn?: (data: O) => unknown,
+  _params?: string | core.$ZodCustomParams | undefined
 ): ZodMiniCustom<O, I> {
-  const params = util.normalizeParams(_params);
-  const schema = new Class({
-    type: "custom",
-    check: "custom",
-    fn: fn as any,
-    ...params,
-  });
-
-  return schema as any;
+  return core._custom(ZodMiniCustom, fn ?? (() => true), _params) as any;
 }
 
 // refine
@@ -1471,15 +1485,7 @@ export function refine<T>(
   fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>,
   _params: string | core.$ZodCustomParams = {}
 ): core.$ZodCheck<T> {
-  return _custom(fn, _params, ZodMiniCustom);
-}
-
-// custom schema
-export function custom<O = unknown, I = O>(
-  fn?: (data: O) => unknown,
-  _params?: string | core.$ZodCustomParams | undefined
-): ZodMiniCustom<O, I> {
-  return _custom(fn ?? (() => true), _params, ZodMiniCustom);
+  return core._refine(ZodMiniCustom, fn, _params);
 }
 
 // instanceof
@@ -1501,18 +1507,21 @@ export { _instanceof as instanceof };
 // stringbool
 export const stringbool: (
   _params?: string | core.$ZodStringBoolParams
-) => ZodMiniPipe<ZodMiniUnknown, ZodMiniBoolean<boolean>> = (...args) =>
+) => ZodMiniPipe<ZodMiniPipe<ZodMiniString, ZodMiniTransform<boolean, string>>, ZodMiniBoolean> = (...args) =>
   core._stringbool(
     {
       Pipe: ZodMiniPipe,
       Boolean: ZodMiniBoolean,
-      Unknown: ZodMiniUnknown,
+      String: ZodMiniString,
+      Transform: ZodMiniTransform,
     },
     ...args
   ) as any;
 
 // json
-export type ZodMiniJSONSchema = ZodMiniUnion<
+
+// json
+type _ZodMiniJSONSchema = ZodMiniUnion<
   [
     ZodMiniString,
     ZodMiniNumber,
@@ -1521,12 +1530,16 @@ export type ZodMiniJSONSchema = ZodMiniUnion<
     ZodMiniArray<ZodMiniJSONSchema>,
     ZodMiniRecord<ZodMiniString<string>, ZodMiniJSONSchema>,
   ]
-> & {
-  _zod: {
-    input: util.JSONType;
-    output: util.JSONType;
-  };
-};
+>;
+type _ZodMiniJSONSchemaInternals = _ZodMiniJSONSchema["_zod"];
+
+export interface ZodMiniJSONSchemaInternals extends _ZodMiniJSONSchemaInternals {
+  output: util.JSONType;
+  input: util.JSONType;
+}
+export interface ZodMiniJSONSchema extends _ZodMiniJSONSchema {
+  _zod: ZodMiniJSONSchemaInternals;
+}
 
 export function json(): ZodMiniJSONSchema {
   const jsonSchema: any = _lazy(() => {
diff --git a/play.ts b/play.ts
index 33b0f819..41eb006b 100644
--- a/play.ts
+++ b/play.ts
@@ -1,5 +1,3 @@
 import { z } from "zod/v4";
 
 z;
-const recordWithBrandedNumberKeys = z.record(z.number().brand("SomeBrand"), z.number());
-type recordWithBrandedNumberKeys = z.infer<typeof recordWithBrandedNumberKeys>;
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 93175e68..62d450cc 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -105,17 +105,17 @@ importers:
         specifier: workspace:*
         version: link:../zod
       zod3:
-        specifier: npm:zod@^3.23.7
-        version: zod@3.24.2
-      zodnext:
-        specifier: npm:zod@^3.25.0
-        version: zod@3.25.34
+        specifier: npm:zod@~3.24.0
+        version: zod@3.24.3
+      zod4:
+        specifier: npm:zod@latest
+        version: zod@3.25.53
 
   packages/docs:
     dependencies:
       '@inkeep/cxkit-react':
         specifier: ^0.5.80
-        version: 0.5.80(@types/react-dom@19.0.4(@types/react@19.0.11))(@types/react@19.0.11)(encoding@0.1.13)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(zod@3.25.34)
+        version: 0.5.80(@types/react-dom@19.0.4(@types/react@19.0.11))(@types/react@19.0.11)(encoding@0.1.13)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(zod@3.25.53)
       '@radix-ui/react-accordion':
         specifier: ^1.2.4
         version: 1.2.4(@types/react-dom@19.0.4(@types/react@19.0.11))(@types/react@19.0.11)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
@@ -5757,6 +5757,9 @@ packages:
   zod@3.25.34:
     resolution: {integrity: sha512-lZHvSc2PpWdcfpHlyB33HA9nqP16GpC9IpiG4lYq9jZCJVLZNnWd6Y1cj79bcLSBKTkxepfpjckPv5Y5VOPlwA==}
 
+  zod@3.25.53:
+    resolution: {integrity: sha512-BKOKoY3XcGUVkqaalCtFK15LhwR0G0i65AClFpWSXLN2gJNBGlTktukHgwexCTa/dAacPPp9ReryXPWyeZF4LQ==}
+
   zod@4.0.0-beta.20250420T053007:
     resolution: {integrity: sha512-5pp8Q0PNDaNcUptGiBE9akyioJh3RJpagIxrLtAVMR9IxwcSZiOsJD/1/98CyhItdTlI2H91MfhhLzRlU+fifA==}
 
@@ -6231,7 +6234,7 @@ snapshots:
 
   '@inkeep/cxkit-color-mode@0.5.80': {}
 
-  '@inkeep/cxkit-primitives@0.5.80(@types/react-dom@19.0.4(@types/react@19.0.11))(@types/react@19.0.11)(encoding@0.1.13)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(zod@3.25.34)':
+  '@inkeep/cxkit-primitives@0.5.80(@types/react-dom@19.0.4(@types/react@19.0.11))(@types/react@19.0.11)(encoding@0.1.13)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(zod@3.25.53)':
     dependencies:
       '@inkeep/cxkit-color-mode': 0.5.80
       '@inkeep/cxkit-theme': 0.5.80
@@ -6265,7 +6268,7 @@ snapshots:
       lucide-react: 0.503.0(react@19.0.0)
       marked: 15.0.12
       merge-anything: 5.1.7
-      openai: 4.78.1(encoding@0.1.13)(zod@3.25.34)
+      openai: 4.78.1(encoding@0.1.13)(zod@3.25.53)
       prism-react-renderer: 2.4.1(react@19.0.0)
       react: 19.0.0
       react-dom: 19.0.0(react@19.0.0)
@@ -6286,9 +6289,9 @@ snapshots:
       - supports-color
       - zod
 
-  '@inkeep/cxkit-react@0.5.80(@types/react-dom@19.0.4(@types/react@19.0.11))(@types/react@19.0.11)(encoding@0.1.13)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(zod@3.25.34)':
+  '@inkeep/cxkit-react@0.5.80(@types/react-dom@19.0.4(@types/react@19.0.11))(@types/react@19.0.11)(encoding@0.1.13)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(zod@3.25.53)':
     dependencies:
-      '@inkeep/cxkit-styled': 0.5.80(@types/react-dom@19.0.4(@types/react@19.0.11))(@types/react@19.0.11)(encoding@0.1.13)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(zod@3.25.34)
+      '@inkeep/cxkit-styled': 0.5.80(@types/react-dom@19.0.4(@types/react@19.0.11))(@types/react@19.0.11)(encoding@0.1.13)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(zod@3.25.53)
       '@radix-ui/react-use-controllable-state': 1.1.0(@types/react@19.0.11)(react@19.0.0)
       lucide-react: 0.503.0(react@19.0.0)
     transitivePeerDependencies:
@@ -6300,9 +6303,9 @@ snapshots:
       - supports-color
       - zod
 
-  '@inkeep/cxkit-styled@0.5.80(@types/react-dom@19.0.4(@types/react@19.0.11))(@types/react@19.0.11)(encoding@0.1.13)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(zod@3.25.34)':
+  '@inkeep/cxkit-styled@0.5.80(@types/react-dom@19.0.4(@types/react@19.0.11))(@types/react@19.0.11)(encoding@0.1.13)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(zod@3.25.53)':
     dependencies:
-      '@inkeep/cxkit-primitives': 0.5.80(@types/react-dom@19.0.4(@types/react@19.0.11))(@types/react@19.0.11)(encoding@0.1.13)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(zod@3.25.34)
+      '@inkeep/cxkit-primitives': 0.5.80(@types/react-dom@19.0.4(@types/react@19.0.11))(@types/react@19.0.11)(encoding@0.1.13)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(zod@3.25.53)
       class-variance-authority: 0.7.1
       clsx: 2.1.1
       merge-anything: 5.1.7
@@ -10294,7 +10297,7 @@ snapshots:
       regex: 6.0.1
       regex-recursion: 6.0.2
 
-  openai@4.78.1(encoding@0.1.13)(zod@3.25.34):
+  openai@4.78.1(encoding@0.1.13)(zod@3.25.53):
     dependencies:
       '@types/node': 18.19.103
       '@types/node-fetch': 2.6.12
@@ -10304,7 +10307,7 @@ snapshots:
       formdata-node: 4.4.1
       node-fetch: 2.7.0(encoding@0.1.13)
     optionalDependencies:
-      zod: 3.25.34
+      zod: 3.25.53
     transitivePeerDependencies:
       - encoding
 
@@ -11628,6 +11631,8 @@ snapshots:
 
   zod@3.25.34: {}
 
+  zod@3.25.53: {}
+
   zod@4.0.0-beta.20250420T053007:
     dependencies:
       '@zod/core': 0.8.1


Test patch:
diff --git a/packages/zod/src/v3/tests/preprocess.test.ts b/packages/zod/src/v3/tests/preprocess.test.ts
index d3782f25..31512970 100644
--- a/packages/zod/src/v3/tests/preprocess.test.ts
+++ b/packages/zod/src/v3/tests/preprocess.test.ts
@@ -136,9 +136,8 @@ test("z.NEVER in preprocess", () => {
   type foo = z.infer<typeof foo>;
   util.assertEqual<foo, number>(true);
   const arg = foo.safeParse(undefined);
-  if (!arg.success) {
-    expect(arg.error.issues[0].message).toEqual("bad");
-  }
+  expect(arg.error!.issues).toHaveLength(2);
+  expect(arg.error!.issues[0].message).toEqual("bad");
 });
 test("preprocess as the second property of object", () => {
   const schema = z.object({
diff --git a/packages/zod/src/v4/classic/tests/array.test.ts b/packages/zod/src/v4/classic/tests/array.test.ts
index 42982dd0..f19c252c 100644
--- a/packages/zod/src/v4/classic/tests/array.test.ts
+++ b/packages/zod/src/v4/classic/tests/array.test.ts
@@ -14,7 +14,8 @@ test("array min/max", async () => {
     [
       {
         "code": "too_small",
-        "message": "Too small: expected array to have >2 items",
+        "inclusive": true,
+        "message": "Too small: expected array to have >=2 items",
         "minimum": 2,
         "origin": "array",
         "path": [],
@@ -28,8 +29,9 @@ test("array min/max", async () => {
     [
       {
         "code": "too_big",
+        "inclusive": true,
         "maximum": 2,
-        "message": "Too big: expected array to have <2 items",
+        "message": "Too big: expected array to have <=2 items",
         "origin": "array",
         "path": [],
       },
@@ -122,10 +124,11 @@ test("continue parsing despite array size error", () => {
         "origin": "array",
         "code": "too_small",
         "minimum": 2,
+        "inclusive": true,
         "path": [
           "people"
         ],
-        "message": "Too small: expected array to have >2 items"
+        "message": "Too small: expected array to have >=2 items"
       }
     ]],
       "success": false,
diff --git a/packages/zod/src/v4/classic/tests/assignability.test.ts b/packages/zod/src/v4/classic/tests/assignability.test.ts
index b186d34d..603ff6c1 100644
--- a/packages/zod/src/v4/classic/tests/assignability.test.ts
+++ b/packages/zod/src/v4/classic/tests/assignability.test.ts
@@ -1,119 +1,159 @@
-import { test } from "vitest";
+import { expectTypeOf, test } from "vitest";
 
 import * as z from "zod/v4";
 
 test("assignability", () => {
   // $ZodString
   z.string() satisfies z.core.$ZodString;
+  z.string() satisfies z.ZodString;
 
   // $ZodNumber
   z.number() satisfies z.core.$ZodNumber;
+  z.number() satisfies z.ZodNumber;
 
   // $ZodBigInt
   z.bigint() satisfies z.core.$ZodBigInt;
+  z.bigint() satisfies z.ZodBigInt;
 
   // $ZodBoolean
   z.boolean() satisfies z.core.$ZodBoolean;
+  z.boolean() satisfies z.ZodBoolean;
 
   // $ZodDate
   z.date() satisfies z.core.$ZodDate;
+  z.date() satisfies z.ZodDate;
 
   // $ZodSymbol
   z.symbol() satisfies z.core.$ZodSymbol;
+  z.symbol() satisfies z.ZodSymbol;
 
   // $ZodUndefined
   z.undefined() satisfies z.core.$ZodUndefined;
+  z.undefined() satisfies z.ZodUndefined;
 
   // $ZodNullable
   z.string().nullable() satisfies z.core.$ZodNullable;
+  z.string().nullable() satisfies z.ZodNullable;
 
   // $ZodNull
   z.null() satisfies z.core.$ZodNull;
+  z.null() satisfies z.ZodNull;
 
   // $ZodAny
   z.any() satisfies z.core.$ZodAny;
+  z.any() satisfies z.ZodAny;
 
   // $ZodUnknown
   z.unknown() satisfies z.core.$ZodUnknown;
+  z.unknown() satisfies z.ZodUnknown;
 
   // $ZodNever
   z.never() satisfies z.core.$ZodNever;
+  z.never() satisfies z.ZodNever;
 
   // $ZodVoid
   z.void() satisfies z.core.$ZodVoid;
+  z.void() satisfies z.ZodVoid;
 
   // $ZodArray
   z.array(z.string()) satisfies z.core.$ZodArray;
+  z.array(z.string()) satisfies z.ZodArray;
+  z.array(z.string()) satisfies z.ZodType<Array<unknown>>;
 
   // $ZodObject
   z.object({ key: z.string() }) satisfies z.core.$ZodObject;
+  z.object({ key: z.string() }) satisfies z.ZodObject<{ key: z.ZodType }>;
+  z.object({ key: z.string() }) satisfies z.ZodType<{ key: string }>;
 
   // $ZodUnion
   z.union([z.string(), z.number()]) satisfies z.core.$ZodUnion;
+  z.union([z.string(), z.number()]) satisfies z.ZodUnion;
+  z.union([z.string(), z.number()]) satisfies z.ZodType<string | number>;
 
   // $ZodIntersection
   z.intersection(z.string(), z.number()) satisfies z.core.$ZodIntersection;
+  z.intersection(z.string(), z.number()) satisfies z.ZodIntersection;
 
   // $ZodTuple
   z.tuple([z.string(), z.number()]) satisfies z.core.$ZodTuple;
+  z.tuple([z.string(), z.number()]) satisfies z.ZodTuple;
 
   // $ZodRecord
   z.record(z.string(), z.number()) satisfies z.core.$ZodRecord;
+  z.record(z.string(), z.number()) satisfies z.ZodRecord;
 
   // $ZodMap
   z.map(z.string(), z.number()) satisfies z.core.$ZodMap;
+  z.map(z.string(), z.number()) satisfies z.ZodMap;
 
   // $ZodSet
   z.set(z.string()) satisfies z.core.$ZodSet;
+  z.set(z.string()) satisfies z.ZodSet;
 
   // $ZodLiteral
   z.literal("example") satisfies z.core.$ZodLiteral;
+  z.literal("example") satisfies z.ZodLiteral;
 
   // $ZodEnum
   z.enum(["a", "b", "c"]) satisfies z.core.$ZodEnum;
+  z.enum(["a", "b", "c"]) satisfies z.ZodEnum;
 
   // $ZodPromise
   z.promise(z.string()) satisfies z.core.$ZodPromise;
+  z.promise(z.string()) satisfies z.ZodPromise;
 
   // $ZodLazy
   const lazySchema = z.lazy(() => z.string());
   lazySchema satisfies z.core.$ZodLazy;
+  lazySchema satisfies z.ZodLazy;
 
   // $ZodOptional
   z.string().optional() satisfies z.core.$ZodOptional;
+  z.string().optional() satisfies z.ZodOptional;
 
   // $ZodDefault
   z.string().default("default") satisfies z.core.$ZodDefault;
+  z.string().default("default") satisfies z.ZodDefault;
 
   // $ZodTemplateLiteral
   z.templateLiteral([z.literal("a"), z.literal("b")]) satisfies z.core.$ZodTemplateLiteral;
+  z.templateLiteral([z.literal("a"), z.literal("b")]) satisfies z.ZodTemplateLiteral;
 
   // $ZodCustom
   z.custom<string>((val) => typeof val === "string") satisfies z.core.$ZodCustom;
+  z.custom<string>((val) => typeof val === "string") satisfies z.ZodCustom;
 
   // $ZodTransform
   z.transform((val) => val as string) satisfies z.core.$ZodTransform;
+  z.transform((val) => val as string) satisfies z.ZodTransform;
 
   // $ZodNonOptional
   z.string().optional().nonoptional() satisfies z.core.$ZodNonOptional;
+  z.string().optional().nonoptional() satisfies z.ZodNonOptional;
 
   // $ZodReadonly
   z.object({ key: z.string() }).readonly() satisfies z.core.$ZodReadonly;
+  z.object({ key: z.string() }).readonly() satisfies z.ZodReadonly;
 
   // $ZodNaN
   z.nan() satisfies z.core.$ZodNaN;
+  z.nan() satisfies z.ZodNaN;
 
   // $ZodPipe
   z.unknown().pipe(z.number()) satisfies z.core.$ZodPipe;
+  z.unknown().pipe(z.number()) satisfies z.ZodPipe;
 
   // $ZodSuccess
   z.success(z.string()) satisfies z.core.$ZodSuccess;
+  z.success(z.string()) satisfies z.ZodSuccess;
 
   // $ZodCatch
   z.string().catch("fallback") satisfies z.core.$ZodCatch;
+  z.string().catch("fallback") satisfies z.ZodCatch;
 
   // $ZodFile
   z.file() satisfies z.core.$ZodFile;
+  z.file() satisfies z.ZodFile;
 });
 
 test("checks", () => {
@@ -122,3 +162,49 @@ test("checks", () => {
   const _c: z.core.$ZodType = {} as any as z.core.$ZodTypes;
   const _d: z.core.$ZodType = {} as any as z.core.$ZodStringFormatTypes;
 });
+
+test("assignability to $ZodType", () => {
+  z.string() satisfies z.ZodType;
+  z.number() satisfies z.ZodType;
+  z.boolean() satisfies z.ZodType;
+  z.object({ key: z.string() }) satisfies z.ZodType;
+  z.object({ key: z.string() }) satisfies z.ZodType<{ key: string }>;
+  z.array(z.string()) satisfies z.ZodType;
+  z.union([z.string(), z.number()]) satisfies z.ZodType;
+  z.intersection(z.string(), z.number()) satisfies z.ZodType;
+  z.tuple([z.string(), z.number()]) satisfies z.ZodType;
+  z.record(z.string(), z.number()) satisfies z.ZodType;
+  z.map(z.string(), z.number()) satisfies z.ZodType;
+  z.set(z.string()) satisfies z.ZodType;
+  z.literal("example") satisfies z.ZodType;
+
+  expectTypeOf<z.ZodType extends z.core.$ZodType ? true : false>().toEqualTypeOf<true>();
+});
+
+test("assignability with narrowing", () => {
+  type _RefinedSchema<T extends z.ZodType<object> | z.ZodUnion> = T extends z.ZodUnion
+    ? RefinedUnionSchema<T> // <-- Type instantiation is excessively deep and possibly infinite.
+    : T extends z.ZodType<object>
+      ? RefinedTypeSchema<z.output<T>> // <-- Type instantiation is excessively deep and possibly infinite.
+      : never;
+
+  type RefinedTypeSchema<T extends object> = T;
+
+  type RefinedUnionSchema<T extends z.ZodUnion> = T;
+});
+
+test("generic assignability in objects", () => {
+  interface SortItem<T extends string> {
+    key: T;
+    order: string;
+  }
+
+  const createSortItemSchema = <T extends z.ZodType<string>>(sortKeySchema: T) =>
+    z.object({
+      key: sortKeySchema,
+      order: z.string(),
+    });
+
+  <T extends z.ZodType<string>>(sortKeySchema: T, defaultSortBy: SortItem<z.output<T>>[] = []) =>
+    createSortItemSchema(sortKeySchema).array().default(defaultSortBy);
+});
diff --git a/packages/zod/src/v4/classic/tests/custom.test.ts b/packages/zod/src/v4/classic/tests/custom.test.ts
index c360a216..b77f8115 100644
--- a/packages/zod/src/v4/classic/tests/custom.test.ts
+++ b/packages/zod/src/v4/classic/tests/custom.test.ts
@@ -21,3 +21,20 @@ test("instanceof", () => {
   // Argument of type 'ZodCustom<Uint8Array<ArrayBuffer>, unknown>' is not assignable to parameter of type '$ZodType<any, Uint8Array<ArrayBuffer>>'.
   z.string().transform(fn).pipe(z.instanceof(Uint8Array));
 });
+
+test("non-continuable by default", () => {
+  const A = z
+    .custom<string>((val) => typeof val === "string")
+    .transform((_) => {
+      throw new Error("Invalid input");
+    });
+  expect(A.safeParse(123).error!).toMatchInlineSnapshot(`
+    [ZodError: [
+      {
+        "code": "custom",
+        "path": [],
+        "message": "Invalid input"
+      }
+    ]]
+  `);
+});
diff --git a/packages/zod/src/v4/classic/tests/error.test.ts b/packages/zod/src/v4/classic/tests/error.test.ts
index 19e25abf..d884b7e4 100644
--- a/packages/zod/src/v4/classic/tests/error.test.ts
+++ b/packages/zod/src/v4/classic/tests/error.test.ts
@@ -176,8 +176,9 @@ test("array minimum", () => {
         "origin": "array",
         "code": "too_small",
         "minimum": 3,
+        "inclusive": true,
         "path": [],
-        "message": "Too small: expected array to have >3 items"
+        "message": "Too small: expected array to have >=3 items"
       }
     ]]
   `);
@@ -530,6 +531,7 @@ test("z.config customError ", () => {
         "origin": "string",
         "code": "too_small",
         "minimum": 10,
+        "inclusive": true,
         "path": [],
         "message": "override"
       }
@@ -614,10 +616,11 @@ test("dont short circuit on continuable errors", () => {
         "origin": "string",
         "code": "too_small",
         "minimum": 6,
+        "inclusive": true,
         "path": [
           "password"
         ],
-        "message": "Too small: expected string to have >6 characters"
+        "message": "Too small: expected string to have >=6 characters"
       },
       {
         "code": "custom",
diff --git a/packages/zod/src/v4/classic/tests/generics.test.ts b/packages/zod/src/v4/classic/tests/generics.test.ts
index 7f32fd3a..1ec9d67f 100644
--- a/packages/zod/src/v4/classic/tests/generics.test.ts
+++ b/packages/zod/src/v4/classic/tests/generics.test.ts
@@ -56,3 +56,17 @@ test("nested no undefined", () => {
 
   expect(outer.safeParse({ inner: undefined }).success).toEqual(false);
 });
+
+test("generic on output type", () => {
+  const createV4Schema = <Output>(opts: {
+    schema: z.ZodType<Output>;
+  }) => {
+    return opts.schema;
+  };
+
+  createV4Schema({
+    schema: z.object({
+      name: z.string(),
+    }),
+  })?._zod?.output?.name;
+});
diff --git a/packages/zod/src/v4/classic/tests/index.test.ts b/packages/zod/src/v4/classic/tests/index.test.ts
index 5a7ee6be..2f24eb6d 100644
--- a/packages/zod/src/v4/classic/tests/index.test.ts
+++ b/packages/zod/src/v4/classic/tests/index.test.ts
@@ -787,3 +787,43 @@ test("isPlainObject", () => {
   expect(z.core.util.isPlainObject(123)).toEqual(false);
   expect(z.core.util.isPlainObject(Symbol())).toEqual(false);
 });
+
+test("def typing", () => {
+  z.string().def.type satisfies "string";
+  z.number().def.type satisfies "number";
+  z.bigint().def.type satisfies "bigint";
+  z.boolean().def.type satisfies "boolean";
+  z.date().def.type satisfies "date";
+  z.symbol().def.type satisfies "symbol";
+  z.undefined().def.type satisfies "undefined";
+  z.string().nullable().def.type satisfies "nullable";
+  z.null().def.type satisfies "null";
+  z.any().def.type satisfies "any";
+  z.unknown().def.type satisfies "unknown";
+  z.never().def.type satisfies "never";
+  z.void().def.type satisfies "void";
+  z.array(z.string()).def.type satisfies "array";
+  z.object({ key: z.string() }).def.type satisfies "object";
+  z.union([z.string(), z.number()]).def.type satisfies "union";
+  z.intersection(z.string(), z.number()).def.type satisfies "intersection";
+  z.tuple([z.string(), z.number()]).def.type satisfies "tuple";
+  z.record(z.string(), z.number()).def.type satisfies "record";
+  z.map(z.string(), z.number()).def.type satisfies "map";
+  z.set(z.string()).def.type satisfies "set";
+  z.literal("example").def.type satisfies "literal";
+  z.enum(["a", "b", "c"]).def.type satisfies "enum";
+  z.promise(z.string()).def.type satisfies "promise";
+  z.lazy(() => z.string()).def.type satisfies "lazy";
+  z.string().optional().def.type satisfies "optional";
+  z.string().default("default").def.type satisfies "default";
+  z.templateLiteral([z.literal("a"), z.literal("b")]).def.type satisfies "template_literal";
+  z.custom<string>((val) => typeof val === "string").def.type satisfies "custom";
+  z.transform((val) => val as string).def.type satisfies "transform";
+  z.string().optional().nonoptional().def.type satisfies "nonoptional";
+  z.object({ key: z.string() }).readonly().def.type satisfies "readonly";
+  z.nan().def.type satisfies "nan";
+  z.unknown().pipe(z.number()).def.type satisfies "pipe";
+  z.success(z.string()).def.type satisfies "success";
+  z.string().catch("fallback").def.type satisfies "catch";
+  z.file().def.type satisfies "file";
+});
diff --git a/packages/zod/src/v4/classic/tests/literal.test.ts b/packages/zod/src/v4/classic/tests/literal.test.ts
index e769dcd8..78d1c088 100644
--- a/packages/zod/src/v4/classic/tests/literal.test.ts
+++ b/packages/zod/src/v4/classic/tests/literal.test.ts
@@ -85,3 +85,8 @@ test(".value getter", () => {
   expect(z.literal("tuna").value).toEqual("tuna");
   expect(() => z.literal([1, 2, 3]).value).toThrow();
 });
+
+test("readonly", () => {
+  const a = ["asdf"] as const;
+  z.literal(a);
+});
diff --git a/packages/zod/src/v4/classic/tests/nested-refine.test.ts b/packages/zod/src/v4/classic/tests/nested-refine.test.ts
index 0d3401e9..b33b9ef4 100644
--- a/packages/zod/src/v4/classic/tests/nested-refine.test.ts
+++ b/packages/zod/src/v4/classic/tests/nested-refine.test.ts
@@ -45,11 +45,12 @@ test("nested refinements", () => {
         "origin": "string",
         "code": "too_small",
         "minimum": 1,
+        "inclusive": true,
         "path": [
           "nested",
           "confirm"
         ],
-        "message": "Too small: expected string to have >1 characters"
+        "message": "Too small: expected string to have >=1 characters"
       },
       {
         "code": "custom",
@@ -87,11 +88,12 @@ test("nested refinements", () => {
         "origin": "string",
         "code": "too_small",
         "minimum": 1,
+        "inclusive": true,
         "path": [
           "nested",
           "confirm"
         ],
-        "message": "Too small: expected string to have >1 characters"
+        "message": "Too small: expected string to have >=1 characters"
       },
       {
         "code": "custom",
@@ -127,7 +129,8 @@ test("nested refinements", () => {
       "issues": [
         {
           "code": "too_small",
-          "message": "Too small: expected string to have >1 characters",
+          "inclusive": true,
+          "message": "Too small: expected string to have >=1 characters",
           "minimum": 1,
           "origin": "string",
           "path": [
diff --git a/packages/zod/src/v4/classic/tests/number.test.ts b/packages/zod/src/v4/classic/tests/number.test.ts
index 937d044c..a6084474 100644
--- a/packages/zod/src/v4/classic/tests/number.test.ts
+++ b/packages/zod/src/v4/classic/tests/number.test.ts
@@ -240,3 +240,8 @@ test("string format methods", () => {
   expect(a.parse(6)).toEqual(6);
   expect(() => a.parse(1)).toThrow();
 });
+
+test("error customization", () => {
+  z.number().gte(5, { error: (iss) => "Min: " + iss.minimum.valueOf() });
+  z.number().lte(5, { error: (iss) => "Max: " + iss.maximum.valueOf() });
+});
diff --git a/packages/zod/src/v4/classic/tests/object.test.ts b/packages/zod/src/v4/classic/tests/object.test.ts
index f79ad985..2105f6c7 100644
--- a/packages/zod/src/v4/classic/tests/object.test.ts
+++ b/packages/zod/src/v4/classic/tests/object.test.ts
@@ -223,7 +223,6 @@ test("inferred merged object type with optional properties", async () => {
     .merge(z.object({ a: z.string().optional(), b: z.string() }));
   type Merged = z.infer<typeof Merged>;
   expectTypeOf<Merged>().toEqualTypeOf<{ a?: string; b: string }>();
-
   expectTypeOf<Merged>().toEqualTypeOf<{ a?: string; b: string }>();
 });
 
diff --git a/packages/zod/src/v4/classic/tests/preprocess.test.ts b/packages/zod/src/v4/classic/tests/preprocess.test.ts
index 6a8faee4..d782df06 100644
--- a/packages/zod/src/v4/classic/tests/preprocess.test.ts
+++ b/packages/zod/src/v4/classic/tests/preprocess.test.ts
@@ -214,10 +214,11 @@ test("preprocess as the second property of object", () => {
         "origin": "string",
         "code": "too_small",
         "minimum": 1,
+        "inclusive": true,
         "path": [
           "nonEmptyStr"
         ],
-        "message": "Too small: expected string to have >1 characters"
+        "message": "Too small: expected string to have >=1 characters"
       },
       {
         "origin": "number",
@@ -270,3 +271,28 @@ test("preprocess validates with sibling errors", () => {
     }
   `);
 });
+
+test("perform transform with non-fatal issues", () => {
+  const A = z
+    .string()
+    .refine((_) => false)
+    .min(4)
+    .transform((val) => val.length)
+    .pipe(z.number())
+    .refine((_) => false);
+  expect(A.safeParse("asdfasdf").error!.issues).toHaveLength(2);
+  expect(A.safeParse("asdfasdf").error).toMatchInlineSnapshot(`
+    [ZodError: [
+      {
+        "code": "custom",
+        "path": [],
+        "message": "Invalid input"
+      },
+      {
+        "code": "custom",
+        "path": [],
+        "message": "Invalid input"
+      }
+    ]]
+  `);
+});
diff --git a/packages/zod/src/v4/classic/tests/prototypes.test.ts b/packages/zod/src/v4/classic/tests/prototypes.test.ts
new file mode 100644
index 00000000..058bf6cb
--- /dev/null
+++ b/packages/zod/src/v4/classic/tests/prototypes.test.ts
@@ -0,0 +1,23 @@
+import { expect, test } from "vitest";
+import * as z from "zod/v4";
+
+declare module "zod/v4" {
+  interface ZodType {
+    /** @deprecated */
+    _classic(): string;
+  }
+}
+
+test("prototype extension", () => {
+  z.ZodType.prototype._classic = function () {
+    return "_classic";
+  };
+
+  // should pass
+  const result = z.string()._classic();
+  expect(result).toBe("_classic");
+  // expectTypeOf<typeof result>().toEqualTypeOf<string>();
+
+  // clean up
+  z.ZodType.prototype._classic = undefined;
+});
diff --git a/packages/zod/src/v4/classic/tests/recursive-types.test.ts b/packages/zod/src/v4/classic/tests/recursive-types.test.ts
index ad4256fc..31b387c7 100644
--- a/packages/zod/src/v4/classic/tests/recursive-types.test.ts
+++ b/packages/zod/src/v4/classic/tests/recursive-types.test.ts
@@ -25,9 +25,15 @@ test("recursion with z.lazy", () => {
   const Category = z.object({
     name: z.string(),
     get subcategories() {
-      return z.array(Category);
+      return z.array(Category).optional().nullable();
     },
   });
+  type Category = z.infer<typeof Category>;
+  interface _Category {
+    name: string;
+    subcategories?: _Category[] | undefined | null;
+  }
+  expectTypeOf<Category>().toEqualTypeOf<_Category>();
   Category.parse(data);
 });
 
@@ -46,14 +52,18 @@ test("recursion involving union type", () => {
     },
   };
 
-  const LL = z
-    .object({
-      value: z.number(),
-      get next() {
-        return LL.nullable();
-      },
-    })
-    .or(z.null());
+  const LL = z.object({
+    value: z.number(),
+    get next() {
+      return LL.nullable();
+    },
+  });
+  type LL = z.infer<typeof LL>;
+  type _LL = {
+    value: number;
+    next: _LL | null;
+  };
+  expectTypeOf<LL>().toEqualTypeOf<_LL>();
 
   LL.parse(data);
 });
@@ -91,6 +101,18 @@ test("mutual recursion - native", () => {
     },
   };
 
+  type Alazy = z.infer<typeof Alazy>;
+  type Blazy = z.infer<typeof Blazy>;
+  interface _Alazy {
+    val: number;
+    b: _Blazy;
+  }
+  interface _Blazy {
+    val: number;
+    a?: _Alazy | undefined;
+  }
+  expectTypeOf<Alazy>().toEqualTypeOf<_Alazy>();
+  expectTypeOf<Blazy>().toEqualTypeOf<_Blazy>();
   Alazy.parse(testData);
   Blazy.parse(testData.b);
 
@@ -106,6 +128,7 @@ test("pick and omit with getter", () => {
   });
 
   type Category = z.infer<typeof Category>;
+
   interface _Category {
     name: string;
     subcategories: _Category[];
@@ -124,3 +147,179 @@ test("pick and omit with getter", () => {
   expect(() => PickedCategory.parse({ name: "test", subcategories: [] })).toThrow();
   expect(() => OmittedCategory.parse({ name: "test", subcategories: [] })).toThrow();
 });
+
+test("deferred self-recursion", () => {
+  const Feature = z.object({
+    title: z.string(),
+    get features(): z.ZodOptional<z.ZodArray<typeof Feature>> {
+      return z.optional(z.array(Feature)); //.optional();
+    },
+  });
+  // type Feature = z.infer<typeof Feature>;
+
+  const Output = z.object({
+    id: z.int(), //.nonnegative(),
+    name: z.string(),
+    features: z.array(Feature), //.array(), // <—
+  });
+
+  type Output = z.output<typeof Output>;
+
+  type _Feature = {
+    title: string;
+    features?: _Feature[] | undefined;
+  };
+
+  type _Output = {
+    id: number;
+    name: string;
+    features: _Feature[];
+  };
+
+  // expectTypeOf<Feature>().toEqualTypeOf<_Feature>();
+  expectTypeOf<Output>().toEqualTypeOf<_Output>();
+});
+
+test("deferred mutual recursion", () => {
+  const Slot = z.object({
+    slotCode: z.string(),
+
+    get blocks() {
+      return z.array(Block);
+    },
+  });
+  type Slot = z.infer<typeof Slot>;
+
+  const Block = z.object({
+    blockCode: z.string(),
+    get slots() {
+      return z.array(Slot).optional();
+    },
+  });
+  type Block = z.infer<typeof Block>;
+
+  const Page = z.object({
+    slots: z.array(Slot),
+  });
+  type Page = z.infer<typeof Page>;
+
+  type _Slot = {
+    slotCode: string;
+    blocks: _Block[];
+  };
+  type _Block = {
+    blockCode: string;
+    slots?: _Slot[] | undefined;
+  };
+  type _Page = {
+    slots: _Slot[];
+  };
+  expectTypeOf<Slot>().toEqualTypeOf<_Slot>();
+  expectTypeOf<Block>().toEqualTypeOf<_Block>();
+  expectTypeOf<Page>().toEqualTypeOf<_Page>();
+});
+
+test("mutual recursion with meta", () => {
+  const A = z
+    .object({
+      name: z.string(),
+      get b() {
+        return B;
+      },
+    })
+    .readonly()
+    .meta({ id: "A" })
+    .optional();
+
+  const B = z
+    .object({
+      name: z.string(),
+      get a() {
+        return A;
+      },
+    })
+    .readonly()
+    .meta({ id: "B" });
+
+  type A = z.infer<typeof A>;
+  type B = z.infer<typeof B>;
+
+  type _A =
+    | Readonly<{
+        name: string;
+        b: _B;
+      }>
+    | undefined;
+  // | undefined;
+  type _B = Readonly<{
+    name: string;
+    a?: _A;
+  }>;
+  expectTypeOf<A>().toEqualTypeOf<_A>();
+  expectTypeOf<B>().toEqualTypeOf<_B>();
+});
+
+test("recursion compatibility", () => {
+  // array
+  const A = z.object({
+    get array() {
+      return A.array();
+    },
+    get optional() {
+      return A.optional();
+    },
+    get nullable() {
+      return A.nullable();
+    },
+    get nonoptional() {
+      return A.nonoptional();
+    },
+    get readonly() {
+      return A.readonly();
+    },
+    get describe() {
+      return A.describe("A recursive type");
+    },
+    get meta() {
+      return A.meta({ description: "A recursive type" });
+    },
+    get pipe() {
+      return A.pipe(z.any());
+    },
+    get strict() {
+      return A.strict();
+    },
+    get tuple() {
+      return z.tuple([A, A]);
+    },
+    get object() {
+      return z
+        .object({
+          subcategories: A,
+        })
+        .strict()
+        .loose();
+    },
+    get union() {
+      return z.union([A, A]);
+    },
+    get intersection() {
+      return z.intersection(A, A);
+    },
+    get record() {
+      return z.record(z.string(), A);
+    },
+    get map() {
+      return z.map(z.string(), A);
+    },
+    get set() {
+      return z.set(A);
+    },
+    get lazy() {
+      return z.lazy(() => A);
+    },
+    get promise() {
+      return z.promise(A);
+    },
+  });
+});
diff --git a/packages/zod/src/v4/classic/tests/registries.test.ts b/packages/zod/src/v4/classic/tests/registries.test.ts
index 6e4a9cbd..23209ad7 100644
--- a/packages/zod/src/v4/classic/tests/registries.test.ts
+++ b/packages/zod/src/v4/classic/tests/registries.test.ts
@@ -163,3 +163,33 @@ test("loose examples", () => {
     examples: ["example"],
   });
 });
+
+test("function meta witout replacement", () => {
+  const myReg = z.registry<{
+    defaulter: (arg: string, test: boolean) => number;
+  }>();
+
+  const mySchema = z.date();
+  myReg.add(mySchema, {
+    defaulter: (arg, _test) => {
+      return arg.length;
+    },
+  });
+
+  expect(myReg.get(mySchema)!.defaulter("hello", true)).toEqual(5);
+});
+
+test("function meta with replacement", () => {
+  const myReg = z.registry<{
+    defaulter: (arg: z.$input, test: boolean) => z.$output;
+  }>();
+
+  const mySchema = z.string().transform((val) => val.length);
+  myReg.add(mySchema, {
+    defaulter: (arg, _test) => {
+      return arg.length;
+    },
+  });
+
+  expect(myReg.get(mySchema)!.defaulter("hello", true)).toEqual(5);
+});
diff --git a/packages/zod/src/v4/classic/tests/string.test.ts b/packages/zod/src/v4/classic/tests/string.test.ts
index 154a9187..18b37450 100644
--- a/packages/zod/src/v4/classic/tests/string.test.ts
+++ b/packages/zod/src/v4/classic/tests/string.test.ts
@@ -1119,3 +1119,353 @@ test("E.164 validation", () => {
   expect(validE164Numbers.every((number) => e164Number.safeParse(number).success)).toBe(true);
   expect(invalidE164Numbers.every((number) => e164Number.safeParse(number).success === false)).toBe(true);
 });
+
+test("continuability", () => {
+  /** 
+   *  | $ZodGUID
+  | $ZodUUID
+  | $ZodEmail
+  | $ZodURL
+  | $ZodEmoji
+  | $ZodNanoID
+  | $ZodCUID
+  | $ZodCUID2
+  | $ZodULID
+  | $ZodXID
+  | $ZodKSUID
+  | $ZodISODateTime
+  | $ZodISODate
+  | $ZodISOTime
+  | $ZodISODuration
+  | $ZodIPv4
+  | $ZodIPv6
+  | $ZodCIDRv4
+  | $ZodCIDRv6
+  | $ZodBase64
+  | $ZodBase64URL
+  | $ZodE164
+  | $ZodJWT;
+   */
+  expect(
+    z
+      .email()
+      .refine(() => false)
+      .safeParse("invalid_value").error!.issues
+  ).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "invalid_format",
+        "format": "email",
+        "message": "Invalid email address",
+        "origin": "string",
+        "path": [],
+        "pattern": "/^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/",
+      },
+      {
+        "code": "custom",
+        "message": "Invalid input",
+        "path": [],
+      },
+    ]
+  `);
+  expect(
+    z
+      .uuid()
+      .refine(() => false)
+      .safeParse("invalid_value").error!.issues
+  ).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "invalid_format",
+        "format": "uuid",
+        "message": "Invalid UUID",
+        "origin": "string",
+        "path": [],
+        "pattern": "/^([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)$/",
+      },
+      {
+        "code": "custom",
+        "message": "Invalid input",
+        "path": [],
+      },
+    ]
+  `);
+  expect(
+    z
+      .url()
+      .refine(() => false)
+      .safeParse("invalid_value").error!.issues
+  ).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "invalid_format",
+        "format": "url",
+        "message": "Invalid URL",
+        "path": [],
+      },
+      {
+        "code": "custom",
+        "message": "Invalid input",
+        "path": [],
+      },
+    ]
+  `);
+  expect(
+    z
+      .jwt()
+      .refine(() => false)
+      .safeParse("invalid_value").error!.issues
+  ).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "invalid_format",
+        "format": "jwt",
+        "message": "Invalid JWT",
+        "path": [],
+      },
+      {
+        "code": "custom",
+        "message": "Invalid input",
+        "path": [],
+      },
+    ]
+  `);
+  expect(
+    z
+      .cidrv4()
+      .refine(() => false)
+      .safeParse("invalid_value").error!.issues
+  ).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "invalid_format",
+        "format": "cidrv4",
+        "message": "Invalid IPv4 range",
+        "origin": "string",
+        "path": [],
+        "pattern": "/^((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])$/",
+      },
+      {
+        "code": "custom",
+        "message": "Invalid input",
+        "path": [],
+      },
+    ]
+  `);
+  expect(
+    z
+      .cidrv6()
+      .refine(() => false)
+      .safeParse("invalid_value").error!.issues
+  ).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "invalid_format",
+        "format": "cidrv6",
+        "message": "Invalid IPv6 range",
+        "path": [],
+      },
+      {
+        "code": "custom",
+        "message": "Invalid input",
+        "path": [],
+      },
+    ]
+  `);
+  expect(
+    z
+      .ipv4()
+      .refine(() => false)
+      .safeParse("invalid_value").error!.issues
+  ).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "invalid_format",
+        "format": "ipv4",
+        "message": "Invalid IPv4 address",
+        "origin": "string",
+        "path": [],
+        "pattern": "/^(?:(?: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])$/",
+      },
+      {
+        "code": "custom",
+        "message": "Invalid input",
+        "path": [],
+      },
+    ]
+  `);
+  expect(
+    z
+      .ipv6()
+      .refine(() => false)
+      .safeParse("invalid_value").error!.issues
+  ).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "invalid_format",
+        "format": "ipv6",
+        "message": "Invalid IPv6 address",
+        "path": [],
+      },
+      {
+        "code": "custom",
+        "message": "Invalid input",
+        "path": [],
+      },
+    ]
+  `);
+  expect(
+    z
+      .emoji()
+      .refine(() => false)
+      .safeParse("invalid_value").error!.issues
+  ).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "invalid_format",
+        "format": "emoji",
+        "message": "Invalid emoji",
+        "origin": "string",
+        "path": [],
+        "pattern": "/^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$/u",
+      },
+      {
+        "code": "custom",
+        "message": "Invalid input",
+        "path": [],
+      },
+    ]
+  `);
+  expect(
+    z
+      .nanoid()
+      .refine(() => false)
+      .safeParse("invalid_value").error!.issues
+  ).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "invalid_format",
+        "format": "nanoid",
+        "message": "Invalid nanoid",
+        "origin": "string",
+        "path": [],
+        "pattern": "/^[a-zA-Z0-9_-]{21}$/",
+      },
+      {
+        "code": "custom",
+        "message": "Invalid input",
+        "path": [],
+      },
+    ]
+  `);
+  expect(
+    z
+      .cuid()
+      .refine(() => false)
+      .safeParse("invalid_value").error!.issues
+  ).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "invalid_format",
+        "format": "cuid",
+        "message": "Invalid cuid",
+        "origin": "string",
+        "path": [],
+        "pattern": "/^[cC][^\\s-]{8,}$/",
+      },
+      {
+        "code": "custom",
+        "message": "Invalid input",
+        "path": [],
+      },
+    ]
+  `);
+  expect(
+    z
+      .cuid2()
+      .refine(() => false)
+      .safeParse("invalid_value").error!.issues
+  ).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "invalid_format",
+        "format": "cuid2",
+        "message": "Invalid cuid2",
+        "origin": "string",
+        "path": [],
+        "pattern": "/^[0-9a-z]+$/",
+      },
+      {
+        "code": "custom",
+        "message": "Invalid input",
+        "path": [],
+      },
+    ]
+  `);
+  expect(
+    z
+      .ulid()
+      .refine(() => false)
+      .safeParse("invalid_value").error!.issues
+  ).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "invalid_format",
+        "format": "ulid",
+        "message": "Invalid ULID",
+        "origin": "string",
+        "path": [],
+        "pattern": "/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/",
+      },
+      {
+        "code": "custom",
+        "message": "Invalid input",
+        "path": [],
+      },
+    ]
+  `);
+  expect(
+    z
+      .xid()
+      .refine(() => false)
+      .safeParse("invalid_value").error!.issues
+  ).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "invalid_format",
+        "format": "xid",
+        "message": "Invalid XID",
+        "origin": "string",
+        "path": [],
+        "pattern": "/^[0-9a-vA-V]{20}$/",
+      },
+      {
+        "code": "custom",
+        "message": "Invalid input",
+        "path": [],
+      },
+    ]
+  `);
+  expect(
+    z
+      .ksuid()
+      .refine(() => false)
+      .safeParse("invalid_value").error!.issues
+  ).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "invalid_format",
+        "format": "ksuid",
+        "message": "Invalid KSUID",
+        "origin": "string",
+        "path": [],
+        "pattern": "/^[A-Za-z0-9]{27}$/",
+      },
+      {
+        "code": "custom",
+        "message": "Invalid input",
+        "path": [],
+      },
+    ]
+  `);
+});
diff --git a/packages/zod/src/v4/classic/tests/stringbool.test.ts b/packages/zod/src/v4/classic/tests/stringbool.test.ts
index f0cd31ea..2fe6c913 100644
--- a/packages/zod/src/v4/classic/tests/stringbool.test.ts
+++ b/packages/zod/src/v4/classic/tests/stringbool.test.ts
@@ -5,6 +5,8 @@ test("z.stringbool", () => {
   const a = z.stringbool();
   type a = z.infer<typeof a>;
   expectTypeOf<a>().toEqualTypeOf<boolean>();
+  type a_in = z.input<typeof a>;
+  expectTypeOf<a_in>().toEqualTypeOf<string>();
 
   expect(z.parse(a, "true")).toEqual(true);
   expect(z.parse(a, "yes")).toEqual(true);
@@ -28,20 +30,31 @@ test("z.stringbool", () => {
   expect(z.safeParse(a, {})).toMatchObject({ success: false });
   expect(z.safeParse(a, true)).toMatchObject({ success: false });
   expect(z.safeParse(a, false)).toMatchObject({ success: false });
+});
 
+test("custom values", () => {
   const b = z.stringbool({
     truthy: ["y"],
-    falsy: ["n"],
+    falsy: ["N"],
   });
   expect(z.parse(b, "y")).toEqual(true);
+  expect(z.parse(b, "Y")).toEqual(true);
   expect(z.parse(b, "n")).toEqual(false);
+  expect(z.parse(b, "N")).toEqual(false);
   expect(z.safeParse(b, "true")).toMatchObject({ success: false });
   expect(z.safeParse(b, "false")).toMatchObject({ success: false });
+});
 
+test("custom values - case sensitive", () => {
   const c = z.stringbool({
+    truthy: ["y"],
+    falsy: ["N"],
     case: "sensitive",
   });
-  expect(z.parse(c, "true")).toEqual(true);
+  expect(z.parse(c, "y")).toEqual(true);
+  expect(z.safeParse(c, "Y")).toMatchObject({ success: false });
+  expect(z.parse(c, "N")).toEqual(false);
+  expect(z.safeParse(c, "n")).toMatchObject({ success: false });
   expect(z.safeParse(c, "TRUE")).toMatchObject({ success: false });
 });
 
diff --git a/packages/zod/src/v4/classic/tests/to-json-schema.test.ts b/packages/zod/src/v4/classic/tests/to-json-schema.test.ts
index d8684c94..cb86071f 100644
--- a/packages/zod/src/v4/classic/tests/to-json-schema.test.ts
+++ b/packages/zod/src/v4/classic/tests/to-json-schema.test.ts
@@ -365,7 +365,15 @@ describe("toJSONSchema", () => {
 
   test("string patterns", () => {
     expect(
-      z.toJSONSchema(z.string().startsWith("hello").includes("cruel").endsWith("world").regex(/stuff/))
+      z.toJSONSchema(
+        z
+          .string()
+          .startsWith("hello")
+          .includes("cruel")
+          .includes("dark", { position: 10 })
+          .endsWith("world")
+          .regex(/stuff/)
+      )
     ).toMatchInlineSnapshot(`
       {
         "$schema": "https://json-schema.org/draft/2020-12/schema",
@@ -376,6 +384,9 @@ describe("toJSONSchema", () => {
           {
             "pattern": "cruel",
           },
+          {
+            "pattern": "^.{10}dark",
+          },
           {
             "pattern": ".*world$",
           },
@@ -388,9 +399,18 @@ describe("toJSONSchema", () => {
     `);
 
     expect(
-      z.toJSONSchema(z.string().startsWith("hello").includes("cruel").endsWith("world").regex(/stuff/), {
-        target: "draft-7",
-      })
+      z.toJSONSchema(
+        z
+          .string()
+          .startsWith("hello")
+          .includes("cruel")
+          .includes("dark", { position: 10 })
+          .endsWith("world")
+          .regex(/stuff/),
+        {
+          target: "draft-7",
+        }
+      )
     ).toMatchInlineSnapshot(`
       {
         "$schema": "http://json-schema.org/draft-07/schema#",
@@ -403,6 +423,10 @@ describe("toJSONSchema", () => {
             "pattern": "cruel",
             "type": "string",
           },
+          {
+            "pattern": "^.{10}dark",
+            "type": "string",
+          },
           {
             "pattern": ".*world$",
             "type": "string",
@@ -679,14 +703,24 @@ describe("toJSONSchema", () => {
       {
         "$schema": "https://json-schema.org/draft/2020-12/schema",
         "const": "hello",
+        "type": "string",
       }
     `);
 
-    const b = z.literal(["hello", undefined, null, 5, BigInt(1324)]);
-    expect(() => z.toJSONSchema(b)).toThrow();
+    const b = z.literal(7);
+    expect(z.toJSONSchema(b)).toMatchInlineSnapshot(`
+      {
+        "$schema": "https://json-schema.org/draft/2020-12/schema",
+        "const": 7,
+        "type": "number",
+      }
+    `);
 
-    const c = z.literal(["hello", null, 5]);
-    expect(z.toJSONSchema(c)).toMatchInlineSnapshot(`
+    const c = z.literal(["hello", undefined, null, 5, BigInt(1324)]);
+    expect(() => z.toJSONSchema(c)).toThrow();
+
+    const d = z.literal(["hello", null, 5]);
+    expect(z.toJSONSchema(d)).toMatchInlineSnapshot(`
       {
         "$schema": "https://json-schema.org/draft/2020-12/schema",
         "enum": [
@@ -696,6 +730,19 @@ describe("toJSONSchema", () => {
         ],
       }
     `);
+
+    const e = z.literal(["hello", "zod", "v4"]);
+    expect(z.toJSONSchema(e)).toMatchInlineSnapshot(`
+      {
+        "$schema": "https://json-schema.org/draft/2020-12/schema",
+        "enum": [
+          "hello",
+          "zod",
+          "v4",
+        ],
+        "type": "string",
+      }
+    `);
   });
 
   // pipe
@@ -1591,6 +1638,8 @@ test("top-level readonly", () => {
     })
     .readonly()
     .meta({ id: "A" });
+  // z.globalRegistry.add(A, { id: "A" });
+  // .meta({ id: "A" });
 
   const B = z
     .object({
@@ -1601,6 +1650,8 @@ test("top-level readonly", () => {
     })
     .readonly()
     .meta({ id: "B" });
+  // z.globalRegistry.add(B, { id: "B" });
+  // .meta({ id: "B" });
 
   const result = z.z.toJSONSchema(A);
   expect(result).toMatchInlineSnapshot(`
diff --git a/packages/zod/src/v4/classic/tests/validations.test.ts b/packages/zod/src/v4/classic/tests/validations.test.ts
index 6be5d40f..fecc2893 100644
--- a/packages/zod/src/v4/classic/tests/validations.test.ts
+++ b/packages/zod/src/v4/classic/tests/validations.test.ts
@@ -47,7 +47,8 @@ test("string min/max", async () => {
       [
         {
           "code": "too_small",
-          "message": "Too small: expected string to have >4 characters",
+          "inclusive": true,
+          "message": "Too small: expected string to have >=4 characters",
           "minimum": 4,
           "origin": "string",
           "path": [],
@@ -66,8 +67,9 @@ test("string max", async () => {
       [
         {
           "code": "too_big",
+          "inclusive": true,
           "maximum": 4,
-          "message": "Too big: expected string to have <4 characters",
+          "message": "Too big: expected string to have <=4 characters",
           "origin": "string",
           "path": [],
         },
diff --git a/packages/zod/src/v4/mini/tests/assignability.test.ts b/packages/zod/src/v4/mini/tests/assignability.test.ts
index c89b2e5b..c30d5ea9 100644
--- a/packages/zod/src/v4/mini/tests/assignability.test.ts
+++ b/packages/zod/src/v4/mini/tests/assignability.test.ts
@@ -115,3 +115,15 @@ test("assignability", () => {
   // $ZodFile
   z.file() satisfies z.core.$ZodFile;
 });
+
+test("assignability with type narrowing", () => {
+  type _RefinedSchema<T extends z.ZodMiniType<object> | z.ZodMiniUnion> = T extends z.ZodMiniUnion
+    ? RefinedUnionSchema<T> // <-- Type instantiation is excessively deep and possibly infinite.
+    : T extends z.ZodMiniType<object>
+      ? RefinedTypeSchema<z.output<T>> // <-- Type instantiation is excessively deep and possibly infinite.
+      : never;
+
+  type RefinedTypeSchema<T extends object> = T;
+
+  type RefinedUnionSchema<T extends z.ZodMiniUnion> = T;
+});
diff --git a/packages/zod/src/v4/mini/tests/index.test.ts b/packages/zod/src/v4/mini/tests/index.test.ts
index 7f6b3402..75638656 100644
--- a/packages/zod/src/v4/mini/tests/index.test.ts
+++ b/packages/zod/src/v4/mini/tests/index.test.ts
@@ -427,6 +427,8 @@ test("z.literal", () => {
   expect(z.parse(a, "hello")).toEqual("hello");
   expect(() => z.parse(a, "world")).toThrow();
   expect(() => z.parse(a, 123)).toThrow();
+
+  z.literal(["adf"] as const);
 });
 
 test("z.file", () => {
@@ -824,3 +826,45 @@ test("z.pipe type enforcement", () => {
     z.date().check(z.maximum(new Date()))
   );
 });
+
+test("def typing", () => {
+  z.string().def.type satisfies "string";
+  z.email().def.format satisfies "email";
+  z.number().def.type satisfies "number";
+  z.float64().def.format satisfies z.core.$ZodNumberFormats;
+  z.bigint().def.type satisfies "bigint";
+  z.boolean().def.type satisfies "boolean";
+  z.date().def.type satisfies "date";
+  z.symbol().def.type satisfies "symbol";
+  z.undefined().def.type satisfies "undefined";
+  z.nullable(z.string()).def.type satisfies "nullable";
+  z.null().def.type satisfies "null";
+  z.any().def.type satisfies "any";
+  z.unknown().def.type satisfies "unknown";
+  z.never().def.type satisfies "never";
+  z.void().def.type satisfies "void";
+  z.array(z.string()).def.type satisfies "array";
+  z.object({ key: z.string() }).def.type satisfies "object";
+  z.union([z.string(), z.number()]).def.type satisfies "union";
+  z.intersection(z.string(), z.number()).def.type satisfies "intersection";
+  z.tuple([z.string(), z.number()]).def.type satisfies "tuple";
+  z.record(z.string(), z.number()).def.type satisfies "record";
+  z.map(z.string(), z.number()).def.type satisfies "map";
+  z.set(z.string()).def.type satisfies "set";
+  z.literal("example").def.type satisfies "literal";
+  z.enum(["a", "b", "c"]).def.type satisfies "enum";
+  z.promise(z.string()).def.type satisfies "promise";
+  z.lazy(() => z.string()).def.type satisfies "lazy";
+  z.optional(z.string()).def.type satisfies "optional";
+  z._default(z.string(), "default").def.type satisfies "default";
+  z.templateLiteral([z.literal("a"), z.literal("b")]).def.type satisfies "template_literal";
+  z.custom<string>((val) => typeof val === "string").def.type satisfies "custom";
+  z.transform((val) => val as string).def.type satisfies "transform";
+  z.nonoptional(z.string()).def.type satisfies "nonoptional";
+  z.readonly(z.unknown()).def.type satisfies "readonly";
+  z.nan().def.type satisfies "nan";
+  z.pipe(z.unknown(), z.number()).def.type satisfies "pipe";
+  z.success(z.string()).def.type satisfies "success";
+  z.catch(z.string(), "fallback").def.type satisfies "catch";
+  z.file().def.type satisfies "file";
+});
diff --git a/packages/zod/src/v4/mini/tests/prototypes.test.ts b/packages/zod/src/v4/mini/tests/prototypes.test.ts
index 86d27925..b5609f1f 100644
--- a/packages/zod/src/v4/mini/tests/prototypes.test.ts
+++ b/packages/zod/src/v4/mini/tests/prototypes.test.ts
@@ -1,23 +1,43 @@
 import { expect, test } from "vitest";
 import * as z from "zod/v4-mini";
 
-// declare module "@zod/core" {
-//   interface $ZodType {
-//     /** @deprecated */
-//     fun(): string;
-//   }
-// }
+declare module "zod/v4/core" {
+  interface $ZodType {
+    /** @deprecated */
+    _core(): string;
+  }
+}
 
 test("prototype extension", () => {
-  z.ZodMiniType.prototype.fun = function () {
-    return "fun";
+  z.core.$ZodType.prototype._core = function () {
+    return "_core";
   };
 
   // should pass
-  const result = (z.string() as any).fun();
-  expect(result).toBe("fun");
+  const result = z.string()._core();
+  expect(result).toBe("_core");
   // expectTypeOf<typeof result>().toEqualTypeOf<string>();
 
   // clean up
-  z.ZodMiniType.prototype.fun = undefined;
+  z.ZodMiniType.prototype._core = undefined;
+});
+
+declare module "zod/v4/mini" {
+  interface ZodMiniType {
+    /** @deprecated */
+    _mini(): string;
+  }
+}
+
+test("prototype extension", () => {
+  z.ZodMiniType.prototype._mini = function () {
+    return "_mini";
+  };
+
+  // should pass
+  const result = z.string()._mini();
+  expect(result).toBe("_mini");
+
+  // clean up
+  z.ZodMiniType.prototype._mini = undefined;
 });
diff --git a/packages/zod/src/v4/mini/tests/recursive-types.test.ts b/packages/zod/src/v4/mini/tests/recursive-types.test.ts
index d57b4b31..512c60d3 100644
--- a/packages/zod/src/v4/mini/tests/recursive-types.test.ts
+++ b/packages/zod/src/v4/mini/tests/recursive-types.test.ts
@@ -24,11 +24,18 @@ test("recursion with z.lazy", () => {
 
   const Category = z.object({
     name: z.string(),
-    get subcategories() {
-      return z.array(Category);
+    get subcategories(): z.ZodMiniOptional<z.ZodMiniArray<typeof Category>> {
+      return z.optional(z.array(Category));
     },
   });
   Category.parse(data);
+
+  type Category = z.infer<typeof Category>;
+  interface _Category {
+    name: string;
+    subcategories?: _Category[];
+  }
+  expectTypeOf<Category>().toEqualTypeOf<_Category>();
 });
 
 test("recursion involving union type", () => {
@@ -54,19 +61,25 @@ test("recursion involving union type", () => {
   });
 
   LL.parse(data);
+  type LL = z.infer<typeof LL>;
+  type _LL = {
+    value: number;
+    next: _LL | null;
+  };
+  expectTypeOf<LL>().toEqualTypeOf<_LL>();
 });
 
 test("mutual recursion - native", () => {
   const Alazy = z.object({
     val: z.number(),
     get b() {
-      return Blazy;
+      return z.optional(Blazy);
     },
   });
 
   const Blazy = z.object({
     val: z.number(),
-    get a(): z.ZodMiniOptional<typeof Alazy> {
+    get a() {
       return z.optional(Alazy);
     },
   });
@@ -92,6 +105,19 @@ test("mutual recursion - native", () => {
   Alazy.parse(testData);
   Blazy.parse(testData.b);
 
+  type Alazy = z.infer<typeof Alazy>;
+  type Blazy = z.infer<typeof Blazy>;
+  interface _Alazy {
+    val: number;
+    b?: _Blazy | undefined;
+  }
+  interface _Blazy {
+    val: number;
+    a?: _Alazy | undefined;
+  }
+  expectTypeOf<Alazy>().toEqualTypeOf<_Alazy>();
+  expectTypeOf<Blazy>().toEqualTypeOf<_Blazy>();
+
   expect(() => Alazy.parse({ val: "asdf" })).toThrow();
 });
 
@@ -112,6 +138,16 @@ test("pick and omit with getter", () => {
 
   const PickedCategory = z.pick(Category, { name: true });
   const OmittedCategory = z.omit(Category, { subcategories: true });
+  type PickedCategory = z.infer<typeof PickedCategory>;
+  type OmittedCategory = z.infer<typeof OmittedCategory>;
+  interface _PickedCategory {
+    name: string;
+  }
+  interface _OmittedCategory {
+    name: string;
+  }
+  expectTypeOf<PickedCategory>().toEqualTypeOf<_PickedCategory>();
+  expectTypeOf<OmittedCategory>().toEqualTypeOf<_OmittedCategory>();
 
   const picked = { name: "test" };
   const omitted = { name: "test" };
@@ -122,3 +158,118 @@ test("pick and omit with getter", () => {
   expect(() => PickedCategory.parse({ name: "test", subcategories: [] })).toThrow();
   expect(() => OmittedCategory.parse({ name: "test", subcategories: [] })).toThrow();
 });
+
+test("deferred self-recursion", () => {
+  const Feature = z.object({
+    title: z.string(),
+    get features(): z.ZodMiniOptional<z.ZodMiniArray<typeof Feature>> {
+      return z.optional(z.array(Feature)); //.optional();
+    },
+  });
+  type Feature = z.infer<typeof Feature>;
+
+  const Output = z.object({
+    id: z.int(), //.nonnegative(),
+    name: z.string(),
+    features: z.array(Feature), //.array(), // <—
+  });
+
+  type Output = z.output<typeof Output>;
+
+  type _Feature = {
+    title: string;
+    features?: _Feature[] | undefined;
+  };
+
+  type _Output = {
+    id: number;
+    name: string;
+    features: _Feature[];
+  };
+
+  expectTypeOf<Feature>().toEqualTypeOf<_Feature>();
+  expectTypeOf<Output>().toEqualTypeOf<_Output>();
+});
+
+test("recursion compatibility", () => {
+  // array
+  const A = z.object({
+    get subcategories() {
+      return z.array(A);
+    },
+  });
+  // tuple
+  const B = z.object({
+    get subcategories() {
+      return z.tuple([B, B]);
+    },
+  });
+  // object
+  const C = z.object({
+    get subcategories() {
+      return z.object({
+        subcategories: C,
+      });
+    },
+  });
+  // union
+  const D = z.object({
+    get subcategories() {
+      return z.union([D, z.string()]);
+    },
+  });
+  // intersection
+  const E = z.object({
+    get subcategories() {
+      return z.intersection(E, E);
+    },
+  });
+  // record
+  const F = z.object({
+    get subcategories() {
+      return z.record(z.string(), F);
+    },
+  });
+  // map
+  const G = z.object({
+    get subcategories() {
+      return z.map(z.string(), G);
+    },
+  });
+  // set
+  const H = z.object({
+    get subcategories() {
+      return z.set(H);
+    },
+  });
+  // optional
+  const I = z.object({
+    get subcategories() {
+      return z.optional(I);
+    },
+  });
+  // nullable
+  const J = z.object({
+    get subcategories() {
+      return z.nullable(J);
+    },
+  });
+  // optional
+  const L = z.object({
+    get subcategories() {
+      return z.optional(L);
+    },
+  });
+  // nullable
+  const M = z.object({
+    get subcategories() {
+      return z.nullable(M);
+    },
+  });
+  // nonoptional
+  const N = z.object({
+    get subcategories() {
+      return z.nonoptional(N);
+    },
+  });
+});
diff --git a/vitest.root.mts b/vitest.root.mts
index d9cf889a..f9e349f2 100644
--- a/vitest.root.mts
+++ b/vitest.root.mts
@@ -1,4 +1,4 @@
-import { type UserConfig, defineConfig } from "vitest/config";
+import { type ViteUserConfig, defineConfig } from "vitest/config";
 
 export default defineConfig({
   resolve: {
@@ -14,7 +14,6 @@ export default defineConfig({
       checker: "tsc",
       tsconfig: "./tsconfig.json",
     },
-
     silent: true,
   },
-}) as UserConfig;
+}) as ViteUserConfig;