TypeScript VS zod

Compare TypeScript vs zod and see what are their differences.


TypeScript is a superset of JavaScript that compiles to clean JavaScript output. (by microsoft)


TypeScript-first schema validation with static type inference (by colinhacks)
Our great sponsors
  • Appwrite - The Open Source Firebase alternative introduces iOS support
  • talent.io - Download talent.io’s Tech Salary Report
  • Scout APM - Truly a developer’s best friend
  • SonarQube - Static code analysis for 29 languages.
  • InfluxDB - Build time-series-based applications quickly and at scale.
TypeScript zod
883 97
84,538 11,901
0.9% -
9.9 9.5
6 days ago 6 days ago
TypeScript TypeScript
Apache License 2.0 MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.


Posts with mentions or reviews of TypeScript. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-10-01.
  • Ten Years of TypeScript
    8 projects | news.ycombinator.com | 1 Oct 2022
    > But they admitted namespaces, enums

    And decorators. But this was very early on and they won’t ever do it again unless there’s a drastic change on principle and probably a reorg of global proportion. They categorically reject anything with runtime implications now, and to the point of decorators are actively working to align them with the standard as it’s approaching stability.

    > and interfaces into the language (the latter becoming more and more confusing as type aliases got more expressive) […] Is "as", "is", or "satisfies" expression-level?

    No. All of this is completely separate from the runtime and on a standards course to be treated effectively as comments.

    > But the enums!

    I’m one of the minority who actually likes TS enums, but I strongly suspect they’ll be deprecated, alongside namespaces, as soon as there’s general consensus around types as comments. The TypeScript team considers these mistakes and would very much like to be able to drop them. I’d welcome that too even though I quite like enums.

    The fact is TS has considerable backwards compatibility expectations, and aligning their mistakes with their goals is great on principle but something which would require thousands upon thousands of hours of labor for people to accommodate.

    You can snipe all you want, but if you think it’s that easy to resolve maybe I can direct you to https://github.com/microsoft/TypeScript/pulls

    I’m not affiliated with the team in any way but I’m almost totally certain they’d welcome a contribution that gets them closer to their stated principles where historical designs are entrenched, without breaking workflows for thousands of people and interrupting releases for millions.

    8 projects | news.ycombinator.com | 1 Oct 2022
    TypeScript has lots of great features and a few bizarrely bad ones. It’s great in spite of itself.

    The main misfeature is their dogmatic refusal to rewrite import paths (citing the “Preserve runtime behavior of all JavaScript code” principle mentioned in this article). Here’s a good summary of the problems this causes: https://github.com/microsoft/TypeScript/issues/42151

    I’m curious, how many people are using TSC only for type-checking, and a different system (eg esbuild or ts-node) to actually compile/bundle/execute their code?

    I think TypeScript would be even stronger if they focused fully on type-checking, and relaxed some of those dogmatic restrictions (and the many, many confusing config options) imposed by the JS code generator.

  • [AskJS] Do you consider ESM to have more benefits than drawbacks in node?
    6 projects | reddit.com/r/javascript | 27 Sep 2022
    Because it's implicit, CJS creates a bunch of resolution issues with Typescript, to the point where if you want to code for the browser, you can't easily can't and have to either recompile with something like webpack to rewrite the module resolution, or add .js to all your TS imports, which already looks weird (you'd think you're importing the .ts files). sip.js has that issue.
  • Announcing TypeScript 4.9 Beta
    2 projects | reddit.com/r/typescript | 24 Sep 2022
  • Peço ajuda numa oportunidade do trabalho
    3 projects | reddit.com/r/brdev | 23 Sep 2022
  • Ezno
    11 projects | news.ycombinator.com | 23 Sep 2022
    You can't actually narrow `unknown` down to a structure yet, as you have no way to test whether `property in unknown` or not.

    Well, until this is released! https://github.com/microsoft/TypeScript/pull/50666

  • How To Choose The Right Framework For Your Next Node.js App.
    8 projects | dev.to | 23 Sep 2022
    TypeScript ready: we work hard to maintain a TypeScript type declaration file so we can support the growing TypeScript community.
  • Learn how to unleash the full potential of the type system of TypeScript
    11 projects | news.ycombinator.com | 20 Sep 2022
  • Write typesafe APIs with zodios
    2 projects | dev.to | 17 Sep 2022
    Writing client APIs, that gives you autocompletion is time consuming. You allways endup writing the same kind of boilerplate code or have to use openapi code generators that are a pain to maintain. Zodios was created to make creating frontend (and optionally backend) API client a breeze. It's is an open source REST API toolbox with end-to-end typesafety. It allows you to create a REST API with a clean, intuitive and declarative syntax. It's best used with TypeScript, but it's also usable with pure JavaScript.
  • Decorator creating with API
    2 projects | reddit.com/r/typescript | 17 Sep 2022


