β‘β Benchmark results have changed after switching to isolated node processes for each benchmarked package, see #864 β β‘
- aeria
 - ajv
 - ArkType
 - banditypes
 - bueno
 - caketype
 - class-validator + class-transformer
 - cleaners
 - computed-types
 - decoders
 - deepkit
 - dhi
 - @effect/schema
 - io-ts
 - jet-validators
 - joi
 - jointz
 - json-decoder
 - @mojotech/json-type-validaton
 - $mol_data
 - @mondrian-framework/model
 - myzod
 - ok-computer
 - pure-parse
 - purify-ts
 - parse-dont-validate
 - Paseri
 - r-assign
 - rescript-schema
 - rulr
 - runtypes
 - @sapphire/shapeshift
 - @sinclair/typebox
 - @sinclair/typemap
 - simple-runtypes
 - spectypes
 - stnl
 - succulent
 - superstruct
 - suretype
 - sury
 - tiny-schema-validator
 - to-typed
 - toi
 - ts-auto-guard
 - ts-interface-checker
 - ts-json-validator
 - ts-runtime-checks
 - tson
 - ts-utils
 - type-predicate-generator
 - typia
 - @typeofweb/schema
 - unknownutil
 - valibot
 - valita
 - Vality
 - yup
 - zod
 - zod (v4)
 
These packages are capable of validating the data for type correctness.
E.g. if string was expected, but a number was provided, the validator should fail.
It has a validator function or method that returns a valid type casted value or throws.
const data: any = {}
// `res` is now type casted to the right type
const res = isValid(data)Or it has a type guard function that in a truthy block type casts the value.
const data: any = {}
function isMyDataValid(data: any) {
  // isValidGuard is the type guard function provided by the package
  if (isValidGuard(data)) {
    // data here is "guarded" and therefore inferred to be of the right type
    return data
  }
  throw new Error('Invalid!')
}
// `res` is now type casted to the right type
const res = isMyDataValid(data)npm run start- run benchmarks for all modules using Node.jsnpm run start:bun- run benchmarks for all modules using bunnpm run start run zod myzod valita- run benchmarks only for a few selected modules
npm run test- run build process and tests for all modulesnpm run test:build- run build process for all modules
A basic preact+vite app lives in /docs.
It is deployed via github pages whenever something has been pushed to the main branch.
cd docs
npm run dev     # develop / view results
npm run build   # build
npm run preview # preview the buildWhen viewing results locally, you will need to restart the app whenever the results are updated.
npm run lint- lint all filesnpm run lint:fix- lint all files and fix errors
npm run download-packages-popularity- download popularity data from npmjs.com
- Use nvm to switch to a specific Node.js version
 nvm use x- switch to Node.js x.xnvm use 18- switch to Node.js 18.xnvm use 20- switch to Node.js 20.x
- Use 
curl -fsSl https://bun.sh/install | bash -s "bun-v1.0.x"to switch to a specific bun version curl -fsSl https://bun.sh/install | bash -s "bun-v1.1.43"- switch to bun 1.1.43
- Use 
deno upgrade x.x.xto switch to a specific Deno version deno upgrade stable- switch to Deno x.x.x
- update Node.js version matrix in 
.github/workflows/pr.ymland.github/workflows/release.yml - update 
NODE_VERSIONSindocs/src/App.tsx - optionally set 
NODE_VERSION_FOR_PREVIEWinbenchmarks/helpers/main.ts 
- update bun version matrix in 
.github/workflows/pr.ymland.github/workflows/release.yml - update 
BUN_VERSIONSindocs/src/App.tsx 
- update Deno version matrix in 
.github/workflows/pr.ymland.github/workflows/release.yml - update 
DENO_VERSIONSindocs/src/App.tsx 
- 
Safe Parsing
- Checks the input object against a schema and returns it.
 - Raises an error if the input object does not conform to the schema (e.g., a type mismatch or missing attribute).
 - Removes any extra keys in the input object that are not defined in the schema.
 
 - 
Strict Parsing
- Checks the input object against a schema and returns it.
 - Raises an error if the input object does not conform to the schema (e.g., a type mismatch or missing attribute).
 - Raises an error if the input object contains extra keys.
 
 - 
Loose Assertion
- Checks the input object against a schema.
 - Raises an exception if the input object does not match the schema.
 - Allows extra keys without raising errors.
 - Returns true if data is valid.
 
 - 
Strict Assertion
- Checks the input object against a schema.
 - Raises an exception if the input object does not match the schema.
 - Raises an error if the input object or any nested input objects contain extra keys.
 - Returns true if data is valid.