Chapter 02
Inference and narrowing
How the compiler infers types and narrows them through control flow: type guards, discriminated unions,satisfies, and assertions.6 questions
- 010How does TypeScript infer types, and when should you annotate explicitly?Coming soonmedium
- 020How does narrowing work, and what built-in checks narrow a type?Coming soonCoremedium
- 030How do you write a user-defined type guard or assertion function?Coming soonmedium
- 040What is a discriminated union, and how do you check it exhaustively?Coming soonCoremedium
- 050What does
satisfiesdo, and how is it different from a type annotation?Coming soonmedium - 060What do
as,!, and!:actually do, and when are they safe?Coming sooneasy