TypeScript
TypeScript is a compile-time layer over JavaScript. Every type you write is checked and then erased, so the code that runs is plain JavaScript and nothing about the types survives into it. Holding on to that one fact answers a surprising share of the questions here.
The type system is structural rather than nominal: compatibility is decided by what a value has, not by what it was declared as. On top of that sit the four things interviews actually dig into — narrowing, generics, the utility types, and what `any` costs you compared with `unknown`.
Each question gives you four options, explains why the right one is right, and links to the handbook. The code runs the same way as in the JavaScript track, so you can read a snippet and reason about it before answering.
Choose a level
Basic
Annotations, inference, the primitive types, and the difference between any and unknown.
- annotations
- inference
- arrays & tuples
- interfaces
- type aliases
- unions
- +5 more
Intermediate
Narrowing, type guards, generics and the utility types — where a mid-level interview lives.
- type vs interface
- declaration merging
- narrowing
- type guards
- discriminated unions
- assertions
- +6 more
Advanced
Conditional and mapped types, infer, decorators, variance and the compiler itself.
- conditional types
- infer
- mapped types
- template literal types
- decorators
- declaration files
- +4 more