TypeScript · Generics and utility types
Record<K, V>
Maps a union of keys to a value type. All keys are required by default.
Syntax
Record<"a" | "b", number>Example
Example
type Totals = Record<"html" | "css", number>;
const totals: Totals = { html: 8, css: 6 };More in this group
Learn this in the course
Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.