âš¡âš Benchmark results have changed after switching to isolated node processes for each benchmarked package, see #864 âš âš¡
- ajv
- bueno
- class-validator + class-transformer
- computed-types
- decoders
- io-ts
- jointz
- json-decoder
- @mojotech/json-type-validaton
- myzod
- ok-computer
- purify-ts
- parse-dont-validate
- r-assign
- rescript-struct
- rulr
- runtypes
- @sapphire/shapeshift
- @sinclair/typebox
- simple-runtypes
- spectypes
- succulent
- superstruct
- suretype
- toi
- ts-interface-checker
- ts-json-validator
- ts-runtime-checks
- tson
- ts-utils
- typia
- @typeofweb/schema
- valibot
- valita
- Vality
- yup
- zod
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 modulesnpm run start run zod myzod valita
- run benchmarks only for a few selected modulesnpm run docs:serve
- result viewernpm run test
- run tests on all modules
- update node version matrix in
.github/workflows/pr.yml
and.github/workflows/release.yml
- update
NODE_VERSIONS
indocs/dist/app.tsx
and runnpm run docs:build
- optionally set
NODE_VERSION_FOR_PREVIEW
inbenchmarks/helpers/main.ts