-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(Lowercase): Add Lowercase documentation
- Loading branch information
1 parent
d35e7f2
commit b48a116
Showing
2 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,42 @@ | ||
# Lowercase | ||
# Lowercase\<StringType> | ||
|
||
:::info | ||
`Capitalize\<StringType>`은 TypeScript 4.1 이상에서 사용할 수 있는 내장 유틸리티 타입이에요. 자세한 내용은 [타입스크립트 핸드북](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#lowercasestringtype)과 [릴리즈 노트](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/)를 참고해주세요. | ||
::: | ||
|
||
## 개요 | ||
|
||
`Lowercase<StringType>` 유틸리티 타입은 문자열의 각 문자를 소문자로 변환해요. | ||
|
||
## 문법 | ||
|
||
```ts | ||
type Lowercase<S extends string> = intrinsic; | ||
``` | ||
|
||
- **StringType (S)**: The string that you want to convert each character in the string to the lowercase version. | ||
|
||
## Examples | ||
|
||
#### Example #1 | ||
|
||
```ts | ||
type Greeting = 'Hello, world'; | ||
type QuietGreeting = Lowercase<Greeting>; // 'hello, world' | ||
|
||
type ASCIICacheKey<Str extends string> = `id-${Lowercase<Str>}`; | ||
type MainID = ASCIICacheKey<'MY_APP'>; // 'id-my_app' | ||
``` | ||
|
||
#### Example #2 | ||
|
||
```ts | ||
type Environment = 'DATABASE_URL' | 'NODE_ENV' | 'PORT'; | ||
type LowercaseEnvironment = Lowercase<Environment>; | ||
|
||
const env: Record<LowercaseEnvironment, string> = { | ||
database_url: 'mongodb://localhost:27017/db', | ||
node_env: 'development', | ||
port: '8000', | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,42 @@ | ||
# Lowercase | ||
# Lowercase\<StringType> | ||
|
||
:::info | ||
The `Lowercase<StringType>` utility type is available starting from TypeScript version 4.1. For more information see in [TypeScript Handbook](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#lowercasestringtype), [Release Note](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/) | ||
::: | ||
|
||
## Overview | ||
|
||
The `Lowercase<StringType>` utility type in TypeScript is used to convert each character in the string to the lowercase version. | ||
|
||
## Syntax | ||
|
||
```ts | ||
type Lowercase<S extends string> = intrinsic; | ||
``` | ||
|
||
- **StringType (S)**: The string that you want to convert each character in the string to the lowercase version. | ||
|
||
## Examples | ||
|
||
#### Example #1 | ||
|
||
```ts | ||
type Greeting = 'Hello, world'; | ||
type QuietGreeting = Lowercase<Greeting>; // 'hello, world' | ||
|
||
type ASCIICacheKey<Str extends string> = `id-${Lowercase<Str>}`; | ||
type MainID = ASCIICacheKey<'MY_APP'>; // 'id-my_app' | ||
``` | ||
|
||
#### Example #2 | ||
|
||
```ts | ||
type Environment = 'DATABASE_URL' | 'NODE_ENV' | 'PORT'; | ||
type LowercaseEnvironment = Lowercase<Environment>; | ||
|
||
const env: Record<LowercaseEnvironment, string> = { | ||
database_url: 'mongodb://localhost:27017/db', | ||
node_env: 'development', | ||
port: '8000', | ||
}; | ||
``` |