๐Ÿ”ท

TypeScript in Action: From Basics to Turing-Complete Type Programming

From JS migration to the limits of the TypeScript type system: type inference, generics, conditional types, variance, Branded Types, Result pattern, type-safe state machines, type-level algorithms, HKT simulation, Compiler API. 28 chapters โ€” the only Chinese guide covering ultra-advanced type gymnastics.

28
Chapters
Free
Forever
Start Reading →
Table of Contents
Ch01
From JS to TS: Catching 3 Runtime Error Classes at Compile Time
Ch02
Type Inference and Annotation Boundaries
Ch03
Union, Intersection & Literal Types: Discriminated Unions in Practice
Ch04
Interface vs Type Alias: A Decision Tree
Ch05
Function Types: Overloads, Generics, Call Signatures
Ch06
Generics in Depth: Constraints, Defaults, Type-Safe fetch
Ch07
Built-in Utility Types Dissected: Source Code Walkthrough
Ch08
Conditional Types and infer: Extracting Subtypes
Ch09
Mapped Types: Transforming Object Shapes, DeepPartial
Ch10
Template Literal Types: String Operations at the Type Level
Ch11
Variance: Covariance, Contravariance, Invariance Explained
Ch12
Type Design Philosophy: Legal vs Illegal States, 12 Principles
Ch13
Branded Types and Phantom Types: Blocking Invalid Operations
Ch14
Type-Safe Error Handling: Result<T,E> Pattern
Ch15
async/Promise Types: Inference and Error Typing
Ch16
tsconfig.json Complete Reference: strict Options and Monorepo
Ch17
Declaration Files: Writing .d.ts and Publishing @types
Ch18
Runtime Validation: zod with Automatic Type Inference
Ch19
Gradual Migration: A Roadmap for 100k-Line JS Projects
Ch20
Node.js Backend: Fastify + TypeBox Route-Level Type Inference
Ch21
React Component Types: Generics, Hooks, Event Handlers
Ch22
Full-Stack Type Safety: tRPC and Prisma/Drizzle ORM
Ch23
Testing TypeScript: vitest Mocks and tsd Type Tests
Ch24
Type Gymnastics: Implementing Awaited, FlatArray, UnionToIntersection
Ch25
Type-Safe State Machines: Only the Compiler Knows Valid Transitions
Ch26
Type-Level Algorithms: Filter, Zip, BinaryAdd โ€” The Turing-Complete Edge
Ch27
Simulating Higher-Kinded Types in TypeScript
Ch28
TypeScript Compiler API: Building Your Own Type Checker

๐Ÿ’ฌ Comments