genType
DISCONTINUED
zod
Our great sponsors
- Onboard AI - Learn any GitHub repo in 59 seconds
- InfluxDB - Collect and Analyze Billions of Data Points in Real Time
- SaaSHub - Software Alternatives and Reviews
genType | zod | |
---|---|---|
5 | 253 | |
759 | 27,110 | |
- | - | |
0.0 | 9.0 | |
18 days ago | 2 days ago | |
OCaml | TypeScript | |
MIT License | MIT License |
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.
genType
-
ts-belt - Fast, modern, and practical utility library for FP in TypeScript / Flow / JavaScript. (Faster than ramda, rambda, remeda and lodash/fp.)
I don't really use ts-belt to be certain, but by looking at the source, it seems that it's using genType, which can generate TS types from ReScript values, and that makes interop work really well.
-
ReScript 10.0
They discuss this in their docs.
https://rescript-lang.org/docs/manual/latest/introduction#di...
Seems like a type system for Javascript, built with a differing set of opinions than Typescript.
Looks like they also offer some form of TS interop:
- From TypeScript to ReScript
-
TS Belt - fast, modern, and practical utility library for FP in TypeScript
TS Belt has been built with ReScript (and its Belt stdlib). ReScript generates highly performant JavaScript code, and with genType it also automatically generates TypeScript types. Moreover, I've added a few codemods to the building process to provide even more code optimizations and cleaner TypeScript signatures.
-
How I Switched from TypeScript to ReScript
To interoperate with TypeScript with proper type information you’ll use third-party genType. Add it as a devDependency and annotate the module export you want to generate with @genType (in previous versions you’d surround annotations with square brackets).
zod
-
Where DRY Applies
Author here: This specific example is a perfect case of the thing the post calls out! API boundaries are one of the most important places where we need to maintain invariants about our code base, one of the most important places that it is important not to have to worry about “keeping things in sync” as you say.
In the TypeScript world, there are a number of libraries that can handle creating types from deserialization logic: Zod [1], Superstruct [2], Typebox [3], etc. – and Typebox specifically does what you are looking to do with MyPy. I do not know the Python ecosystem at all anymore (it has been a decade!) but I would be surprised if nothing like that exists. If it does, there is a good chance it is associated with the functional programming enthusiast corner of the Python community, so you might look there!
- Show HN: Build type-safe web APIs with JavaScript, instantly
-
I made a crate for bridging types between Rust and Zod / Typescript
This means if you want to actually have reliable type-checking in typescript, you need to use a runtime schema framework like zod to verify that data coming in from the outside world is what you think it is.
-
The Ultimate Tech Stack for Building a Full-Stack MVP and Iterating Quickly
Forms are a big part of full-stack projects. In our experience, Zod and React Hook Form work great together and provide all the functionality one might need to create forms. In this combo, Zod provides schema validation (types, min/max bounds, lengths, enums, etc.) while React Hook Form gives a flexible API to interact with the form. With these two libraries, one can nest components that interact with the same form, perform different complex validations, and update the data on the fly. They make working with forms seem too easy.
-
Working with forms in SvelteKit coming from React
For the examples, I'll be using zod for both React and Svelte, but won't be using libraries for the sake of showing the differences. You should be able to use any other validation libraries you want with no problem, but since I'm more familiar with zod, that's what I'm goin to be using. It's good to know that I'll only handle validations on the server-side, that's why it's useless for us to save some variables state in Svelte.
-
Using OpenAPI to Detect Breaking Changes in tRPC
The tRPC router contains basic validation using Zod.
-
3 great Typescript libraries to speed up your full stack development
Zod - schema validation for client and server
- Desenvolvendo APIs fortemente tipadas de ponta a ponta com tRPC
-
Creating a hackathon winning AI based app in a weekend using Supabase, OpenAI, & Next.js
This is my main component for the thread creation UI. You can see some imports and predefined prompt for OpenAI. Your prompt should be concise but to-the-point for best results. I have a few states I'm using to handle input changes. Once someone selects all inputs and then clicks on the Generate button. the whole input gets validated against a Zod schema and then is fed to the API route we created in the previous step. The generated response is being split into separate tweets and is then shown in the UI as a thread.
-
Best practices for HarperDB projects using TypeScript
For this we will need to create a schema that we can compare and validate our object against, this is the perfect use case for Zod! Zod is a TypeScript-first schema validation library that allows us to create schemas and validate our objects against them. Let's install it by running npm install --save zod.
What are some alternatives?
class-validator - Decorator-based property validation for classes.
joi - The most powerful data validation library for JS [Moved to: https://github.com/sideway/joi]
Yup - Dead simple Object schema validation
typebox - Json Schema Type Builder with Static Type Resolution for TypeScript
ajv - The fastest JSON schema Validator. Supports JSON Schema draft-04/06/07/2019-09/2020-12 and JSON Type Definition (RFC8927)
io-ts - Runtime type system for IO decoding/encoding
Superstruct - A simple and composable way to validate data in JavaScript (and TypeScript).
class-transformer - Decorator-based transformation, serialization, and deserialization between objects and classes.
runtypes - Runtime validation for static types
react-hook-form - 📋 React Hooks for form state management and validation (Web + React Native)
TypeScript - TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
zod-to-json-schema - Converts Zod schemas to Json schemas