Skip to content

partialSafeParse data inference not working #15

Description

@pfe-nazaries

Hi,

this code (similar to just plain safeParse) should infer the type of data if the validation is successful

import { partialSafeParse } from "zod_utilz";
import { z } from "zod";

const schema = z.object({
    id: z.number()
})

const maybeValid = partialSafeParse(schema, { id: 1 });

if (maybeValid.success) {
    console.log(maybeValid.data.id);
}

Instead the type inferred is unknown. The same happens to the ZodErrors type

image

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions