Function capitalize

Capitalizes the first letter of a string.

let a = capitalize('foo'); // a has type 'Foo'
a = 'bar'; // Error: Type '"bar"' is not assignable to type '"Foo"'
  • Type Parameters

    • S extends string

      The string type.

    Parameters

    • x: S

      The string to capitalize.

    Returns Capitalize<S>

    The capitalized string with a Capitalize type.