Lowercase<T> for Full Lowercasing
What you'll learn: How to use TypeScript's built-in Lowercase<T> utility type to transform string literal types into their fully lowercase equivalents at compile time.
The Core Idea
Just as Uppercase<T> converts string literal types to all capital letters, Lowercase<T> does the opposite—it takes any string literal type and transforms every character to lowercase. This happens entirely at the type level, meaning TypeScript calculates the result during compilation without any runtime overhead.
Think of it like having a case-conversion function, but instead of operating on actual string values, it operates on the types of strings.
How Lowercase<T> Works
The syntax is straightforward:
type Greeting = "HELLO WORLD";
type Quiet = Lowercase<Greeting>; // "hello world"
type ShoutingStatus = "ERROR" | "WARNING" | "INFO";
type WhisperingStatus = Lowercase<ShoutingStatus>; // "error" | "warning" | "info"
When you apply Lowercase<T> to a union of string literals, it distributes across each member:
type HTTPMethod = "GET" | "POST" | "PUT" | "DELETE";
type NormalizedMethod = Lowercase<HTTPMethod>;
// "get" | "post" | "put" | "delete"
This is particularly useful when you need to normalize user input types, create case-insensitive matching systems, or bridge between APIs that use different casing conventions—all with full type safety.
Key Takeaway: Lowercase<T> transforms string literal types to their lowercase equivalents at the type level, enabling case normalization and conversion in your type system without runtime cost.