• Returns a passthrough version of a Zod object schema, allowing unknown keys. Supports both Zod v3 and v4 object schemas. If recursive is true, applies passthrough recursively to all nested object schemas and arrays of object schemas.

    Type Parameters

    Parameters

    • schema: T

      The Zod object schema instance (either v3 or v4).

    • Optionalrecursive: boolean = false

      Whether to apply passthrough recursively to nested objects/arrays.

    Returns InteropZodObject

    The passthrough Zod object schema.

    If the schema is not a Zod v3 or v4 object.