Skip to content

Commit

Permalink
docs(Lowercase): Add Lowercase documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
haejunejung committed Aug 15, 2024
1 parent d35e7f2 commit b48a116
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 2 deletions.
43 changes: 42 additions & 1 deletion docs/ko/reference/built-in/Lowercase.md
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',
};
```
43 changes: 42 additions & 1 deletion docs/reference/built-in/Lowercase.md
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',
};
```

0 comments on commit b48a116

Please sign in to comment.