Skip to content

Part I — TypeScript ​

TypeScript separates a senior candidate from a mid-level one faster than any other topic. The mid-level answer is "I add types". The senior answer is "I add the type that makes the wrong state unrepresentable, and I let inference do the rest." This section covers the type system as a design tool: what to model, what to derive, and where the cleverness stops paying for itself.

Chapters 01–03 are the everyday type system: annotate, model, reuse. Chapters 04–05 cover narrowing and derived types, which is where types start catching real bugs. Applying all of it to React (props, hooks, context, generic components) is React and TypeScript at Scale. That chapter sits with the rest of the React chapters in Part III.

Chapters ​

#ChapterWhat it answers
01TypeScript Basic Types, Literals and EnumsWhat do any, unknown and never cost, and why not enum?
02Interfaces and Type AliasesOn what two grounds do they actually differ?
03TypeScript GenericsHow do you keep the caller's exact type all the way through?
04TypeScript Type GuardsHow do you get a compile error when you forget a case?
05TypeScript Advanced and Utility TypesHow do you derive a type instead of maintaining two, and when does it stop paying?
06TypeScript at ScaleHow do you get an old codebase onto strict, and when do types cost too much?

What Interviewers Probe For ​

The part-level signal with a compile-time twist. What that looks like in practice:

  • Do you know where types stop? TypeScript erases at runtime. A candidate who validates an API response with an as cast and calls it type-safe has answered the question badly. The follow-up is always "what happens when the server sends something else?"
  • Can you narrow properly? Discriminated unions plus an exhaustive switch with a never default is the pattern interviewers are listening for. It converts a future bug into a build failure.
  • Do you reach for generics for the right reason? A generic that appears once in the signature is usually an any with extra steps. A generic that links an argument to a return type is doing work.
  • Do you know when to stop? Conditional and mapped types can express almost anything. But a type nobody on the team can read is a liability. Naming the cost is the senior part of the answer.

Reading Order ​

Read straight through, but skim 02 if you already write TypeScript daily. Slow down on Chapter 04, because narrowing is what makes the rest useful.

Interview sprint: 03 → 04 → 05, then the React chapter in Part III. Together, generics, narrowing, derived types and typing a component cover almost every TypeScript question in a frontend-heavy interview loop.

The whole book, free to read. Generated from the manuscript on every change.

Your progress

Tick each chapter in the sidebar once you have read and understood it. Your name and email keep the ticks on any device.

Your name and email are stored to save your progress. Nothing else is done with them.