← All Exercises
Record Type for Maps
intermediatetypescript
Background
Record<K, V> creates an object type with keys K and values V, useful for configuration maps and lookup tables.
Problem
Create a Record type for a configuration map where keys are known setting names and values are strings, with a function to get settings safely.
Input
A setting key from a known set of strings.
Output
The string value for that setting, or undefined.
Sample tests
Sample 1
Input: "theme"
Expected: "dark"
Your solution
Learning objective
Learn the Record utility type for creating type-safe key-value maps.