Skip to content

Glossary: TypeScript Beyond the Basics

parse and safeParse

Also written: .parse, .safeParse, parse, safeParse

`.parse(data)` returns checked data or throws a `ZodError`. `.safeParse(data)` never throws and returns `{ success: true, data }` or `{ success: false, error }`.

Where the book teaches it

Related terms

SchemaDiscriminated unionIssue (Zod)