string-manipulation

Lowercase<S>

Intrinsic string type manipulator that converts each character of literal S to lowercase. Available since TS 4.1 and evaluated by the compiler with no runtime cost.

type Lowercase<S extends string> = intrinsic

Usage patterns

Pattern Purpose
Lowercase<'HELLO'> Basic lowercase transform
Lowercase<HTTPMethod> Normalize a union of literal cases
Lowercase<S> extends S ? true : false Test whether a literal is already lowercase
Uppercase<Lowercase<S>> Two-step normalize/loudify

Examples

type L = Lowercase<'WORLD'>;

Result: 'world'

type HTTPMethod = 'GET' | 'POST' | 'PUT';
type Method = Lowercase<HTTPMethod>;

Result: 'get' | 'post' | 'put' — distributes over unions

type Path<T extends string> = `/${Lowercase<T>}`;
type P = Path<'API'>; // '/api'

Building URL patterns via template literal types

type S = Lowercase<string>;

Result: string when the input is not a literal

Gotcha

Only literal string types are transformed — a bare `string` stays `string`. Emits no runtime code, so pair with String.prototype.toLowerCase() for actual value conversion.

Related utility types

← All TS utility types · TypeScript vs JavaScript · any vs unknown vs never