intermediate
Type system
Generics, constraints, narrowing, guards, discriminated unions, utilities, mapped types, and conditional types.
The TypeScript type system lets you express relationships, transformations, and safe refinements. Generics preserve caller-specific information. Narrowing and type guards connect control flow to safer types. Discriminated unions model finite states. Utility and mapped types derive shapes without duplication. Conditional and template literal types compute types from other types.
Interview depth usually progresses from generics and narrowing toward unions and derived types. Senior questions may touch distributive conditionals, but readability still matters.
Checklist:
- Start with generics and narrowing child topics.
- Use discriminated unions for state machines.
- Derive DTOs instead of duplicating shapes.