import { z, ZodEnum, ZodNumber, ZodObject, ZodType } from "zod/v4"; import { IZod2xResolvedMetadata } from "./zod2x_metadata"; export type { ZodArray, ZodType, ZodIntersection, ZodObject, ZodEnum, ZodDiscriminatedUnion, ZodUnion, ZodLiteral, } from "zod/v4"; export type ZodAnyUnionType = z.ZodUnion | z.ZodDiscriminatedUnion; type ZodNumberConstraints = { min?: number; max?: number; isInt: boolean; }; export declare enum ZodFirstPartyTypeKind { ZodAny = "any", ZodString = "string", ZodNumber = "number", ZodBigInt = "bigint", ZodLiteral = "literal", ZodBoolean = "boolean", ZodDate = "date", ZodEnum = "enum", ZodUnion = "union", ZodIntersection = "intersection", ZodObject = "object", ZodLazy = "lazy", ZodRecord = "record", ZodMap = "map", ZodSet = "set", ZodArray = "array", ZodTuple = "tuple", ZodOptional = "optional", ZodNullable = "nullable", ZodDefault = "default", ZodPromise = "promise", ZodUnknown = "unknown", ZodPrefault = "prefault", ZodCatch = "catch", ZodReadonly = "readonly", ZodNonOptional = "nonoptional", ZodPipe = "pipe", ZodTransform = "transform", ZodNull = "null", ZodUndefined = "undefined", ZodVoid = "void", ZodNever = "never", ZodNaN = "nan", ZodSymbol = "symbol", ZodCustom = "custom", ZodFunction = "function", ZodFile = "file", ZodTemplateLiteral = "template_literal", ZodSuccess = "success" } /** * Zod's type is checked insted of instanceof to resolve Bun incomatibilities. */ export declare class ZodHelpers { static isZodType(i: ZodType): boolean; static isZodUnknown(i: ZodType): i is z.ZodUnknown; static isZodNonOptional(i: ZodType): i is z.ZodNonOptional; static isZodPipe(i: ZodType): i is z.ZodPipe; static isZodTransform(i: ZodType): i is z.ZodTransform; /** * Wrappers that do not change the output type of their inner schema: `.default()`, * `.prefault()`, `.catch()` and `.readonly()`. */ static isZodTransparentWrapper(i: ZodType): i is z.ZodDefault | z.ZodPrefault | z.ZodCatch | z.ZodReadonly; /** * Returns the schema that represents the data model of a pipe. The output side is used * (e.g. `z.string().pipe(z.coerce.number())` or codecs), unless it is a transformation whose * output type cannot be known, in which case the input side is used. */ static getPipeModelSchema(i: z.ZodPipe): ZodType; /** * Returns a short structural signature of a schema, used to tell apart two different schemas * that share the same type name. */ static getShallowSignature(i: ZodType, resolve?: (schema: ZodType) => IZod2xResolvedMetadata | undefined, depth?: number): string; static isZodAny(i: ZodType): i is z.ZodAny; static isZodString(i: ZodType): i is z.ZodString; static isZodNumber(i: ZodType): i is z.ZodNumber; static isZodBigInt(i: ZodType): i is z.ZodBigInt; static isZodLiteral(i: ZodType): i is z.ZodLiteral; static isZodBoolean(i: ZodType): i is z.ZodBoolean; static isZodDate(i: ZodType): i is z.ZodDate; static isZodEnum(i: ZodType): i is ZodEnum; static isZodUnion(i: ZodType): i is z.ZodUnion; static isZodDiscriminatedUnion(i: ZodType): i is z.ZodDiscriminatedUnion; static isZodIntersection(i: ZodType): i is z.ZodIntersection; static isZodObject(i: ZodType): i is z.ZodObject; static isZodLazy(i: ZodType): i is z.ZodLazy; static isZodRecord(i: ZodType): i is z.ZodRecord; static isZodMap(i: ZodType): i is z.ZodMap; static isZodArray(i: ZodType): i is z.ZodArray; static isZodSet(i: ZodType): i is z.ZodSet; static isZodTuple(i: ZodType): i is z.ZodTuple; static isZodOptional(i: ZodType): i is z.ZodOptional; static isZodNullable(i: ZodType): i is z.ZodNullable; static isZodDefault(i: ZodType): i is z.ZodDefault; static isZodPromise(i: ZodType): i is z.ZodPromise; static isZodAnyUnionType(i: ZodType): i is z.ZodUnion | z.ZodDiscriminatedUnion>[], string>; static isZodAnyNumberType(i: ZodType): i is z.ZodNumber | z.ZodBigInt; static isZodAnyMapType(i: ZodType): i is z.ZodRecord | z.ZodMap; /** * Complex types that shall always be transpiled, which output would be a type, or alias if * redefined using layered modeling. * @param zodType * @returns */ static isTranspilerableZodType(zodType: string | ZodType): boolean; /** * Primitive types that can only be transpiled if defined using layered modeling, which output * would be a type alias. * @param zodType * @param onlyArray Array types are always transpiled as alias in layered modeling. * @returns */ static isTranspilerableAliasedZodType(zodType: string | ZodType, onlyArray?: boolean): boolean; /** * Creates a new instance of the schema with the same definition. Zod metadata (description, * ...) is inherited from the original schema. */ static cloneZod(i: ZodType): z.ZodType>; /** * Checks if a schema was documented on a copy of another one (`.describe()`), even with its * same text. Zod keeps the metadata of each schema in its registry, and the copies inherit * the one of their parent, so inherited descriptions are not in the entry of the schema. */ static hasOwnDescription(i: ZodType): boolean; /** * Zod2X generics are represented as Promise<"TypeName">. * Ex: z.promise(z.literal("K")) will be transpiled to Template */ static isZod2XGeneric(i: ZodType): boolean; /** * Returns the template name of a generic template created with `createGenericType`, if the * schema is one. Templates defined as `z.promise(z.literal("T"))` (the marker used by * previous versions) are supported too. */ static getGenericTemplateName(i: ZodType): string | undefined; static createZodObject(properties: Map): ZodObject; static getZodNumberConstraints(i: ZodNumber | z.ZodBigInt): ZodNumberConstraints; } /** * Creates a generic template to be used as a property of a generic ZodObject. * @param name Template name. Ex: "T", "K", "TData", ... * @param defaultType Optional type used by `useGenericType` when no type is provided for the * template. It can be any supported type: basic types, arrays, named types, ... * @returns The generic template. */ export declare function createGenericType(name: string, defaultType?: ZodType): any; /** * Use generic types defined in a generic ZodObject by replacing them with the actual child types. * The new type references the generic type and the child types used for each template, so its * type name, layer and templates translation are resolved from them when transpiled. * @param genObj ZodObject with generic types. * @param childrens Record of child types to replace generics. Templates created with a default * type can be omitted. * @returns The extended ZodObject with replaced generic types. */ export declare function useGenericType(genObj: ZodObject, childrens: Record, skipLazy: true): ZodObject; export declare function useGenericType(genObj: ZodObject, childrens: Record, skipLazy?: false): z.ZodLazy>;