mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-23 03:56:23 +00:00
20 lines
394 B
Markdown
20 lines
394 B
Markdown
|
---
|
||
|
id: 6c64608e-24e8-4f8a-8f22-6b9bba4a3f0c
|
||
|
title: Capitalize
|
||
|
---
|
||
|
|
||
|
# Description
|
||
|
|
||
|
Transforms the first string character to uppercase for [string literal
|
||
|
types](20201123101810-typescript_template_literal_string_type).
|
||
|
|
||
|
# Syntax
|
||
|
|
||
|
``` typescript
|
||
|
type CapitalizedGreeting<T extends string> = `${Capitalize<T>}`
|
||
|
|
||
|
type HELLO = CapitalizedGreeting<"hello">;
|
||
|
// same as
|
||
|
// type HELLO = "Hello";
|
||
|
```
|