Posts with mentions or reviews of zod. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-09-20.
  • Learn how to unleash the full potential of the type system of TypeScript
    11 projects | news.ycombinator.com | 20 Sep 2022
    fp-ts [0] and the accompanying io-ts [1] are very well designed and neatly implemented. I'd consider them the reference for all things FP in Typescript.

    In practice though I find that they don't mesh well with the language and ecosystem at large. Using them in a React/Vue/Whatever app will catch you at every step, as neither the language nor the frameworks have these principles at their core. It takes a lot of effort to escape from their gravitational pull. Using Zod [2] for your parsing needs and strict TS settings for the rest feel more natural.

    It could work in a framework-agnostic backend or logic-heavy codebase where the majority of the devs are in to FP and really want / have to use Typescript.

    0 - https://gcanti.github.io/fp-ts/

    1 - https://gcanti.github.io/io-ts/

    2 - https://zod.dev

  • What should we do if we have a variable whose value we dont know what it will be ?
    3 projects | reddit.com/r/typescript | 10 Sep 2022
    The thing you're looking for is a library like zod or io-ts, which allow you to build arbitrarily complex type guards, without having to separately declare a matching type or interface. TypeScript infers the type from the type checker.
  • Modern React Data-Fetching with TypeScript, React-Query, and Zod
    4 projects | dev.to | 2 Sep 2022
    The second piece is Zod. While there are a lot of validation libraries out there, Zod is the current frontrunner and you should be using it unless you absolutely, positively have a reason to use something else. Zod's validation and ability to easily infer TypeScript types is going to be key to typing our untyped API.
  • Wrighter (β) - A Powerful Markdown Blogger & A Writing Companion ⚡
    10 projects | dev.to | 2 Sep 2022
    I wanted to use something new for wrighter and that's why I used fastify. I was more of an express guy before. The ability to add validator schemas was new to me in node backends, combining this with zod and typescript became confusing. There were several situations where I was missing fields for responses because I forgot to add them to the schema. I blame myself for that lol
  • tRPC: The best way to build APIs in 2022?
    2 projects | dev.to | 26 Aug 2022
    First of all, it’s best to define the schemas. In my case, I’ll be querying PokéAPI, which is using REST, so I’ll manually define the expected response using Zod.
  • Advanced TypeScript Patterns: API Contracts
    3 projects | reddit.com/r/javascript | 22 Aug 2022
    Isn't https://zod.dev/ used for this use case?
  • Which tools do you use to validate forms?
    6 projects | reddit.com/r/vuejs | 17 Aug 2022
    I've found zod to be a pretty powerful validation library (porting over from react/typescript). Normally, the mindset for using something like zod is that you sorta have to imagine forms as essentially objects with keys marking the state of the form.
  • a first look at create-t3-app
    14 projects | dev.to | 13 Aug 2022
    We want to be able to query an individual blog post based on its id. Since we will be sending data to the database, we need to validate the input. zod is a TypeScript schema validator with static type inference. We'll also import TRPCError for error handling.
  • What are your struggles when working with forms in react ?
    7 projects | reddit.com/r/reactjs | 12 Aug 2022
    Lately I've been favoring zod over yup for its slightly improved TypeScript compatibility. I've also been itching to give https://github.com/unform/unform a shot.
  • Build a full stack app with create-t3-app
    6 projects | dev.to | 11 Aug 2022
    Here we have a tRPC mutation that uses zod to validate the input and has a resolve function that runs a simple prisma query to create a new row in the Guestbook table.

What are some alternatives?

When comparing TypeScript and zod you can also consider the following projects:

joi - The most powerful data validation library for JS [Moved to: https://github.com/sideway/joi]

Yup - Dead simple Object schema validation

class-validator - Decorator-based property validation for classes.

io-ts - Runtime type system for IO decoding/encoding

ajv - The fastest JSON schema Validator. Supports JSON Schema draft-04/06/07/2019-09/2020-12 and JSON Type Definition (RFC8927)

typebox - JSON Schema Type Builder with Static Type Resolution for TypeScript

react-hook-form - 📋 React Hooks for form state management and validation (Web + React Native)

Superstruct - A simple and composable way to validate data in JavaScript (and TypeScript).

runtypes - Runtime validation for static types

Flutter - Flutter makes it easy and fast to build beautiful apps for mobile and beyond

class-transformer - Decorator-based transformation, serialization, and deserialization between objects and classes.

zod-to-json-schema - Converts Zod schemas to Json schemas