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'

Explanation

They let you derive names like getName/onClick from keys, keeping APIs consistent automatically.

Further reading

Problem with a question

TypeScript · Middle · question 65

Test yourself

Take the TypeScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz