Pushing the Compiler to the Limit
summary
Prisma Client becomes a fully type-safe TypeScript database client by combining conditional and mapped types with a required-keys utility that distinguishes optional from required fields so compile-time types match runtime behavior. The implementation handles real schemas (350 models, ~5,000 fields), shrinks declarations from ~560k to ~309k lines, and speeds generation from 26s to ~4.5s by switching to direct dts/js generation and runtime bootstrapping of implementation, plus a mapped-type error for disallowed optional selections.
AI-written summary · about
chapters (4)
related talks
30mZero-cost Type Safety for your Database with Prisma
29mType safety from the database to the frontend
31mUnderstanding GraphQL, databases and Prisma
49mTypescript. Runtime. And in Between.
24mEnd to End type safety: A tale of three domains
05mTypeScript for Every Part of Your Stack
26mFull Stack Type Safety with React, GraphQL, and TypeScript
21mThe long-tail of type safety
