THE ANSWER IS IN THE TYPE.
type Answer<Q> =
Q extends () => infer R
? R
: "It depends";IT
DEPENDS
TypeScript Principles, Debated
Ask a senior developer any question about TypeScript, and you’ll get the same answer: ‘It depends.’ This book is about what it depends on.
A team of developers. Thirty arguments. Working code that puts their opinions to the test. From any versus unknown to reviewing AI-generated code, follow the debate as a neat rule meets a stubborn caller, a failing test or a requirement nobody mentioned. Sometimes the team reaches a verdict. Sometimes they still disagree. Either way, you see what changed their minds—and what didn’t.
Free to read online. Every example is checked against TypeScript 7.0.2.
How the arguments unfold
The Principle
A rule you can test, stated up front.
The Debate
The team argues it over working code.
The Turn
An example changes the conversation.
The Verdict / Debate Continues
A ruling—or a disagreement that remains.
Additional Takes
Other voices, costs and conditions.
Contents
Prologue
Act I · The Type System
Act II · Advanced TypeScript
Act III · Patterns & Design
- Chapter 14: Two Seats or None
- Chapter 15: What the Number Means
- Chapter 16: What the Schema Does With the Rest
- Chapter 17: The Price You Were Given
- Chapter 18: The Ticket Hadn't Changed
- Chapter 19: Who Goes Next?
- Chapter 20: Before the First Line
- Chapter 21: The Message Kept Going
- Chapter 22: The Policy's Alibi
- Chapter 23: Still Waiting for No
Act IV · The Real World
Bonus · AI & TypeScript
The cast
Fifteen people, one codebase, and very few agreements.