Ondřej Chrastina
Menu

Extreme TypeScript: Mastering Recursion and Inference via Type-Level Arithmetic

Deep dive into advanced TypeScript type system features by building a compile-time calculator. Master conditional types, the infer keyword, template literal types, tuple manipulation, and recursive type definitions through practical, step-by-step examples. Learn to write type-level programs that perform arithmetic at compile time.

Back to talks
Released: Tue Jan 13 2026
  • Slides

A few years ago, an engineer on my team who was heavily invested in Haskell and declarative programming brought something unusual to our 1-on-1. It was a functional calculator built entirely within TypeScript's type system—zero runtime code allowed. 

While practically "useless" for business logic, I realized it was the ultimate educational tool for demonstrating the raw power of the language. In this talk, we will deconstruct that experiment. We won't just look at code; we will learn how to read and write the complex constructs that power libraries like Zod, Prisma, or tRPC. You will learn how to manipulate Tuples for counting, master Recursive Conditional Types, and use infer to unwrap data. By the end, you won't just know how to add numbers in types—you will possess the mental framework to debug the most terrifying generic errors your library throws at you.

  • Twitter
  • GitHub
  • LinkedIn
  • Facebook
  • Instagram
  • YouTube
  • Medium
  • dev.to
  • Discord
    • © Ondřej Chrastina 2020
    • Original Design: HTML5 UP
    • 💾 Source code - use GitHub issues for feedback 🙌
  • I am | Home
  • I write | Journal
  • I Code | Projects
  • I speak | Talks
  • PWA series
  • GitHub
Close