Skip to content

zodv4 schema incorrect Properties type #1251

@EvgeniyKumachev

Description

@EvgeniyKumachev

For zodv4 codegen currently outputs Properties type with no input type passed to z.ZodType

type Properties<T> = Required<{
    [K in keyof T]: z.ZodType<T[K]>;
}>;

type Data = {
    field: string | null
    field2?: string[] | null
}

type Result = z.ZodObject<Properties<Data>>

type ResultInput = z.input<Result> // => { field: unknown; field2: unknown; }

It probably should be typed as

type Properties<T> = Required<{
    [K in keyof T]: z.ZodType<T[K], T[K]>;
}>;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions