Repository: colinhacks/zod
Pull request #4599 (2025-06-02 08:40:17)

Restructure: mitigate excessively deep errors


Patch:
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 9f296591..e8e5c385 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"]
@@ -70,8 +77,8 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
   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<any, any, 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() {
@@ -1201,8 +1183,9 @@ export function looseObject<T extends core.$ZodLooseShape>(
 }
 
 // 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 +1194,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 +1236,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 +1247,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 +1272,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 +1296,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 +1305,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 +1319,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 +1327,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 +1340,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 +1359,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<any, any, core.$ZodSetInternals<T>>,
+    core.$ZodSet<T> {
   min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
   /** */
   nonempty(params?: string | core.$ZodCheckMinSizeParams): this;
@@ -1409,22 +1392,22 @@ 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>;
-
+// @ts-ignore Cast variance
+export interface ZodEnum<out T extends util.EnumLike = util.EnumLike>
+  extends _ZodType<core.$ZodEnumInternals<T>>,
+    core.$ZodEnum<T> {
   enum: T;
   options: Array<T[keyof T]>;
 
@@ -1509,8 +1492,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;
@@ -1546,9 +1530,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 +1549,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 +1598,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 +1613,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 +1636,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 +1664,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 +1692,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 +1721,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 +1745,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 +1768,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 +1794,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 +1809,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 +1833,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 +1864,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 +1876,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 +1896,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);
@@ -2041,7 +2020,7 @@ 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>(
+export function preprocess<A, U extends core.SomeType>(
   fn: (arg: unknown, ctx: RefinementCtx) => A,
   schema: U
 ): ZodPipe<ZodTransform<A, unknown>, U> {
diff --git a/packages/zod/src/v4/core/api.ts b/packages/zod/src/v4/core/api.ts
index 58851aee..2e9da61b 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">;
diff --git a/packages/zod/src/v4/core/checks.ts b/packages/zod/src/v4/core/checks.ts
index 8184ac32..c0708c0f 100644
--- a/packages/zod/src/v4/core/checks.ts
+++ b/packages/zod/src/v4/core/checks.ts
@@ -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,
diff --git a/packages/zod/src/v4/core/core.ts b/packages/zod/src/v4/core/core.ts
index 099c2656..25778635 100644
--- a/packages/zod/src/v4/core/core.ts
+++ b/packages/zod/src/v4/core/core.ts
@@ -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._$ZodType, 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/schemas.ts b/packages/zod/src/v4/core/schemas.ts
index 5425d12f..2534aa06 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,11 +144,33 @@ 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 $ZodStandardSchema<T extends $ZodType> = StandardSchemaV1.Props<core.input<T>, core.output<T>>;
+export interface _$ZodType<T extends _$ZodTypeInternals = _$ZodTypeInternals> {
+  _zod: T;
+  // "~standard": $ZodStandardSchema<this>;
+  // "~args": this["_zod"][any];
+  // /** @deprecated @internal Internal field. */
+  // "~d": this["_zod"]["def"];
+  // /** @deprecated @internal Internal field. */
+  // "~o": O;
+  // /** @deprecated @internal Internal field. */
+  // "~i": I;
+}
+export type SomeType = _$ZodType; //<any, any, $ZodTypeInternals<unknown, unknown>>;
 
-export interface $ZodType<O = unknown, I = unknown> {
-  _zod: $ZodTypeInternals<O, I>;
+export interface $ZodType<O = unknown, I = unknown, Internals extends $ZodTypeInternals<O, I> = $ZodTypeInternals<O, I>>
+  extends _$ZodType<Internals> {
+  // _zod: $ZodTypeInternals<O, I>;
+  // _zod: Internals;
   "~standard": $ZodStandardSchema<this>;
 }
 
@@ -1433,18 +1449,18 @@ 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 {
+export interface $ZodArray<T extends SomeType = $ZodType> extends $ZodType {
   _zod: $ZodArrayInternals<T>;
 }
 
@@ -1505,7 +1521,6 @@ 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 {
@@ -1518,10 +1533,7 @@ 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"]>
-  > {
+> extends _$ZodTypeInternals {
   def: $ZodObjectDef<Shape>;
   config: Config;
   isst: errors.$ZodIssueInvalidType | errors.$ZodIssueUnrecognizedKeys;
@@ -1529,8 +1541,8 @@ export interface $ZodObjectInternals<
   // 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"]>;
+  output: $InferObjectOutput<Shape, Config["out"]>;
+  input: $InferObjectInput<Shape, Config["in"]>;
 }
 export type $ZodLooseShape = Record<string, any>;
 
@@ -1636,19 +1648,22 @@ export type $strip = {
   out: {};
   in: {};
 };
-export type $catchall<T extends $ZodType> = {
+export type $catchall<T extends _$ZodType> = {
   out: { [k: string]: core.output<T> };
   in: { [k: string]: core.input<T> };
 };
+
 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>> {
+  // _zod: $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(() => {
@@ -1860,21 +1875,21 @@ 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 {
+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>;
 }
 
@@ -1950,19 +1965,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>;
 }
 
@@ -2048,19 +2063,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>;
 }
 
@@ -2172,40 +2188,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>?]
@@ -2213,15 +2229,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>;
 }
 
@@ -2319,15 +2337,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>>
@@ -2340,7 +2359,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>>
@@ -2351,13 +2370,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>;
 }
@@ -2477,19 +2496,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>;
 }
 
@@ -2577,18 +2596,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>;
 }
 
@@ -2882,12 +2901,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 +2916,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 +2951,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 +2966,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 +3001,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 +3016,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 +3061,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 +3076,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 +3104,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 +3199,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 +3245,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 +3263,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 +3353,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 +3368,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>;
 }
 
@@ -3383,21 +3402,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>;
 }
 
@@ -3462,12 +3481,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(
@@ -3533,18 +3578,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>;
 }
 
@@ -3567,14 +3612,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;
@@ -3584,14 +3629,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/util.ts b/packages/zod/src/v4/core/util.ts
index 314fa822..77d9e05c 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> {
diff --git a/packages/zod/src/v4/mini/schemas.ts b/packages/zod/src/v4/mini/schemas.ts
index f2739923..ba0572cd 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<Internals["output"], Internals["input"], Internals> {}
+
 export const ZodMiniType: core.$constructor<ZodMiniType> = /*@__PURE__*/ core.$constructor(
   "ZodMiniType",
   (inst, def) => {
@@ -65,8 +72,10 @@ export const ZodMiniType: core.$constructor<ZodMiniType> = /*@__PURE__*/ core.$c
 );
 
 // ZodMiniString
-export interface ZodMiniString<Input = unknown> extends ZodMiniType {
-  _zod: core.$ZodStringInternals<Input>;
+export interface ZodMiniString<Input = unknown>
+  extends _ZodMiniType<core.$ZodStringInternals<Input>>,
+    core.$ZodString<Input> {
+  // _zod: core.$ZodStringInternals<Input>;
 }
 export const ZodMiniString: core.$constructor<ZodMiniString> = /*@__PURE__*/ core.$constructor(
   "ZodMiniString",
@@ -648,8 +657,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 +674,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 +690,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 +717,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 +728,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,7 +843,7 @@ export function required(schema: ZodMiniObject, mask?: object) {
 }
 
 // ZodMiniUnion
-export interface ZodMiniUnion<T extends readonly SomeType[] = readonly SomeType[]> extends ZodMiniType {
+export interface ZodMiniUnion<T extends readonly SomeType[] = readonly core.$ZodType[]> extends ZodMiniType {
   _zod: core.$ZodUnionInternals<T>;
 }
 export const ZodMiniUnion: core.$constructor<ZodMiniUnion> = /*@__PURE__*/ core.$constructor(
@@ -857,13 +860,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,7 +894,8 @@ export function discriminatedUnion<
 }
 
 // ZodMiniIntersection
-export interface ZodMiniIntersection<A extends SomeType = SomeType, B extends SomeType = SomeType> extends ZodMiniType {
+export interface ZodMiniIntersection<A extends SomeType = core.$ZodType, B extends SomeType = core.$ZodType>
+  extends ZodMiniType {
   _zod: core.$ZodIntersectionInternals<A, B>;
 }
 export const ZodMiniIntersection: core.$constructor<ZodMiniIntersection> = /*@__PURE__*/ core.$constructor(
@@ -905,15 +909,15 @@ 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,
+  T extends util.TupleItems = readonly core.$ZodType[],
+  Rest extends SomeType | null = core.$ZodType | null,
 > extends ZodMiniType {
   _zod: core.$ZodTupleInternals<T, Rest>;
 }
@@ -925,11 +929,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,15 +949,17 @@ 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 {
+export interface ZodMiniRecord<
+  Key extends core.$ZodRecordKey = core.$ZodRecordKey,
+  Value extends SomeType = core.$ZodType,
+> extends ZodMiniType {
   _zod: core.$ZodRecordInternals<Key, Value>;
 }
 export const ZodMiniRecord: core.$constructor<ZodMiniRecord> = /*@__PURE__*/ core.$constructor(
@@ -972,9 +978,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,13 +990,14 @@ 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 {
+export interface ZodMiniMap<Key extends SomeType = core.$ZodType, Value extends SomeType = core.$ZodType>
+  extends ZodMiniType {
   _zod: core.$ZodMapInternals<Key, Value>;
 }
 export const ZodMiniMap: core.$constructor<ZodMiniMap> = /*@__PURE__*/ core.$constructor("ZodMiniMap", (inst, def) => {
@@ -1005,14 +1012,14 @@ 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 {
+export interface ZodMiniSet<T extends SomeType = core.$ZodType> extends ZodMiniType {
   _zod: core.$ZodSetInternals<T>;
 }
 export const ZodMiniSet: core.$constructor<ZodMiniSet> = /*@__PURE__*/ core.$constructor("ZodMiniSet", (inst, def) => {
@@ -1023,9 +1030,9 @@ 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
@@ -1137,7 +1144,7 @@ export function transform<I = unknown, O = I>(
 }
 
 // ZodMiniOptional
-export interface ZodMiniOptional<T extends SomeType = SomeType> extends ZodMiniType {
+export interface ZodMiniOptional<T extends SomeType = core.$ZodType> extends ZodMiniType {
   _zod: core.$ZodOptionalInternals<T>;
 }
 export const ZodMiniOptional: core.$constructor<ZodMiniOptional> = /*@__PURE__*/ core.$constructor(
@@ -1151,12 +1158,12 @@ 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 {
+export interface ZodMiniNullable<T extends SomeType = core.$ZodType> extends ZodMiniType {
   _zod: core.$ZodNullableInternals<T>;
 }
 export const ZodMiniNullable: core.$constructor<ZodMiniNullable> = /*@__PURE__*/ core.$constructor(
@@ -1170,8 +1177,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,7 +1187,7 @@ export function nullish<T extends SomeType>(innerType: T): ZodMiniOptional<ZodMi
 }
 
 // ZodMiniDefault
-export interface ZodMiniDefault<T extends SomeType = SomeType> extends ZodMiniType {
+export interface ZodMiniDefault<T extends SomeType = core.$ZodType> extends ZodMiniType {
   _zod: core.$ZodDefaultInternals<T>;
 }
 export const ZodMiniDefault: core.$constructor<ZodMiniDefault> = /*@__PURE__*/ core.$constructor(
@@ -1197,15 +1204,15 @@ 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 {
+export interface ZodMiniPrefault<T extends SomeType = core.$ZodType> extends ZodMiniType {
   _zod: core.$ZodPrefaultInternals<T>;
 }
 export const ZodMiniPrefault: core.$constructor<ZodMiniPrefault> = /*@__PURE__*/ core.$constructor(
@@ -1221,15 +1228,15 @@ 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 {
+export interface ZodMiniNonOptional<T extends SomeType = core.$ZodType> extends ZodMiniType {
   _zod: core.$ZodNonOptionalInternals<T>;
 }
 export const ZodMiniNonOptional: core.$constructor<ZodMiniNonOptional> = /*@__PURE__*/ core.$constructor(
@@ -1246,13 +1253,13 @@ 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 {
+export interface ZodMiniSuccess<T extends SomeType = core.$ZodType> extends ZodMiniType {
   _zod: core.$ZodSuccessInternals<T>;
 }
 export const ZodMiniSuccess: core.$constructor<ZodMiniSuccess> = /*@__PURE__*/ core.$constructor(
@@ -1266,12 +1273,12 @@ 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 {
+export interface ZodMiniCatch<T extends SomeType = core.$ZodType> extends ZodMiniType {
   _zod: core.$ZodCatchInternals<T>;
 }
 export const ZodMiniCatch: core.$constructor<ZodMiniCatch> = /*@__PURE__*/ core.$constructor(
@@ -1288,11 +1295,11 @@ 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 };
 
@@ -1310,7 +1317,8 @@ export function nan(params?: string | core.$ZodNaNParams): ZodMiniNaN {
 }
 
 // ZodMiniPipe
-export interface ZodMiniPipe<A extends SomeType = SomeType, B extends SomeType = SomeType> extends ZodMiniType {
+export interface ZodMiniPipe<A extends SomeType = core.$ZodType, B extends SomeType = core.$ZodType>
+  extends ZodMiniType {
   _zod: core.$ZodPipeInternals<A, B>;
 }
 export const ZodMiniPipe: core.$constructor<ZodMiniPipe> = /*@__PURE__*/ core.$constructor(
@@ -1322,15 +1330,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,7 +1350,7 @@ export function pipe(in_: core.$ZodType, out: core.$ZodType) {
 // }
 
 // ZodMiniReadonly
-export interface ZodMiniReadonly<T extends SomeType = SomeType> extends ZodMiniType {
+export interface ZodMiniReadonly<T extends SomeType = core.$ZodType> extends ZodMiniType {
   _zod: core.$ZodReadonlyInternals<T>;
 }
 export const ZodMiniReadonly: core.$constructor<ZodMiniReadonly> = /*@__PURE__*/ core.$constructor(
@@ -1357,8 +1364,8 @@ 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
@@ -1385,7 +1392,7 @@ export function templateLiteral<const Parts extends core.$ZodTemplateLiteralPart
 }
 
 // ZodMiniLazy
-export interface ZodMiniLazy<T extends SomeType = SomeType> extends ZodMiniType {
+export interface ZodMiniLazy<T extends SomeType = core.$ZodType> extends ZodMiniType {
   _zod: core.$ZodLazyInternals<T>;
 }
 export const ZodMiniLazy: core.$constructor<ZodMiniLazy> = /*@__PURE__*/ core.$constructor(
@@ -1402,13 +1409,13 @@ 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 {
+export interface ZodMiniPromise<T extends SomeType = core.$ZodType> extends ZodMiniType {
   _zod: core.$ZodPromiseInternals<T>;
 }
 export const ZodMiniPromise: core.$constructor<ZodMiniPromise> = /*@__PURE__*/ core.$constructor(
@@ -1422,8 +1429,8 @@ 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
diff --git a/play.ts b/play.ts
index 58f4d9da..41eb006b 100644
--- a/play.ts
+++ b/play.ts
@@ -1,38 +1,3 @@
 import { z } from "zod/v4";
 
-// const foo = z.preprocess((val, ctx) => {
-//   if (!val) {
-//     ctx.addIssue({ code: z.ZodIssueCode.custom, message: "bad" });
-//     return z.NEVER;
-//   }
-//   return val;
-// }, z.number());
-
-// type foo = z.infer<typeof foo>;
-// // util.assertEqual<foo, number>(true);
-// const arg = foo.safeParse(undefined);
-// console.dir(arg.error, { depth: null });
-
-// const schema2 = z
-//   .custom<number>((arg) => typeof arg === "number")
-//   .transform((arg) => {
-//     console.log(arg);
-//     return arg + 1;
-//   });
-
-// console.dir(schema2.safeParse("hello").error!, { depth: null });
-// const A = z
-//   .string()
-//   .refine((val) => false)
-//   .min(4)
-//   .transform((val) => val.length)
-//   .pipe(z.number())
-//   .refine((val) => false);
-// console.dir(A.safeParse("asdfasdf").error!, { depth: null });
-
-const A = z
-  .custom<string>((val) => typeof val === "string")
-  .refine((val) => {
-    return val.length > 3;
-  });
-A.parse(123);
+z;


Test patch:
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..43a3fbfe 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,33 @@ 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;
+});
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/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/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 880504e7..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",
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..54c89956
--- /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 */
+    dostuff(): string;
+  }
+}
+
+test("prototype extension", () => {
+  z.ZodType.prototype.dostuff = function () {
+    return "stuff";
+  };
+
+  // should pass
+  const result = z.string().dostuff();
+  expect(result).toBe("stuff");
+  // expectTypeOf<typeof result>().toEqualTypeOf<string>();
+
+  // clean up
+  z.ZodType.prototype.fun = 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..b04ea8a9 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,139 @@ 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("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;
+  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/to-json-schema.test.ts b/packages/zod/src/v4/classic/tests/to-json-schema.test.ts
index 34671072..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
@@ -1638,6 +1638,8 @@ test("top-level readonly", () => {
     })
     .readonly()
     .meta({ id: "A" });
+  // z.globalRegistry.add(A, { id: "A" });
+  // .meta({ id: "A" });
 
   const B = z
     .object({
@@ -1648,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/prototypes.test.ts b/packages/zod/src/v4/mini/tests/prototypes.test.ts
index 86d27925..e09c1dc8 100644
--- a/packages/zod/src/v4/mini/tests/prototypes.test.ts
+++ b/packages/zod/src/v4/mini/tests/prototypes.test.ts
@@ -1,12 +1,12 @@
 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 */
+    fun(): string;
+  }
+}
 
 test("prototype extension", () => {
   z.ZodMiniType.prototype.fun = function () {
@@ -14,7 +14,7 @@ test("prototype extension", () => {
   };
 
   // should pass
-  const result = (z.string() as any).fun();
+  const result = z.string().fun();
   expect(result).toBe("fun");
   // expectTypeOf<typeof result>().toEqualTypeOf<string>();
 
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..a4a6d30c 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,13 +61,19 @@ 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);
     },
   });
 
@@ -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;
+  }
+  interface _Blazy {
+    val: number;
+    a?: _Alazy;
+  }
+  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);
+    },
+  });
+});