Number one this week, Zod is a library to validate user input against composable schemas.
It shines with its TypeScript powerful features. The main benefit of using Zod over other solutions like Yup is:
Eliminating the need to define static types and runtime validators separately.
Often, the shape of the objects to validate is written at 2 different places:
- static types provided by TypeScript, used to validate at compile time
- schema used to validate data at run time
Using Zot schemas, you don’t have to write types, you can access the type of a schema using zod.TypeOf
like this:
const projectSchema = zod.object({
name: zod.string(),
stars: zod.number()
});
type Project = zod.TypeOf<typeof ProjectSchema>
One more thing: besides the invisible enemy that spreads fear all over the world, the biggest news of the week for the JavaScript community is the acquisition of NPM by GitHub.
With this merger comes exciting new planned features such as support for “Workspaces” and other improvements!
Growing Fast This Week
1 | Zod TypeScript-first schema validation with static type inference | GitHub | +65.2% | |
2 | Redwood Bringing full-stack to the JAMstack. | Homepage | +18.8% | |
3 | uPlot A small, fast chart for time series, lines, areas, ohlc & bars | GitHub | +17.0% | |
4 | G2Plot An interactive and responsive charting library | Homepage | +8.9% | |
5 | discord.js A powerful JavaScript library for interacting with the Discord API | Homepage | +3.2% | |
6 | beautiful-react-hooks A collection of beautiful and (hopefully) useful React hooks | Homepage | +3.2% | |
7 | Alpine.js A rugged, minimal framework for composing JavaScript behavior | GitHub | +3.1% | |
8 | React Hook Form React hooks for forms validation without the hassle. | Homepage | +3.0% | |
9 | asm-dom A minimal WebAssembly virtual DOM to build C++ SPA | Homepage | +3.0% | |
10 | React Query Hooks for fetching, caching and updating asynchronous data in React | GitHub | +2.7% |
Trending This Week
1 | Vue.js A progressive, incrementally-adoptable framework for building UI on the web | Homepage | +543 ★ | |
2 | JS Algorithms & Data Structures Algorithms and data structures implemented in JavaScript | GitHub | +432 ★ | |
3 | Redwood Bringing full-stack to the JAMstack. | Homepage | +428 ★ | |
4 | Vue Element Admin A magical vue admin | GitHub | +423 ★ | |
5 | Tech Interview Handbook Materials to help you rock your next coding interview | Homepage | +375 ★ | |
6 | VS Code Visual Studio Code | Homepage | +347 ★ | |
7 | React A declarative, efficient, and flexible JavaScript library for building UI | Homepage | +342 ★ | |
8 | Deno A secure JavaScript and TypeScript runtime | Homepage | +286 ★ | |
9 | Clean Code Clean Code concepts adapted for JavaScript | GitHub | +273 ★ | |
10 | Axios Promise based HTTP client for the browser and node.js | GitHub | +269 ★ |
Any question or feedback? Reach us on GitHub.
Best of JavaScript is a project created by Michael Rambeau, made in Osaka, Japan.