String Types

Lowercase<S>

Converts each character in a string literal type to its lowercase equivalent using intrinsic compiler support.

Definition

TypeScript
type Lowercase<S extends string> = intrinsic;

Examples

Basic Transformation
type Quiet = Lowercase<"HELLO WORLD">;
// "hello world"

type Method = "GET" | "POST" | "PUT" | "DELETE";
type LowerMethod = Lowercase<Method>;
// "get" | "post" | "put" | "delete"
Route Generation
type Resource = "Users" | "Products" | "Orders";
type ApiRoute = `/api/${Lowercase<Resource>}`;
// "/api/users" | "/api/products" | "/api/orders"

function buildRoute<T extends Resource>(resource: T): `/api/${Lowercase<T>}` {
  return `/api/${resource.toLowerCase()}` as `/api/${Lowercase<T>}`;
}
Case-Insensitive Matching
type Color = "RED" | "GREEN" | "BLUE";
type CSSColor = Lowercase<Color>;
// "red" | "green" | "blue"

const colorMap: Record<Color, CSSColor> = {
  RED: "red",
  GREEN: "green",
  BLUE: "blue",
};

Common Use Cases

  • 1Converting constant-case types to lowercase
  • 2Generating URL paths from PascalCase resource names
  • 3Normalizing user input types
  • 4Creating CSS-compatible color name types
  • 5Building case-insensitive type comparisons

Understanding Lowercase<S>

Lowercase<S> is the counterpart to Uppercase<S>. It converts every character in a string literal type to lowercase using intrinsic compiler support. Like all intrinsic string types, it operates at the type level during compilation.

Lowercase is particularly useful for generating URL patterns and route types. If your application defines resources in PascalCase or UPPER_CASE, Lowercase can derive the corresponding lowercase route segments. For example, given type Resource = "Users" | "Products", the type `/api/${Lowercase<Resource>}` produces "/api/users" | "/api/products".

This type distributes over unions, so Lowercase<"A" | "B" | "C"> produces "a" | "b" | "c". Combined with template literal types, this distribution enables powerful string type transformations across entire sets of values.

A common pattern is using Lowercase to normalize string types for comparison or mapping purposes. When you receive data that might be in any case (like HTTP methods or header names), Lowercase provides a canonical form at the type level.

Lowercase is especially valuable in CSS-in-JS libraries and design systems. CSS property names and color keywords are lowercase by convention. If your type definitions use different casing internally, Lowercase bridges the gap when generating CSS-compatible types.

When implementing runtime functions that mirror Lowercase behavior, use a type assertion: return str.toLowerCase() as Lowercase<T>. TypeScript cannot automatically verify that toLowerCase() produces a Lowercase<T> at the value level, so the assertion is needed to maintain type accuracy.

Related Types

More String Types

Explore TypeScript Types

Browse our complete reference of 30 TypeScript utility types with definitions, examples, and explanations.