TypeScript 2.8 expresses relationships between input and output types
engineeringtypescripttypesgenericsConditional types let libraries describe results that depend on their inputs. Distribution over unions and inference within type patterns explain both their usefulness and their limits.