Real World Type-Level Programming
TypeScript
Cookbook
type Result<T> =
| { ok: true; value: T }
| { ok: false; error: string }
function unwrap<T>(r: Result<T>): T {
if (r.ok) return r.value
throw new Error(r.error)
}
What's inside
- Project Setup
- Basic Types
- The Type System
- Generics
- Conditional Types
- String Template Literal Types
- Variadic Tuple Types
- Helper Types
- The Standard Library
- TypeScript and React
- Classes
- Type Development Strategies
What people say
TypeScript Cookbook is an extremely valuable reference for anyone working with TypeScript. It condenses a ton of valuable information into a format you can dip into and out of easily.
A lovely read and a fount of information. I learned a ton of neat tricks and snazzy new patterns from each of the chapters. It would behoove any TypeScript developer to learn those nuances — in particular from this book.
This book does a splendid job focusing on the long-lasting aspects of TypeScript and ensures that your learning remains relevant despite the ever-changing landscape.
An essential resource for developers who want to learn how to use TypeScript effectively. Stefan packs clear and concise recipes for solving real-world problems into a comprehensive playbook that upskills you from novice to expert.
TypeScript Cookbook shows you how to solve all sorts of problems with advanced types. Even better, it teaches you how to use TypeScript's features to write new types for yourself.
I recognized so many issues that I'd come across in my own TypeScript and found Stefan's advice on them to be clear, precise, and insightful. I feel more confident with TypeScript with this reference by my side.
On screen
Also available in
Russian
Korean