String: Capitalize

Medium
conditional types
template literal
infer
recursive
lookup

Description:

Implement the built-in Capitalize<T> generic without using it which converts the first letter of a string to uppercase and leave the rest as-is.

Note: You could not use built-in type utilities such as Capitalize and Uppercase

For example:

MyCapitalize<'hello world'> // expected to be 'Hello world'

Code

Loading...