TypeScript · Middle · Question 65 of 75
What do the intrinsic types Uppercase, Capitalize etc. allow?
type Getter<K extends string> = `get${Capitalize<K>}`;
type G = Getter<'name'>; // 'getName'- ✓Correct answer: Transforming string literal types, often combined with template literal and mapped types
- 2Changing strings at runtime
- 3Only checking that a string is uppercase
Explanation
They let you derive names like getName/onClick from keys, keeping APIs consistent automatically.