discriminated unions
TypeScript in Production notes about discriminated unions
TypeScript Pick vs Extract: Select Properties or Union Variants
Use Pick to select fields from a type, Extract to retain matching union members, and Extract before Pick when the fields belong to only one variant.

