TypeScript concepts

TypeScript · Narrowing

TypeScript Narrowing puzzles

4 TypeScript puzzles on narrowing. Read the snippet, guess the output, then reveal the answer and why TypeScript behaves that way.