JavaScript
const capitalizeFirstLetter = ([firstLetter, ...restOfWord]) =>
firstLetter.toUpperCase() + restOfWord.join('');
TypeScript
const capitalizeFirstLetter = <T extends string>([
firstLetter,
...restOfWord
]: T) => {
return (firstLetter.toUpperCase() + restOfWord.join('')) as Capitalize<T>;
};