Intrinsic String Types
Built-in types for manipulating string casing.
Compiler Magic
TypeScript provides four special utility types specifically for manipulating the casing of string literal types: Uppercase<StringType>, Lowercase<StringType>, Capitalize<StringType>, and Uncapitalize<StringType>.
Unlike other utilities like Partial<T>, you cannot see the source code for these types. They are marked as intrinsic, meaning the TypeScript compiler handles them internally for performance.
Enforcing String Formats
When building complex UI libraries or mapping APIs, you often need to transform keys—for example, converting an id property into a setId action.
Intrinsic string types, when combined with Template Literal Types, allow you to enforce these naming conventions perfectly at compile-time.
Syntax
typescript
type A = Uppercase<"hello">; // "HELLO"
type B = Lowercase<"WORLD">; // "world"
type C = Capitalize<"john">; // "John"
type D = Uncapitalize<"App">; // "app"
// Often used in template literal types:
type Prefix<T extends string> = get${Capitalize<T>};
type NameGetter = Prefix<"name">; // "getName"
Try it
Explore the four intrinsic string types and observe how the compiler instantly manipulates string literal values at compile-time.
Check yourself
Pick an answer to lock it in, then read why. Getting one wrong is part of how it sticks.
Remember this
- TypeScript provides 4 intrinsic string types: Uppercase, Lowercase, Capitalize, and Uncapitalize.
- Their logic runs internally inside the compiler (
intrinsic). - They are almost always used alongside Template Literal Types.
- They distribute across string unions automatically.
Done with this concept?
Mark it complete to track your progress. No login needed.