TypeScript Production · Phần 3 — Narrowing, Exhaustiveness & State Machines
Dùng control-flow analysis, type predicate, assertion function và discriminated union để biến trạng thái bất hợp lệ thành không thể biểu diễn.
Filter/Tag
2 entries
Dùng control-flow analysis, type predicate, assertion function và discriminated union để biến trạng thái bất hợp lệ thành không thể biểu diễn.
Make impossible states impossible: the State pattern, modeling UI/lifecycle with a finite state machine, type-safe transitions via discriminated unions, and why this kills "loading && error" bugs.