Recall & Review
beginner
What are types that exist only at compile time in TypeScript?
These are types used by the TypeScript compiler to check code correctness but do not exist in the JavaScript output. They help catch errors before running the code.
Click to reveal answer
beginner
Do TypeScript interfaces exist in the compiled JavaScript code?
No, interfaces are removed during compilation. They only help with type checking while writing code and do not produce any JavaScript code.
Click to reveal answer
beginner
What happens to TypeScript type aliases after compilation?
Type aliases are used only at compile time for type checking and are erased in the compiled JavaScript, so they do not exist at runtime.
Click to reveal answer
intermediate
Are enums in TypeScript compile-time only types?
No, enums generate JavaScript code and exist at runtime. Only types, interfaces, and generics are compile-time only.
Click to reveal answer
intermediate
What is the difference between types/interfaces and classes in TypeScript regarding runtime?
Types and interfaces exist only at compile time and are erased after compilation. Classes produce JavaScript code and exist at runtime.
Click to reveal answer
Which TypeScript construct exists only at compile time?
✗ Incorrect
Interfaces are used only for type checking and do not exist in the compiled JavaScript.
What happens to type aliases after TypeScript compilation?
✗ Incorrect
Type aliases are erased during compilation and only help with type checking.
Which of these exists at runtime in JavaScript after compiling TypeScript?
✗ Incorrect
Enums generate JavaScript code and exist at runtime.
Are TypeScript generics present in the compiled JavaScript code?
✗ Incorrect
Generics are used only for type checking and are removed after compilation.
Which statement is true about TypeScript interfaces?
✗ Incorrect
Interfaces are erased during compilation and only help with type checking.
Explain which TypeScript types exist only at compile time and why.
Think about what TypeScript removes when it creates JavaScript.
You got /5 concepts.
Describe the difference between TypeScript types/interfaces and classes regarding runtime presence.
Consider what code actually runs in the browser or Node.js.
You got /4 concepts.