Describe dictionaries: { [key: string]: number }. Use when keys are dynamic but values share one type.
Record helper
Record<string, number> is equivalent to an index signature for string keys—often reads cleaner in application code.
Pitfall
Mixing known keys with an index signature requires careful typing; prefer explicit interfaces when keys are finite.
Self-check
- Type a map of country code → dial code with
Record.
Practice: Apply index-signatures in the playground, then explain index signatures in one sentence without looking at notes.