TypeScript for Frontend Developers
TypeScript is a typed superset of JavaScript that checks your code at compile time and then compiles to plain JavaScript. Types, interfaces, unions, generics and narrowing catch mistakes such as calling a function with the wrong argument before the code runs, and give editors accurate autocomplete.
Stage: JavaScript and TypeScript · Part of the Frontend Developer roadmap · Last reviewed 19 November 2026
What to learn in TypeScript
- Describe object shapes with interfaces or type aliases
- Narrow a union type using typeof, in or discriminated unions
- Write a generic function that preserves the input type
- Use Partial, Pick, Omit and Record to derive new types
- Type API responses and avoid the any escape hatch
TypeScript interview questions
What is the difference between interface and type in TypeScript?
Both describe object shapes. Interfaces can be extended and merged through declaration merging, and suit public object contracts. Type aliases can also name unions, tuples and mapped types. For plain objects the choice is mostly team convention.
Why prefer unknown over any?
Any switches off type checking for a value, so errors slip through. Unknown accepts any value but forces you to narrow it with a check before using it. That keeps safety in places such as parsed JSON or caught errors.
Where TypeScript fits in the Frontend Developer roadmap
TypeScript belongs to the JavaScript and TypeScript stage (beginner level), which takes about 5 hours. The language of the browser, and the type system that keeps large codebases sane.
Other units in this stage
Back to the full Frontend Developer roadmap