Recall & Review
beginner
What is the main purpose of type annotations in TypeScript?
Type annotations help specify the type of variables, function parameters, and return values to catch errors early and improve code clarity.
Click to reveal answer
beginner
How do type annotations help prevent bugs?
They allow the compiler to check if values match expected types, reducing runtime errors caused by wrong data types.
Click to reveal answer
beginner
Why do type annotations improve code readability?
They make it clear what kind of data is expected, so other developers (or you later) can understand the code faster.
Click to reveal answer
intermediate
Can TypeScript work without type annotations? What happens then?
Yes, TypeScript can infer types, but explicit annotations provide better error checking and documentation.
Click to reveal answer
intermediate
How do type annotations help tools like editors and IDEs?
They enable features like autocomplete, error highlighting, and better refactoring support.
Click to reveal answer
What is a key benefit of using type annotations in TypeScript?
✗ Incorrect
Type annotations help the compiler find type errors before the program runs.
Which of these is NOT a reason to use type annotations?
✗ Incorrect
Type annotations reduce errors but cannot guarantee zero runtime errors.
What happens if you don’t use type annotations in TypeScript?
✗ Incorrect
TypeScript tries to guess types automatically if annotations are missing.
How do type annotations help other developers reading your code?
✗ Incorrect
Annotations clarify what kind of data is expected, making code easier to understand.
Which tool feature is improved by type annotations?
✗ Incorrect
Type annotations help editors provide better autocomplete and error checking.
Explain why type annotations are important in TypeScript and how they help during development.
Think about how knowing data types helps both the computer and the developer.
You got /4 concepts.
Describe what happens if you omit type annotations in TypeScript and how the language handles it.
Consider how TypeScript guesses types when you don’t tell it explicitly.
You got /3 concepts.