Get non-trivial tests (and trivial, too!) suggested right inside your IDE, so you can code smart, create more value, and stay confident when you push. Learn more →
Typebox Alternatives
Similar projects and alternatives to typebox
-
-
ajv
The fastest JSON schema Validator. Supports JSON Schema draft-04/06/07/2019-09/2020-12 and JSON Type Definition (RFC8927)
-
Appwrite
Appwrite - The Open Source Firebase alternative introduces iOS support . Appwrite is an open source backend server that helps you build native iOS applications much faster with realtime APIs for authentication, databases, files storage, cloud functions and much more!
-
typescript-runtime-type-benchmarks
📊 Benchmark Comparison of Packages with Runtime Validation and TypeScript Support
-
-
ts-json-schema-generator
Generate JSON schema from your Typescript sources
-
-
-
InfluxDB
Access the most powerful time series database as a service. Ingest, store, & analyze all types of time series data in a fully-managed, purpose-built database. Keep data forever with low-cost storage and superior data compression.
-
openapi-typescript-validator
Generate typescript with ajv validation based on openapi schemas
-
TypeScript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
-
-
-
fluent-json-validator
An easy-to-use, expressive, and composable JSON object validator, with a fluent builder pattern interface!
-
Superstruct
A simple and composable way to validate data in JavaScript (and TypeScript).
-
-
-
-
typescript-json-schema
Generate json-schema from your Typescript sources
-
-
ONLYOFFICE
ONLYOFFICE Docs — document collaboration in your environment. Powerful document editing and collaboration in your app or environment. Ultimate security, API and 30+ ready connectors, SaaS or on-premises
typebox reviews and mentions
-
[AskTS] What do you think will be the future of runtime type checking?
Well, I do provide extensibility for those bullet points you've listed to varying degrees (both schema and type representation), as well as offering a reference implementation for expressing a entirely different schema specification under the type system (specifically RFC8927 / JSON Type Definition). Reference implementation here. As for JSDoc, It's supported in code hints.
- TypeBox: Runtime Type System Built on Industry Standards
-
Building a modern gRPC-powered microservice using Node.js, Typescript, and Connect
In setting out to build this service, we wanted to use gRPC for its APIs. We’ve been reaching for REST when building APIs so far, primarily out of necessity, i.e., our public APIs needed auto-generated client SDKs and docs for developers working with them. We built those APIs with Fastify and Typebox but felt burned by a code-first approach to generating an OpenAPI spec. I’ll spare you the details and save that experience/learning for another article. Suffice it to say we love gRPC’s schema-first approach. This blog post summarizes our feelings well
-
IS there a way to generate Swagger model schemas from interfaces
You could try using @sinclair/typebox, it's API is similar to that of zod, but it spits out a JSON schema that you can then use to validate data at runtime and to populate your Swagger docs.
- TypeBox: Template Literals + Conditional Types at Runtime
-
ArkType: TypeScript's 1:1 validator, optimized from editor to runtime
Hey everyone! I started working on ArkType about 15 months ago, which at the time was an experiment to determine whether a TypeScript syntax parser written using TS's own generic types could be performant.
To my surprise, after a few months of iteration, it turned out it was possible to parse and provide fluid completions for scopes consisting of hundreds of cyclic types (see https://arktype.io/img/typePerf.mp4).
At this point, I started working on an "isomorphic" parser that would allow definitions that looked like native TypeScript syntax to be parsed and enforced at compile-time via TS and at runtime in JavaScript using parallel static and dynamic implementations (see https://github.com/arktypeio/arktype#how). This includes syntactic and semantic validation that your editor can update in real-time as you write a definition (if you want you can try messing around with a definition and corresponding input data in-browser at https://arktype.io/try).
Though as a full type system the library has lots of potential applications, the most obvious is for type-safe data validation as an alternative to approaches like Zod that rely on chained functions. Honestly I just think the fact that TypeScript can parse itself is cool in its own right, but given the prevalence of questions about how ArkType is different/better than existing libraries, I've taken the liberty of summarizing a few of what I believe are the most compelling points preemptively:
- Having definitions that are inferred 1:1 means you'll be hovering to see types less
- Most definitions are just objects and strings and can be easily serialized and eventually could even be used to validate data across multiple languages. Validators that rely on chaining will never be able to do this.
- On average, definitions are about 50% shorter than traditional chained syntax.
- Zod recently announced they were deprecating discriminated unions (see https://github.com/colinhacks/zod/issues/2106) because it was hard to maintain given their architecture. Not only are they supported in `arktype`, they're supported implicitly- you don't even have to tell us what keys to look at.
- The discriminated unions point is really just a special case of a much more general advantage: `arktype` is not just a validator- it's a type system. If we can deeply intersect arbitrary types, optimize them, and determine assignability, we can use all of that to make discrimination much easier (being able to "discriminate" is equivalent to having some common path that has an intersection of `never`)
- Zod claims it's impossible to infer recursive types due to a limitation of TS (see https://zod.dev/?id=recursive-types) and cannot handle cyclic data. ArkType can directly infer cyclic and recursive types and validate cyclic data.
The point of this is not to say Zod is not a good library. It significantly improved inference capabilities and DX relative to the previous generation of validators like Yup. It also still has some features we haven't yet implemented (primarily stuff like `pick` and `merge` as I'm working on adding support for generics).
Plus, we're still on `1.0.9-alpha`, so if I needed a validator for my critical production software, I'd probably go with `zod`.
That said, I do think `arktype` has some fundamental advantages that mean in the long term, it's a better approach to invest in. My current focus in preparing for a stable release is adding docs, optimizing runtime perf, and publishing benchmarks (using similar techniques to https://github.com/sinclairzx81/typebox, so should land somewhere between 50-100x faster than non-optimized validators like Zod).
Do you think that makes sense as a next priority? Do you think any of this makes sense at all, or have I just been coding in TS's type system long enough that my sanity has begun to erode? Agree or not with any of it, I'd love to hear your thoughts :-)
- David
-
The Last Breaking Change | JSON Schema Blog
For these reasons I continue to recommend typebox over Zod. I honestly have yet to be given one compelling reason to use Zod over typebox. You'd have to argue against all of those JSON Schema upsides, which immediately undermines the argument. This whole "debate" comes off as "if all you have is a hammer, everything looks like a nail." People just don't know about JSON Schema, its many upsides, its ecosystem, and its tooling.
-
Typescript Runtime Validators and DX, a type-checking performance analysis of zod/superstruct/yup/typebox
TypeBox 0.25.21
-
Is using zod as the primary source of truth for Typescript types sensible/sustainable?
Surely you're aware of this library? It offers a validator faster than Ajv, A type system more flexible than Zod, is used by large ecosystem projects (gets 10 mill weekly downloads), does type inference better (i.e. recursive types), and is based on the JSON schema specification. It also ranks with the fastest validation solutions for JavaScript.
-
Yup vs Zod - What do you prefer and why?
This lib proposes a more global solution : https://github.com/sinclairzx81/typebox
-
A note from our sponsor - CodiumAI
codium.ai | 29 May 2023
Stats
sinclairzx81/typebox is an open source project licensed under GNU General Public License v3.0 or later which is an OSI approved license.
The primary programming language of typebox is TypeScript.