Interview Q&A / TypeScript
TypeScript interview questions
Types, interfaces, generics and safe patterns for real codebases.
Prefer rapid revision? Practise TypeScript short interview answers →
- What is the never type in TypeScript, and how do you use it for exhaustive checks?
never is the type with no possible values. It is the return type of functions that never finish normally, like one that always throws, and it is what remains after every case of a union has been handled. Assigning the leftover value to never makes the compiler report any case you forgot.
AdvancedIn-depth4 min read