What problem does it solve?
Yup provides a fluent, chainable schema validation API for JavaScript and TypeScript, enabling robust form validation and type inference with minimal boilerplate.
It helps ensure data integrity across client and server boundaries by defining explicit validation rules and schemas that can be reused across components.
Core Features & Use Cases
- Fluent schema building with chainable validators for strings, numbers, booleans, dates, arrays, and objects.
- Type inference via TypeScript to derive FormData types from schemas, plus integration with React Hook Form and Formik.
- Schema composition, conditional validation, custom tests, and error handling for complex form validation scenarios.
- Real-world use: validate user registration data, enforce password rules, and sanitize user input across a React app.
Quick Start
Define a Yup schema and validate a data object to ensure it matches the schema.