Uncapitalize<S>
Converts the first character of a string literal type to lowercase while leaving the rest unchanged.
Definition
type Uncapitalize<S extends string> = intrinsic;Examples
type A = Uncapitalize<"Hello">;
// "hello"
type B = Uncapitalize<"FirstName">;
// "firstName"
type C = Uncapitalize<"URL">;
// "uRL"type PascalComponents = "UserProfile" | "NavBar" | "SidePanel";
type CamelProps = Uncapitalize<PascalComponents>;
// "userProfile" | "navBar" | "sidePanel"
type ComponentRegistry = Record<PascalComponents, React.ComponentType>;
type PropKeys = Record<CamelProps, boolean>;type HandlerName = "onClick" | "onFocus" | "onSubmit";
type ExtractEvent<T extends string> =
T extends `on${infer E}` ? Uncapitalize<E> : T;
type EventName = ExtractEvent<HandlerName>;
// "click" | "focus" | "submit"
type EventMap = { [K in HandlerName]: ExtractEvent<K> };Common Use Cases
- 1Converting PascalCase to camelCase for property names
- 2Extracting base names from prefixed handler names
- 3Generating JSON-friendly property names from class names
- 4Template literal type reverse transformations
- 5API response normalization type mappings
Understanding Uncapitalize<S>
Uncapitalize<S> converts the first character of a string literal type to lowercase, leaving the rest unchanged. It is the inverse of Capitalize and is implemented as an intrinsic compiler type.
While Capitalize is more commonly used for generating names that follow conventions (like onClick from "click"), Uncapitalize excels at the reverse transformation—extracting base names from convention-following identifiers.
A classic use case is extracting event names from handler names. Given "onClick", you can use template literal inference to extract the "Click" part, then Uncapitalize it to get "click". This bidirectional conversion enables type-safe mappings between event names and their handlers.
Uncapitalize is also valuable when converting between PascalCase and camelCase at the type level. PascalCase is conventional for class and component names, while camelCase is standard for variables and properties. Uncapitalize<"UserProfile"> gives "userProfile", bridging these naming conventions.
In API design, Uncapitalize helps when your internal types use PascalCase class names but the API expects camelCase keys. Rather than maintaining duplicate type definitions, a mapped type with Uncapitalize can derive the API shape from your internal types.
One caveat: Uncapitalize only changes the first character. It does not perform full camelCase conversion. "URLParser" becomes "uRLParser", not "urlParser". For more complex case transformations, you need custom recursive template literal types or runtime transformation functions. The intrinsic string types handle single-character transformations cleanly but leave multi-character patterns to user-defined types.
Related Types
Capitalize<S>Converts the first character of a string literal type to uppercase while leaving the rest unchanged.
Uppercase<S>Converts each character in a string literal type to its uppercase equivalent using intrinsic compiler support.
Lowercase<S>Converts each character in a string literal type to its lowercase equivalent using intrinsic compiler support.
Template Literal TypesTemplate literal types combine string literal types with embedded expressions to create powerful string pattern types.
More String Types
Explore TypeScript Types
Browse our complete reference of 30 TypeScript utility types with definitions, examples, and explanations.