Keep alive your typescript definitions using Zod
summary
Claim: TypeScript types vanish at build time and Zod keeps them alive at runtime. Concrete setup: a React demo fetches orders from a JSON API, a schema mirrors the Order shape and gets converted to a TS type, then the response is checked with parse and safeParse. Changing amount from number to string produces a Zod error that shows the path (first item total.amount), so the validation layer logs or forwards the error to Sentry and prevents bad data from corrupting UI.
AI-written summary · about
chapters (6)
- 0:00Introduction
- 0:43TypeScript limitations
- 3:00Introducing Zod
- 10:09Demo without Zod
- 14:09Demo with Zod
- 18:55Key benefits
related talks
15mTypescript. Runtime. And In Between.
45mBuild Fully Type Safe Projects with TypeScript and Zod
31mEscaping the Phantom Zone of Insecure Data: Build Safer Applications with zod
23mType-safe forms for React using Zod
49mTypescript. Runtime. And in Between.
21mBeyond Type Checking Building Bulletproof TypseScript Applications
30mWith Zod, Fight Any-gration at Your Borders
15mValidate HTTP request with HttpClient & Zod - Lightning talk
