Skill Zuno · skillzunos.com · Fullstack
TypeScript interview questions
Prepare for TypeScript interviews on Skill Zuno. This practice book covers TypeScript interview questions across New, Easy, Medium, Hard, and Diff levels so you can work through real interview-style problems on skillzunos.com.
Open TypeScript on Skill ZunoAlso see the TypeScript tutorial.
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. Its structural type system catches errors at build time and powers editor tooling, without changing how the code runs. Interviews cover type inference, unions and narrowing, generics, utility types and how to configure the compiler.
Sample TypeScript interview questions
What is the difference between an interface and a type alias?
Both describe object shapes. Interfaces can be reopened and merged by declaring them again, and are extended with extends. Type aliases can also name unions, tuples and mapped or conditional types, but cannot be merged.
What is the difference between any and unknown?
any switches type checking off, so anything can be done with the value. unknown accepts any value but allows nothing until you narrow it with typeof, instanceof or a type guard, which makes it the safe choice for untrusted input.
What is type narrowing?
Narrowing is how the compiler refines a union to a more specific type inside a branch, based on checks such as typeof x === 'string', 'key' in obj, instanceof, equality against a literal, or a user-defined type predicate (x is Foo).
What does the never type mean?
never is the type with no values: the return type of a function that always throws, and what a union narrows to once every case is handled. Assigning to never in a switch default gives an exhaustiveness check.
How do generic constraints work?
A constraint limits what a type parameter can be, as in function getProp<T, K extends keyof T>(obj: T, key: K): T[K]. The function stays generic but the compiler knows key is a real property of obj.
What you can practice
- TypeScript interview questions for beginners and experienced developers
- Level-based practice: New, Easy, Medium, Hard, and Diff
- Fullstack topics alongside TypeScript on skillzunos.com