Courses
TypeScript for Beginners: Catch Wrong Data Before It Runs
Check Yourself: Before You Write Types
Five scenario questions on what the compiler checks and what it leaves alone. If you miss more than one, reread the first two lessons.
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.
A teammate says TypeScript makes the app safer because it checks every value against its type while the app is running. What is the accurate correction?
TypeScript only checks code in the browser, not in Node.
TypeScript makes the code faster because the types help the engine.
The types are removed when the code is compiled, so the compiler checks your code before it runs and nothing is checked afterwards.
That is right, TypeScript adds run-time checks to the compiled file.
2.
In JavaScript, add("5", 3) returns "53" and nothing complains. You declare add with two number parameters in TypeScript. What happens with the same call?
3.
You write JSON.parse(text) as { name: string; age: number } and the compiler is happy. The JSON has no age, and age.toFixed() later fails with a TypeError. What does this show?
4.
You run npx tsc hello.ts. It prints an error, and you see that hello.js was written anyway. Why?
5.
You run npx tsc hello.ts and it prints nothing at all. What does that mean?
About
Five scenario questions on what the compiler checks and what it leaves alone. If you miss more than one, reread the first two lessons.
- Duration
- 5 min
- Last update
- 10/10/2026
Was this helpful?
0
0
Comments (0)
Sign in to commentNo comments yet.