On this page
Overview
Yup is a schema library for transforming and validating runtime values using object, string, number, array, and related schemas. InferType derives TypeScript types from schemas, helping forms, API responses, and configuration values share one definition between runtime checks and static typing.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Combine transforms and tests for parsing and validation
Yup schemas contain transforms that parse inputs into desired shapes and tests that assert constraints. A string containing a number can be cast to a number before positive or integer checks are applied.
Sources: [1]
Infer TypeScript types from object schemas
InferType<typeof schema> derives a static TypeScript type from a schema, reducing duplicated definitions between runtime validation rules and application types.
Sources: [1]
Best fit
Fits frontends that validate forms, API inputs, and configuration at runtime
It is useful for user input, network responses, query parameters, and other values that TypeScript alone cannot guarantee at runtime while still allowing application types to be inferred.
Sources: [1]
Before adoption
validate performs transforms by default, so account for changes to raw input
Yup can run transforms before validation, such as converting a string like "24" into a number. Use strict: true when parsing must be disabled and the raw value should be checked as-is.
Sources: [1]
The 1.7.1 changelog entry contains no listed feature or fix
The reviewed package metadata reports version 1.7.1 and the changelog records a 1.7.1 entry, but that entry lists no feature or bug-fix details. The product overview therefore relies on the README and documented changes through 1.7.0.
Official sources
- [1]Yup README at reviewed commit(2026-10-05)
- [2]Yup package metadata at reviewed commit(2026-10-05)
- [3]Yup CHANGELOG at reviewed commit(2026-10-05)
- [4]Yup MIT license(2026-10-05)
Supplemental curator note
Yup can transform inputs as well as validate them. Where APIs or forms must preserve raw values, review casting behavior and use strict: true when parsing should be disabled.
Try it in 3 steps
- 1
Install Yup 1.7.1 in an isolated project
Pin the reviewed package version in a temporary directory so the check does not affect an existing project.
demo=$(mktemp -d "${TMPDIR:-/tmp}/yup.XXXXXX") && cd "$demo" && npm init -y >/dev/null && npm install --save-exact yup@1.7.1 - 2
Create a schema that transforms and validates input
Follow the README schema model and let Yup cast the age string to a number while applying required, positive, and integer checks.
printf "%s\n" "import {object, string, number} from 'yup';" "const UserSchema = object({name: string().required(), age: number().required().positive().integer()});" "const user = UserSchema.validateSync({name: 'Ada', age: '37'});" "console.log(user);" > demo.mjs - 3
Run the schema with Node.js
Execute the runtime validation and transformation and confirm that a validated value is returned.
node demo.mjs
Growth
Growth trends · Last 30 days
23,660 Stars
Trend data is still being collected.
Development activity
Last 90 days · weekly
- Commits (last 30 days)
- 0
- Open PRs
- 91
Development activity is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
- Stars
- 23,660
- Forks
- 948
- Watchers
- 76
- Open issues
- 164
- Contributors
- 149
- Owner type
- User
- Primary language
- TypeScript
- License
- MIT
- Repository last updated
- Oct 2, 2026
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- Expo52,566 Stars
3 shared tag(s) · 1 shared category(s) · Same language
build React Native apps for Android, iOS, and web from one project model
TypeScript - PostCSS28,974 Stars
3 shared tag(s) · 1 shared category(s) · Same language
parse CSS into an AST and compose build-time style processing with JavaScript plugins
TypeScript - Type-fest17,433 Stars
3 shared tag(s) · 1 shared category(s) · Same language
reuse TypeScript type transformations that go beyond the built-in utility types
TypeScript - typescript-eslint16,408 Stars
3 shared tag(s) · 1 shared category(s) · Same language
bring ESLint recommended rules and TypeScript parsing together in a Flat Config setup
TypeScript - Faker15,509 Stars
3 shared tag(s) · 1 shared category(s) · Same language
generate realistic-looking people, locations, products, and other fake data for testing and development
TypeScript - Linaria12,350 Stars
3 shared tag(s) · 1 shared category(s) · Same language
keep CSS-in-JS authoring while extracting styles to static CSS at build time
TypeScript
Report incorrect information
Tell us if any listing information is incorrect or outdated.