---
id: wiki-2026-0508-typescript-utility-types-record-
title: TypeScript Utility Types (Record Readonly)
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Utility Types, TS Utility, Record, Readonly, Partial, Pick]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [typescript, utility-types, generics, frontend]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
  language: TypeScript
  framework: TypeScript 5.7
---

# TypeScript Utility Types (Record Readonly)

## 매 한 줄
> **"매 type-level lego — 매 mapped + conditional types 로 만든 matchable 변형기"**. 매 `Partial`, `Required`, `Readonly`, `Pick`, `Omit`, `Record`, `ReturnType` 등 매 lib.es5.d.ts 의 한 줄 정의가 매 거의 모든 type 변환의 기반이다. 매 2026 표준 toolkit.

## 매 핵심

### 매 Mapped types 기반
- 매 `[K in keyof T]` syntax.
- 매 modifier: `?`, `readonly`, `-?`, `-readonly`.
- 매 key remapping: `[K in keyof T as NewKey]` (TS 4.1+).

### 매 카테고리
- **Object 변형**: `Partial`, `Required`, `Readonly`, `Mutable`.
- **Selection**: `Pick`, `Omit`.
- **Construction**: `Record<K, V>`.
- **Function**: `Parameters`, `ReturnType`, `Awaited`.
- **Union**: `Exclude`, `Extract`, `NonNullable`.

### 매 응용
1. API DTO — `Partial<User>` for PATCH request.
2. State management — `Readonly<State>`.
3. Form — `Pick<User, 'name' | 'email'>`.

## 💻 패턴

### Partial / Required
```typescript
type User = { id: string; name: string; email: string };
type UserPatch = Partial<User>; // all optional
type UserStrict = Required<UserPatch>; // all required
```

### Readonly (deep version)
```typescript
type DeepReadonly<T> = {
  readonly [K in keyof T]: T[K] extends object ? DeepReadonly<T[K]> : T[K]
};
```

### Pick / Omit
```typescript
type PublicUser = Omit<User, 'email'>;
type LoginForm = Pick<User, 'email'>;
```

### Record
```typescript
type Role = 'admin' | 'user' | 'guest';
type Permissions = Record<Role, string[]>;
const p: Permissions = {
  admin: ['*'], user: ['read'], guest: []
};
```

### ReturnType / Parameters
```typescript
function fetchUser(id: string) { return { id, name: 'a' }; }
type User = ReturnType<typeof fetchUser>;
type Args = Parameters<typeof fetchUser>; // [string]
```

### Key remapping (TS 4.1+)
```typescript
type Getters<T> = {
  [K in keyof T as `get${Capitalize<string & K>}`]: () => T[K]
};
type UserGetters = Getters<{ name: string; age: number }>;
// { getName: () => string; getAge: () => number }
```

### NoInfer (TS 5.4+)
```typescript
function pick<T, K extends keyof T>(obj: T, keys: NoInfer<K>[]): Pick<T, K> {
  // K is inferred only from obj, not from keys argument
  return keys.reduce((acc, k) => ({ ...acc, [k]: obj[k] }), {} as Pick<T, K>);
}
```

## 매 결정 기준
| 상황 | Util |
|---|---|
| 부분 update | `Partial` |
| immutable state | `Readonly` |
| key→value map | `Record` |
| field 선택/제거 | `Pick` / `Omit` |
| function 결과 typing | `ReturnType<typeof fn>` |

**기본값**: 매 built-in util 우선, 매 custom mapped 는 매 shape 가 매 unique 할 때만.

## 🔗 Graph
- 부모: [[TypeScript 타입 시스템 (TypeScript Type System)]]
- 변형: [[Mapped Types]] · [[Conditional Types]]
- 응용: [[TypeScript_Type_Safety]] · [[Branded-Types-for-Nominal-Typing]]
- Adjacent: [[Zod]]

## 🤖 LLM 활용
**언제**: 매 boilerplate type 변환 — 매 LLM 이 매 잘 알고 있음.
**언제 X**: 매 deeply recursive — 매 매 manual review 필요.

## ❌ 안티패턴
- **`Pick<T, keyof T>` 남용**: 매 그냥 `T` 와 동일.
- **`Partial<Required<T>>`**: 매 의미 없는 chain.
- **Custom util 중복**: 매 lib.es5 / type-fest 에 이미 있는데 새로 만듦.

## 🧪 검증 / 중복
- Verified (lib.es5.d.ts, TypeScript Handbook Utility Types).
- 신뢰도 A.

## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — utility types catalog + TS 5.7 추가 |
