Courses
TypeScript for Beginners: Catch Wrong Data Before It Runs
Check Yourself: Shapes You Can Reuse
Five scenario questions on type aliases, merging, literal widening and narrowing. If you miss more than one, reread the lessons in this section.
Course content
Join this Course
Sign in to save your progress.
-
Before You Write Types
-
What TypeScript Adds on Top of JavaScript
-
Install TypeScript and Run Your First .ts File
-
-
-
Types You Cannot Skip
-
Annotating Variables Without Fighting the Compiler
-
Arrays, Objects and Nested Shapes
-
Optional, Readonly and Why any Is a Trap
-
-
-
Functions That State Their Deal
-
Parameter and Return Types
-
Optional and Default Parameters Without Surprises
-
-
-
Shapes You Can Reuse
-
Interfaces vs type Aliases: Pick One and Stick With It
-
Unions, Literals and Narrowing With typeof and in
-
-
-
Compile Without the Mystery
-
tsconfig.json: target, module and strict
-
Reading tsc Errors Without Panicking
-
-
- Final Check: TypeScript for Beginners
1.
You need a type that is exactly one of the words draft, sent or paid. Which tool can name it?
2.
Two files in the same global scope each declare interface Settings with different properties. What happens, and what did you probably not expect?
3.
You declare const order = { status: "paid" }; and call label(order.status) where label accepts a union of the words draft, sent and paid. The call fails. Why?
4.
A union has two object types that both have a name property and differ in other keys. You write if ("name" in person) and then read person.id. Why does the compiler refuse?
5.
A parameter is typed object or null. You write if (typeof value === "object") and call value.toString() inside. The compiler says value is possibly null. Why?
About
Five scenario questions on type aliases, merging, literal widening and narrowing. If you miss more than one, reread the lessons in this section.
- Duration
- 5 min
- Last update
- 10/10/2026
Was this helpful?
0
0
Comments (0)
Sign in to commentNo comments yet.