On this page
  1. Capitalize
  2. Syntax & Overview
  3. Notes & Pitfalls
  4. Example

Capitalize

Prev: `Lowercase` | Up: string_manipulation | Next: `Uncapitalize`
Rel: string_manipulation, Conditional & Mapped Types
Ref: TypeScript Docs — Utility Types
Tags: #public #web #typescript #utility-types #string_manipulation #tier/standard


Syntax & Overview

Capitalize<S>

Uppercases the first character of string literal type S.

Notes & Pitfalls

Example

type EventName<K extends string> = `on${Capitalize<K>}`;
type ClickEvent = EventName<"click">; // "onClick"

Linked from

Related notes