Real World Type-Level Programming
TypeScript
Cookbook
result.ts
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
Also available in
Russian
Korean