Capitalize<S>
A built-in string utility type that turns the first letter of a string literal type into a capital, so "email" becomes "Email".
In more detail
Used inside template literal types, it builds names such as onEmailChange or getId from property keys. Uppercase and Lowercase change every letter.
Related terms
- template literal type — A string literal type built with backticks, such as `on${Capitalize<K>}Change`, that combines other string types.
- key remapping — Renaming or filtering keys inside a mapped type with an as clause, such as [K in keyof T as `get${Capitalize<K & string>}`].
- mapped type — A type that builds a new object type by looping over a set of keys, such as { [K in keyof T]: T[K] }.
Taught in
- Primitive Types: String, Number, Boolean, Bigint And Symbol — Production TypeScript
- Literal Types: String, Number, Boolean Literals And const — Production TypeScript
- Mapped Types, Key Remapping With as And Template Literals — Production TypeScript