LogoLogo

Schema Benchmarks

    • home
      Home

    • download_2
      Download

    • timer
      Initialization
    • check_circle
      Validation
    • output_circle
      Parsing
    • swap_horiz
      Codec
    • schema
      Standard Schema
    • format_quote
      String

    • error
      Stack
    • assignment_turned_in
      TypeScript

  • JSON Schema

    • data_object
      Schema to JSON
    • code
      JSON to Schema
    • verified
      Compliance

    • deployed_code
      Libraries

    • article
      Blog
Expand sidebarExpand sidebar
TypeScriptTypeScript
github
GitHubGitHub
DiscordDiscord
PreferencesPreferences
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures

Most of these libraries exist to give you a schema and a TypeScript type from the same declaration. This page compares the types themselves: whether they describe your data, what they cost the compiler, and how they read.

Every library declares the same product schema, and its type is read with whatever the library provides:

Copy to clipboardCopy to clipboard
const schema = z.object({ id: z.number(), title: z.string(), tags: z.array(z.string()), }); type Output = z.output<typeof schema>; type Input = z.input<typeof schema>;
Copy to clipboardCopy to clipboard
const schema = z.object({ id: z.number(), title: z.string(), tags: z.array(z.string()) }); type Output = z.output<typeof schema>; type Input = z.input<typeof schema>;

Input and Output pass only when the inferred type and the data type describe each other exactly. A type that allows more (unknown, or any, which checks nothing) leaves the work to runtime; one that allows less rejects values the schema accepts.

From type is the other direction: building a schema for a type you already have. It is checked only when the compiler rejects every way the two can disagree - a field of the wrong type, a field left out, a field required where the type makes it optional, and a field the type never declared. Unchecked means some of those compile, and the schema they build disagrees with the type it was written for.

Instantiations is the work the compiler does to declare the schema and read its output type. It is what grows into slow editor feedback and slow builds as a codebase adds schemas.

Type on hover is the type an editor shows for the schema, and its length in characters. The same text appears in every error message that mentions it.

Open a row to read the types in full.

Measured with TypeScript 6.0.3.

LibrarysortVersiondownload/wkarrow_upwardInputOutputFrom typeInstantiationssortType on hoversort
@paseri/paseri1.9.7167
AnnotationAnnotation
Accepts a schema with:
  • a field required where the type makes it optional
  • a field the type doesn't declare
--data_object
Open detailsOpen details
@railway-ts/pipelines0.1.29n/a
ExactExact
The inferred type and the data type describe each other.
ExactExact
The inferred type and the data type describe each other.
AnnotationAnnotation
Accepts a schema with:
  • a field required where the type makes it optional
2_133
457
data_object
Open detailsOpen details
@remix-run/data-schema0.3.0n/a
WiderWider
The inferred type allows values the data type doesn't, such as unknown.
ExactExact
The inferred type and the data type describe each other.
AnnotationAnnotation
Accepts a schema with:
  • a field required where the type makes it optional
  • a field the type doesn't declare
2_462
454
data_object
Open detailsOpen details
@sapphire/shapeshift5.0.0n/a
ExactExact
The inferred type and the data type describe each other.
ExactExact
The inferred type and the data type describe each other.
AnnotationAnnotation
Accepts a schema with:
  • a field required where the type makes it optional
  • a field the type doesn't declare
12_197
744
data_object
Open detailsOpen details
arktype2.2.3n/a
ExactExact
The inferred type and the data type describe each other.
ExactExact
The inferred type and the data type describe each other.
AnnotationAnnotation
Accepts a schema with:
  • a field required where the type makes it optional
  • a field the type doesn't declare
28_869
447
data_object
Open detailsOpen details
decoders2.10.1n/a
ExactExact
The inferred type and the data type describe each other.
ExactExact
The inferred type and the data type describe each other.
AnnotationAnnotation
Accepts a schema with:
  • a field required where the type makes it optional
  • a field the type doesn't declare
1_839
446
data_object
Open detailsOpen details
effect3.22.2n/a
ExactExact
The inferred type and the data type describe each other.
ExactExact
The inferred type and the data type describe each other.
AnnotationAnnotation
Rejects every way a schema can disagree with the type.
10_997
954
data_object
Open detailsOpen details
effect@rc4.0.0-rc.112n/a
ExactExact
The inferred type and the data type describe each other.
ExactExact
The inferred type and the data type describe each other.
AnnotationAnnotation
Accepts a schema with:
  • a field required where the type makes it optional
  • a field the type doesn't declare
1_632
885
data_object
Open detailsOpen details
io-ts2.2.22n/a
WiderWider
The inferred type allows values the data type doesn't, such as unknown.
ExactExact
The inferred type and the data type describe each other.
AnnotationAnnotation
Rejects every way a schema can disagree with the type.
1_697
966
data_object
Open detailsOpen details
runtypes7.0.5n/a
AnyAny
The inferred type contains any, so that part of it is not type checked.
AnyAny
The inferred type contains any, so that part of it is not type checked.
AnnotationAnnotation
Accepts a schema with:
  • a field required where the type makes it optional
  • a field the type doesn't declare
4_995
868
data_object
Open detailsOpen details
superstruct2.0.2n/a
ExactExact
The inferred type and the data type describe each other.
ExactExact
The inferred type and the data type describe each other.
AnnotationAnnotation
Rejects every way a schema can disagree with the type.
1_254
2.06K
data_object
Open detailsOpen details
sury11.0.0n/a
ExactExact
The inferred type and the data type describe each other.
ExactExact
The inferred type and the data type describe each other.
BuilderBuilder
Rejects every way a schema can disagree with the type.
10_619
884
data_object
Open detailsOpen details
typebox1.3.33n/a
ExactExact
The inferred type and the data type describe each other.
ExactExact
The inferred type and the data type describe each other.
AnnotationAnnotation
Accepts a schema with:
  • a field required where the type makes it optional
  • a field the type doesn't declare
4_070
597
data_object
Open detailsOpen details
typia14.0.6n/a
Builder, generated from the typeBuilder, generated from the type
Rejects every way a schema can disagree with the type.
--data_object
Open detailsOpen details
valibot1.5.0n/a
ExactExact
The inferred type and the data type describe each other.
ExactExact
The inferred type and the data type describe each other.
AnnotationAnnotation
Accepts a schema with:
  • a field required where the type makes it optional
  • a field the type doesn't declare
8_539
2.73K
data_object
Open detailsOpen details
yup1.7.1n/a
ExactExact
The inferred type and the data type describe each other.
ExactExact
The inferred type and the data type describe each other.
AnnotationAnnotation
Accepts a schema with:
  • a field required where the type makes it optional
  • a field the type doesn't declare
2_765
732
data_object
Open detailsOpen details
zod4.6.5n/a
ExactExact
The inferred type and the data type describe each other.
ExactExact
The inferred type and the data type describe each other.
BuilderBuilder
Rejects every way a schema can disagree with the type.
1_185
660
data_object
Open detailsOpen details
zod/mini4.6.5n/a
ExactExact
The inferred type and the data type describe each other.
ExactExact
The inferred type and the data type describe each other.
BuilderBuilder
Rejects every way a schema can disagree with the type.
1_640
958
data_object
Open detailsOpen details
zod/v34.6.5n/a
ExactExact
The inferred type and the data type describe each other.
ExactExact
The inferred type and the data type describe each other.
AnnotationAnnotation
Accepts a schema with:
  • a field required where the type makes it optional
  • a field the type doesn't declare
29_496
2.31K
data_object
Open detailsOpen details