TypeScriptType Narrowing & Type Guards

53 items

1

Discriminated Union Narrowing in React

Code Quiz
2

Discriminated Unions in React Props

Quiz
3

Narrowing Invalidation

Flashcard
4

Type Guards vs Type Assertions

Slides / Video
5

Narrowing the unknown Type

Slides / Video
6

Control Flow Analysis and Narrowing Scope

Slides / Video
7

Assertion Functions with 'asserts'

Slides / Video
8

Exhaustiveness Checking with never

Slides / Video
9

Discriminated Unions and Tagged Narrowing

Slides / Video
10

User-Defined Type Guards with 'is'

Slides / Video
11

Null and Undefined Narrowing

Slides / Video
12

Equality Narrowing with === and switch

Slides / Video
13

Truthiness Narrowing

Slides / Video
14

The in Operator for Property Checking

Slides / Video
15

instanceof Type Guards

Slides / Video
16

typeof Type Guards

Slides / Video
17

What Type Narrowing Is

Slides / Video
18

Assertion Functions (asserts)

Flashcard
19

User-Defined Type Guards (is)

Flashcard
20

Narrowing the unknown Type

Flashcard
21

Equality Narrowing

Flashcard
22

Control Flow Analysis Narrowing

Flashcard
23

Truthiness Narrowing

Flashcard
24

Discriminated Unions

Flashcard
25

Array.isArray Narrowing

Flashcard
26

typeof Type Guards

Flashcard
27

Non-Null Assertion Operator (!)

Flashcard
28

in Operator Narrowing

Flashcard
29

Type Assertions vs Type Guards

Flashcard
30

Narrowing Out null and undefined

Flashcard
31

Exhaustiveness Checking with never

Flashcard
32

instanceof Type Guards

Flashcard
33

Filter Callback Missing Type Predicate

Code Quiz
34

Helper Function Loses Narrowing

Code Quiz
35

typeof Cannot Detect Arrays

Code Quiz
36

Reassignment Resets Narrowing

Code Quiz
37

Non-null Assertion Hides Real Bug

Code Quiz
38

Wrong Null Check Misses Undefined

Code Quiz
39

Equality Narrowing Dead Branch

Code Quiz
40

Truthiness Narrowing Drops Zero

Code Quiz
41

Optional Chaining Yields Possibly Undefined

Code Quiz
42

Using unknown Without Narrowing

Code Quiz
43

Array.isArray as Type Guard

Quiz
44

Truthiness Narrowing

Quiz
45

Equality Narrowing

Quiz
46

Control Flow Analysis Basics

Quiz
47

typeof Guards for Primitives

Quiz
48

Type Predicate Return Effect

Quiz
49

Non-null Assertion Operator

Quiz
50

Narrowing via Assignment

Quiz
51

never in Exhaustiveness Checking

Quiz
52

Narrowing Literal and Union Types

Quiz
53

Narrowing Loss in Closures

Quiz
FlashcardIntermediate

Non-Null Assertion Operator (!)

The ! operator asserts a value is not null or undefined without runtime checks.

Question

What does the non-null assertion operator (!) do?

Click to reveal answer