Compile-time casing
Derive uppercase labels or messages from string literal types.
TypeScript · Type Alias
Uppercase<StringType> converts every character in a string type to its uppercase form. It is an intrinsic compiler type commonly used with template literal types to derive uppercase string formats.
Uppercase is an intrinsic string manipulation type that transforms every character in a string type to its uppercase version. It is evaluated by the compiler and is useful inside template literal types for deriving consistently capitalized string formats.
Uppercase<StringType>| Name | Type | Description |
|---|---|---|
StringType | string type | The string type whose characters should be converted to uppercase. |
A string type with every character converted to its uppercase version.
type Greeting = "Hello, world";
type ShoutyGreeting = Uppercase<Greeting>;
const greeting: ShoutyGreeting = "HELLO, WORLD";
console.log(greeting);This compiles because Uppercase transforms every character in the literal type to its uppercase form.
Derive uppercase labels or messages from string literal types.
Create normalized identifiers such as ID-MY_APP from generic input.
Build APIs whose string keys follow an uppercase convention.
LowercaseCapitalizeUncapitalizeTemplate Literal Types