04 · Core

TypeScript

Types that scale — generics, narrowing, and the tricky inference questions.

TypeScript question bank 36 questions · 6 categories

Type-level thinking. Senior+ interviews increasingly ask you to design APIs with types and reason about generics.

Basics

Topic Difficulty Time Tags Best Resources
Type basics & inference 🟢 45m #basics TS Handbook: everyday types ⭐
Interfaces vs type aliases 🟢 30m #basics TS Handbook ⭐
Union & intersection types 🟢 30m #basics TS Handbook: unions ⭐
Literal & enum types 🟢 30m #basics TS Handbook: enums ⭐
Functions & overloads 🟡 45m #basics TS Handbook: functions ⭐
Narrowing & type guards 🟡 45m #guards TS Handbook: narrowing ⭐
Discriminated unions 🟡 45m #patterns #state TS Handbook ⭐
unknown vs any vs never 🟡 30m #basics TS Handbook ⭐

Advanced types

Topic Difficulty Time Tags Best Resources
Generics 🟡 1h #generics TS Handbook: generics ⭐
Generic constraints & defaults 🟡 45m #generics TS Handbook ⭐
Utility types (Partial/Pick/Omit/Record…) 🟡 45m #utility-types TS Handbook: utility types ⭐
keyof & typeof 🟡 30m #type-ops TS Handbook: keyof ⭐
Indexed access types 🟡 30m #type-ops TS Handbook ⭐
Mapped types 🔴 1h #type-ops TS Handbook: mapped types ⭐
Conditional types & infer 🔴 1.5h #type-ops #advanced TS Handbook: conditional types ⭐
Template literal types 🔴 1h #type-ops #advanced TS Handbook ⭐
Variance & assignability 🔴 1h #advanced TS Handbook ⭐
Type-level programming 🔴 2h #advanced Type Challenges ⭐

Tooling & practice

Topic Difficulty Time Tags Best Resources
Declaration files (.d.ts) 🟡 45m #config TS Handbook ⭐
Decorators 🟡 45m #advanced TS Handbook: decorators ⭐
tsconfig deep dive 🟡 45m #config TSConfig reference ⭐
strict mode & flags 🟡 30m #config TS Handbook ⭐
Project references & monorepos 🔴 1h #monorepo #config TS Handbook ⭐
Typing React components & hooks 🟡 1h #react React TS cheatsheet ⭐
Typing async & generics in APIs 🟡 45m #patterns TS Handbook ⭐

❓ Rapid-fire TypeScript interview questions

Real TypeScript interview questions. Answer out loud, then verify above.

  1. interface vs type — when to use each?
  2. unknown vs any vs never — what's the difference?
  3. What are generics and why use them?
  4. Explain union vs intersection types.
  5. What are type guards and narrowing?
  6. What are discriminated unions?
  7. Name the common utility types (Partial, Pick, Omit, Record…).
  8. What do keyof and typeof do at the type level?
  9. What are mapped types?
  10. What are conditional types and infer?
  11. What are template literal types?
  12. What is a declaration file (.d.ts)?
  13. What does strict mode turn on?
  14. What is the difference between enum and a union of literals?
  15. How do you type a React component and its props/hooks?
  16. What is structural typing (duck typing)?
  17. What is type assertion and when is it dangerous?
  18. How do generic constraints (extends) work?
  19. What's the difference between readonly and const?
  20. How does type inference work and when does it fail?

Related: 03-javascript · 06-react · 08-architecture

Missing something? Add a row.

ESC

Type to search across every question bank.

navigate open 3,610 questions indexed