TypeScriptType Narrowing & Type Guards

54 items

1

Validating API Data at Runtime with Zod

Flashcard
2

Discriminated Union Narrowing in React

Code Quiz
3

Discriminated Unions in React Props

Quiz
4

Narrowing Invalidation

Flashcard
5

Type Guards vs Type Assertions

Slides / Video
6

Narrowing the unknown Type

Slides / Video
7

Control Flow Analysis and Narrowing Scope

Slides / Video
8

Assertion Functions with 'asserts'

Slides / Video
9

Exhaustiveness Checking with never

Slides / Video
10

Discriminated Unions and Tagged Narrowing

Slides / Video
11

User-Defined Type Guards with 'is'

Slides / Video
12

Null and Undefined Narrowing

Slides / Video
13

Equality Narrowing with === and switch

Slides / Video
14

Truthiness Narrowing

Slides / Video
15

The in Operator for Property Checking

Slides / Video
16

instanceof Type Guards

Slides / Video
17

typeof Type Guards

Slides / Video
18

What Type Narrowing Is

Slides / Video
19

Equality Narrowing

Flashcard
20

Exhaustiveness Checking with never

Flashcard
21

Narrowing Out null and undefined

Flashcard
22

Assertion Functions (asserts)

Flashcard
23

Control Flow Analysis Narrowing

Flashcard
24

Non-Null Assertion Operator (!)

Flashcard
25

in Operator Narrowing

Flashcard
26

User-Defined Type Guards (is)

Flashcard
27

Truthiness Narrowing

Flashcard
28

Discriminated Unions

Flashcard
29

typeof Type Guards

Flashcard
30

Narrowing the unknown Type

Flashcard
31

instanceof Type Guards

Flashcard
32

Array.isArray Narrowing

Flashcard
33

Type Assertions vs Type Guards

Flashcard
34

Filter Callback Missing Type Predicate

Code Quiz
35

Helper Function Loses Narrowing

Code Quiz
36

Optional Chaining Yields Possibly Undefined

Code Quiz
37

Wrong Null Check Misses Undefined

Code Quiz
38

Using unknown Without Narrowing

Code Quiz
39

typeof Cannot Detect Arrays

Code Quiz
40

Equality Narrowing Dead Branch

Code Quiz
41

Non-null Assertion Hides Real Bug

Code Quiz
42

Truthiness Narrowing Drops Zero

Code Quiz
43

Reassignment Resets Narrowing

Code Quiz
44

Truthiness Narrowing

Quiz
45

Type Predicate Return Effect

Quiz
46

Array.isArray as Type Guard

Quiz
47

never in Exhaustiveness Checking

Quiz
48

Narrowing via Assignment

Quiz
49

Non-null Assertion Operator

Quiz
50

Equality Narrowing

Quiz
51

Narrowing Literal and Union Types

Quiz
52

Narrowing Loss in Closures

Quiz
53

typeof Guards for Primitives

Quiz
54

Control Flow Analysis Basics

Quiz
FlashcardIntermediate

Validating API Data at Runtime with Zod

Zod validates untyped API responses at runtime and narrows them to a known static type.

Question

Why use Zod to validate API responses instead of a type assertion?

Click to reveal answer