> For the complete documentation index, see [llms.txt](https://toktokhan.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://toktokhan.gitbook.io/docs/basic-guides/convention/types/boilerplate/utility.md).

# Utility

`utility` 폴더는 주로 프로젝트에서 여러 부분에서 공통적으로 사용되는 유틸리티(utility) 타입들을 모아놓은 폴더입니다. 코드의 가독성과 재사용성을 높이기 위해 유용한 타입들을 한 곳에 모아 정리하는 데 목적이 있습니다.&#x20;

아래는 `type > utility` 폴더에 있는 유틸리티 타입들과 해당 타입들의 역할을 표로 정리한 것입니다:

<table><thead><tr><th>타입 (Type)</th><th width="237.33333333333331">역할 (Role)</th><th>예시 (Example)</th></tr></thead><tbody><tr><td><code>AsyncFnReturn&#x3C;T></code></td><td>주어진 비동기 함수 <code>T</code>의 반환 타입을 추출</td><td><code>type Example = AsyncFnReturn&#x3C;() => Promise&#x3C;number>>;</code><br><code>Example = number</code></td></tr><tr><td><code>DeepMutable&#x3C;T></code></td><td>주어진 객체 <code>T</code>의 모든 속성을 mutable로 변환</td><td><code>type Example = DeepMutable&#x3C;{ readonly a: number; readonly b: { readonly c: number; readonly d: string }; }>;</code><br><code>Example = { a: number; b?: { c? : number; d? : string }; }</code></td></tr><tr><td><code>DeepNullAble&#x3C;T></code></td><td>주어진 객체 <code>T</code>의 모든 속성에 null 또는 해당 속성의 타입을 유지</td><td><code>type Example = DeepNullAble&#x3C;{ a: number; b: { c : number; d : string }; }>;</code><br><code>Example = { a: number | null; b?: { c? : number | null; d? : string | null } | null };</code></td></tr><tr><td><code>DeepOmitReadOnly&#x3C;T></code></td><td>주어진 객체 <code>T</code>의 모든 속성에서 <code>readonly</code>를 제거</td><td><code>type Example = DeepOmitReadOnly&#x3C;{ readonly a: number; readonly b: string; c: { readonly d : number; e : string }; }>;</code><br><code>Example = { c : { e: string }; }</code></td></tr><tr><td><code>DeepPartial&#x3C;T></code></td><td>주어진 객체 <code>T</code>의 모든 속성을 <code>optional</code>로 변환</td><td><code>type Example = DeepPartial&#x3C;{ a: number; b: { c : number; d : string }; }>;</code><br><code>Example = { a?: number; b?: { c? : number; d? : string }; }</code></td></tr><tr><td><code>IfEquals&#x3C;X, Y, A, B></code></td><td>주어진 두 개의 타입 <code>X</code>와 <code>Y</code>가 동일한지 비교하여 <code>A</code> 또는 <code>B</code>를 반환</td><td><code>type Example1 = IfEquals&#x3C;number, string, true, false>;</code><br><code>type Example2 = IfEquals&#x3C;number, number, true, false>;</code><br><code>Example1 = true</code><br><code>Example2 = false</code></td></tr><tr><td><code>ItemOf&#x3C;T></code></td><td>주어진 배열 <code>T</code>의 모든 아이템을 합친 유니온 타입을 생성</td><td><code>type Example = ItemOf&#x3C;['a', 'b', 'c']>;</code><br><code>Example = "a" | "b" | "c"</code></td></tr><tr><td><code>MockedFn&#x3C;T></code></td><td>주어진 함수 타입 <code>T</code>를 목(mock) 함수 타입으로 변환</td><td><code>export type MockedFn&#x3C;T extends (...params: any) => any> = jest.Mock &#x26; ((...args: Parameters&#x3C;T>) => ReturnType&#x3C;T>);</code></td></tr><tr><td><code>Mutable&#x3C;T></code></td><td>주어진 객체 <code>T</code>의 모든 속성을 <code>mutable</code>로 변환</td><td><code>type Example = Mutable&#x3C;{ readonly a: 1; b: 1 }>;</code><br><code>Example = { a: 1; b: 1; }</code></td></tr><tr><td><code>NullAble&#x3C;T></code></td><td>주어진 객체 <code>T</code>의 모든 속성을 <code>nullable</code>로 변환</td><td><code>type Example = NullAble&#x3C;{ a: 1; b: 1 }>;</code><br><code>Example = { a: 1 | null; b: 1 | null }</code></td></tr><tr><td><code>OmitReadOnly&#x3C;T></code></td><td>주어진 객체 <code>T</code>의 모든 속성 중 <code>readonly</code> 속성을 제거하는 유틸리티 타입입니다.</td><td><code>type Example = OmitReadOnly&#x3C;{ readonly a: number; b: string; readonly c: string; }>;</code><br><code>Example = { b : string; }</code></td></tr><tr><td><code>Paginated&#x3C;T></code></td><td>주어진 타입 <code>T</code>의 결과와 페이징을 나타내는 객체를 결합</td><td><code>export type Paginated&#x3C;T> = { next: string | null; results: T; };</code></td></tr><tr><td><code>Parameter&#x3C;T></code></td><td>주어진 함수 타입 <code>T</code>의 매개변수 타입을 추출</td><td><code>type Example = Parameter&#x3C;(value: number) => void></code><br><code>Example = number</code></td></tr><tr><td><code>ReadonlyKeysOf&#x3C;T></code></td><td>주어진 객체 <code>T</code>의 <code>readonly</code> 속성의 키를 추출</td><td><code>type Example = ReadonlyKeysOf&#x3C;{ readonly a: number; b: string; readonly c: string; }>;</code><br><code>Example = "a" | "c"</code></td></tr><tr><td><code>ValueOf&#x3C;T></code></td><td>주어진 객체 <code>T</code>의 모든 속성의 값으로 이루어진 유니온 타입을 생성</td><td>`type Example = ValueOf&#x3C;{ a: number;</td></tr></tbody></table>

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://toktokhan.gitbook.io/docs/basic-guides/convention/types/boilerplate/utility.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
