Skip to content

Typo: parse instead of safeParse #4479

@Abhishek-1337

Description

@Abhishek-1337

https://zod.dev/basics

In this page at "Handling Errors" section where safeParse is being explained there is an example explaining safeParse but there is a little mistake there.

const result = Player.parse({ username: 42, xp: "100" });
if (!result.success) {
result.error; // ZodError instance
} else {
result.data; // { username: string; xp: number }
}

The code is like this and it should be Player.safeParse right?

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions