@traversable/schema
    Preparing search index...

    Type Alias deepRequired<T, Atom>

    deepRequired: T extends Primitive
        ? T & {}
        : T extends Atom
            ? T
            : T extends readonly unknown[]
                ? { [I in keyof T]-?: deepRequired<T[I], Atom> }
                : T extends object
                    ? { [K in keyof T]-?: deepRequired<T[K], Atom> }
                    : T & {}

    Converts an arbitrary zod schema into its "deeply-required" form.

    That just means that the schema will be traversed, and any z.optional z.optional nodes will be unwrapped.

    zx.deepRequired's behavior is configurable at the typelevel via the defaults.typelevel options.typelevel property:

    • defaults.typelevel "semantic" (default): leave the schema untouched, but wrap it in a no-op interface (zx.deepRequired.Semantic) to make things explicit

    • defaults.typelevel "applyToTypesOnly": apply the transformation to the schema's output type and wrap it in z.ZodType z.ZodType

    • defaults.typelevel "preserveSchemaType": zx.deepRequired will return what it got, type untouched

    Note:

    Make sure you understand the semantics of deepRequired before you use this in production. There's a reason it was removed from zod proper. This library trusts users to do their due diligence to make sure they understand the tradeoffs.

    Type Parameters

    import * as vi from "vitest"
    import { zx } from "@traversable/zod"

    // Using `zx.deepRequired.writeable` here to make it easier to visualize `zx.deepRequired`'s behavior:
    vi.expect.soft(zx.deepRequired.writeable(
    z.object({
    a: z.optional(z.number()),
    b: z.optional(z.string()),
    c: z.object({
    d: z.optional(
    z.array(
    z.optional(
    z.object({
    e: z.number().max(1),
    f: z.optional(z.optional(z.boolean()))
    })
    )
    )
    )
    })
    })
    )).toMatchInlineSnapshot(
    `"z.object({
    a: z.number(),
    b: z.string(),
    c: z.object({
    d: z.array(
    z.object({
    e: z.number().max(1),
    f: z.boolean()
    })
    )
    })
    })"`
    )