Skip to content

zod deepPartial does not act as specified in the readme #563

Description

@sneko

Hi,

The readme (https://github.com/traversable/schema/tree/main/packages/zod#zxdeeppartial) says by default deepPartial adjusts the type, but it's not. I do have:

type MySchema = {
    a: number;
    b: {
        c: string;
    };
}

I have to use applyToOutputType into deepPartial so the type is:

type MySchema = {
    a?: number | undefined;
    b?: {
        c?: string | undefined;
    } | undefined;
}

So I guess at least the documentation should be fixed. Note that the official zod deepPartial in v3 was adjusting the type by default, so I would have thought applyToOutputType would be the default, and not semantic (that does no adjustment).

Thank you,

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions