OSS TanbouSign in with GitHub

transform and validate runtime values from schemas while inferring TypeScript types

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
23,660
Primary language
TypeScript
License
MIT
Repository last updated
Oct 2, 2026
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]

Use asynchronous tests and Standard Schema support

Custom tests can run asynchronously for validations that need external work, and the changelog records Standard Schema interface support added in 1.7.0.

Sources: [1][3]

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.

Sources: [2][3]

Official sources

  1. [1]Yup README at reviewed commit(2026-10-05)
  2. [2]Yup package metadata at reviewed commit(2026-10-05)
  3. [3]Yup CHANGELOG at reviewed commit(2026-10-05)
  4. [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. 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. 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. 3

    Run the schema with Node.js

    Execute the runtime validation and transformation and confirm that a validated value is returned.

    node demo.mjs
Check the official README

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
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?