Courses
TypeScript Intermediate: Types That Survive Real Projects
Check Yourself: Strictness That Pays Off
Five scenario questions on unknown, caught errors and discriminated unions. If you miss more than one, reread the lessons in this section.
Course content
Join this Course
Sign in to save your progress.
-
Generics Without the Fog
-
Generic Functions That Keep the Input Type
-
Generic Types for Lists, Results and Caches
-
-
-
Types That Transform Other Types
-
Utility Types: Partial, Pick, Omit and Record
-
Mapped Types You Can Actually Read
-
-
-
Working With Code You Didn't Write
-
@types Packages and When DefinitelyTyped Is Wrong
-
Typing fetch JSON Without Lying to Yourself
-
-
-
Classes and Modules in TypeScript
-
Classes With public, private and protected
-
Modules, Exports and Avoiding Circular Types
-
-
-
Strictness That Pays Off
-
unknown vs any and Safe Parsing
-
Discriminated Unions for API Responses That Vary
-
-
- Final Check: TypeScript Intermediate
1.
You store the result of JSON.parse in a constant typed unknown, and then read value.retries on the next line. What does the compiler do?
2.
In a strict project you write a try statement with catch (error) and call error.message inside. The compiler refuses. What is the right fix?
3.
A response type has three cases tagged by a status property with the values success, error and loading. The error case has code and message. Inside an if that tests status equal to the word error, what can you read on the response?
4.
You add a fourth case to the response union, with the status empty. A switch on status ends with a default that passes the response to a function taking never. What happens to the existing code?
5.
In a union of response types, one case declares its status as a plain string instead of a literal such as the word success. What happens to narrowing?
About
Five scenario questions on unknown, caught errors and discriminated unions. If you miss more than one, reread the lessons in this section.
- Duration
- 5 min
- Last update
- 10/08/2026
Was this helpful?
0
0
Comments (0)
Sign in to commentNo comments yet.