TypeScriptのユーティリティ型とは、既存の型から別の型を作り出すために、TypeScriptが標準で用意している型のことです。Partial<T> で全項目を任意にする、Pick<T, K> で一部の項目だけ取り出す、ReturnType<F> で関数の戻り値の型を取り出す、といった変換を、型を書き直さずに行えます。

この記事では、TypeScript 7.0.2(2026年7月リリースの最新版)の標準ライブラリ lib.es5.d.ts に定義されている22種類すべてを、「用途」と「変換前→変換後」の一覧表にまとめました。各型の変換結果は tsc で型の一致を検証済みで、間違った使い方をしたときの実際のエラー文も載せています。更新用DTO、APIレスポンス、Omit の落とし穴など、実務でそのまま使えるパターンも紹介します。

TypeScriptのユーティリティ型の早見表(全22種)

例で使う型:type Task = { id: number; title: string; done?: boolean; memo: string | null }、type Status = 'todo' | 'doing' | 'done'

型 用途 変換前 → 変換後 追加された版
Partial<T> 全項目を任意に(更新用) Task → { id?: number; title?: string; done?: boolean; memo?: string | null } 2.1
Required<T> 全項目を必須に Task → { id: number; title: string; done: boolean; memo: string | null } 2.8
Readonly<T> 全項目を読み取り専用に Task → { readonly id: number; ... } 2.1
Record<K, T> キーの集合から辞書型を作る Record<Status, number> → { todo: number; doing: number; done: number } 2.1
Pick<T, K> 指定した項目だけ取り出す Pick<Task, 'id' | 'title'> → { id: number; title: string } 2.1
Omit<T, K> 指定した項目を除く Omit<Task, 'memo' | 'done'> → { id: number; title: string } 3.5
Exclude<U, E> ユニオンから除く Exclude<Status, 'done'> → 'todo' | 'doing' 2.8
Extract<U, E> ユニオンから取り出す Extract<Status | 1 | 2, string> → Status 2.8
NonNullable<T> null と undefined を除く string | null | undefined → string 2.8
Parameters<F> 関数の引数の型(タプル) (title: string, priority?: number) => ... → [title: string, priority?: number] 3.1
ConstructorParameters<C> コンストラクターの引数の型 typeof Stock → [name: string, count: number] 3.1
ReturnType<F> 関数の戻り値の型 typeof createTask → { id: number; title: string; priority: number } 2.8
InstanceType<C> クラスのインスタンスの型 typeof Stock → Stock 2.8
Awaited<T> Promise の中身の型(入れ子も展開) Promise<Promise<number>> → number 4.5
NoInfer<T> この位置からは型推論しない defaultValue: NoInfer<T> で候補外の値をエラーに 5.4
ThisParameterType<F> 関数の this の型 (this: Stock, prefix: string) => string → Stock 3.3
OmitThisParameter<F> 関数から this を除く → (prefix: string) => string 3.3
ThisType<T> オブジェクト内のメソッドの this を指定 { inc(): void } & ThisType<Counter> 2.3
Uppercase<S> 文字列リテラルを大文字に 'todo' → 'TODO' 4.1
Lowercase<S> 小文字に 'DONE' → 'done' 4.1
Capitalize<S> 先頭を大文字に 'title' → 'Title' 4.1
Uncapitalize<S> 先頭を小文字に 'Title' → 'title' 4.1

よく使うのは上から9つ(Partial〜NonNullable)と ReturnType・Awaited です。版は公式ハンドブックの記載(文字列操作の4種はテンプレートリテラル型と同じ 4.1)によります。

本記事の内容は、ご自由にお使いください。
ご利用の際は、出典として本ページへのリンクを記載いただけますようお願いします。

(記載例)出典:株式会社RJC「TypeScriptのユーティリティ型一覧|全22種を変換前後とエラー文で解説」

目的から選ぶ逆引き表

やりたいこと 使う型 例
更新APIで一部の項目だけ送りたい Partial + Pick Pick<T, 'id'> & Partial<Pick<T, 'title'>>
作成APIで id や日時を除きたい Omit Omit<Article, 'id' | 'createdAt'>
パスワードなど公開しない項目を除きたい Omit(つづりに注意、後述) Omit<Member, 'password'>
状態ごとのラベルを漏れなく定義したい Record + satisfies satisfies Record<Status, string>
設定値を変更できないようにしたい Readonly(浅い) Readonly<Config>
関数の戻り値を型として再利用したい ReturnType ReturnType<typeof createTask>
async 関数の結果の型がほしい Awaited + ReturnType Awaited<ReturnType<typeof fetchTask>>
ラッパー関数に同じ引数を渡したい Parameters (...args: Parameters<typeof fn>)
ユニオンから特定の形だけ取り出したい Extract Extract<Res, { ok: true }>
null を除いた型にしたい NonNullable NonNullable<User | null>
引数の片方からだけ型を決めたい NoInfer defaultValue: NoInfer<T>
イベント名 onTodo などを型で作りたい Capitalize + テンプレートリテラル型 `on${Capitalize<Status>}`

動作確認の環境と、検証の方法

TypeScript 7.0.2(npm view typescript version で確認した最新。Go で書き直されたネイティブ版)で、strict: true・target: es2022・module: nodenext として検証しました。比較用に 5.9.3 でも実行しています(Node.js 22.22.2)。

TypeScript 7.0 は 2026年7月8日に公開され、npm install -D typescript で入り、コマンド名も従来どおり tsc です。ユーティリティ型の定義は、node_modules/@typescript/typescript-linux-x64/lib/lib.es5.d.ts で22種類すべてを確認しました。

変換結果が本当にその型になるかは、次の検証用の型で確かめています。2つの型が完全に一致しないとコンパイルエラーになる仕組みです。

// src/equal.ts
export type Equal<A, B> =
  (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? true : false
export type Expect<T extends true> = T

わざと一致しない型を渡すと、次のエラーになります(検証の仕組みが働いていることの確認)。

sanity/s.ts(2,17): error TS2344: Type 'false' does not satisfy the constraint 'true'.

全22種の変換を tsc で検証したコード

下のファイルは npx tsc -p . でエラー0件でした。つまり、コメントどおりの型に変換されています。

// src/ok.ts
import type { Equal, Expect } from './equal.js'

type Task = { id: number; title: string; done?: boolean; memo: string | null }

// --- オブジェクトの形を変える ---
type T1 = Expect<Equal<Partial<Task>, { id?: number; title?: string; done?: boolean; memo?: string | null }>>
type T2 = Expect<Equal<Required<Task>, { id: number; title: string; done: boolean; memo: string | null }>>
type T3 = Expect<Equal<Readonly<Task>, { readonly id: number; readonly title: string; readonly done?: boolean; readonly memo: string | null }>>
type T4 = Expect<Equal<Pick<Task, 'id' | 'title'>, { id: number; title: string }>>
type T5 = Expect<Equal<Omit<Task, 'memo' | 'done'>, { id: number; title: string }>>
type Status = 'todo' | 'doing' | 'done'
type T6 = Expect<Equal<Record<Status, number>, { todo: number; doing: number; done: number }>>

// --- ユニオンを絞る ---
type T7 = Expect<Equal<Exclude<Status, 'done'>, 'todo' | 'doing'>>
type T8 = Expect<Equal<Extract<Status | 1 | 2, string>, Status>>
type T9 = Expect<Equal<NonNullable<string | null | undefined>, string>>

// --- 関数・クラスから取り出す ---
function createTask(title: string, priority?: number) {
  return { id: 1, title, priority: priority ?? 0 }
}
type T10 = Expect<Equal<Parameters<typeof createTask>, [title: string, priority?: number]>>
type T11 = Expect<Equal<ReturnType<typeof createTask>, { id: number; title: string; priority: number }>>
class Stock {
  constructor(public name: string, public count: number) {}
}
type T12 = Expect<Equal<ConstructorParameters<typeof Stock>, [name: string, count: number]>>
type T13 = Expect<Equal<InstanceType<typeof Stock>, Stock>>
async function fetchTask() {
  return { id: 1, title: '棚卸し' }
}
type T14 = Expect<Equal<Awaited<ReturnType<typeof fetchTask>>, { id: number; title: string }>>
type T15 = Expect<Equal<Awaited<Promise<Promise<number>>>, number>>

// --- this ---
function toLabel(this: Stock, prefix: string) {
  return `${prefix}${this.name}`
}
type T16 = Expect<Equal<ThisParameterType<typeof toLabel>, Stock>>
type T17 = Expect<Equal<OmitThisParameter<typeof toLabel>, (prefix: string) => string>>

// --- 文字列 ---
type T18 = Expect<Equal<Uppercase<'todo'>, 'TODO'>>
type T19 = Expect<Equal<Lowercase<'DONE'>, 'done'>>
type T20 = Expect<Equal<Capitalize<'title'>, 'Title'>>
type T21 = Expect<Equal<Uncapitalize<'Title'>, 'title'>>
type T22 = Expect<Equal<`on${Capitalize<Status>}`, 'onTodo' | 'onDoing' | 'onDone'>>
$ npx tsc -p .
(出力なし=エラー0件)

間違った使い方をしたときのエラー文

次のファイルは、各ユーティリティ型の「よくある間違い」を集めたものです。TypeScript 7.0.2 で実行した結果をそのまま載せています(行番号はこのファイルの行に対応)。

// src/errors.ts
type Task = { id: number; title: string; done?: boolean }

// 1. Partial:更新用にしたのに、存在しないキーを書いた
const patch: Partial<Task> = { titel: '棚卸し' }

// 2. Required:省略可能だった done が必須になる
const full: Required<Task> = { id: 1, title: '棚卸し' }

// 3. Readonly:書き換えできない
const frozen: Readonly<Task> = { id: 1, title: '棚卸し' }
frozen.title = '発注'

// 4. Record:キーの抜け
type Status = 'todo' | 'doing' | 'done'
const labels: Record<Status, string> = { todo: '未着手', doing: '作業中' }

// 5. Pick:存在しないキーはエラーになる
type P = Pick<Task, 'id' | 'name'>

// 6. Omit:存在しないキーでもエラーにならない(後述)
type O = Omit<Task, 'name'>

// 7. NonNullable
function show(v: NonNullable<string | null>) {}
show(null)

// 8. Parameters:関数でない型は渡せない
type Pa = Parameters<string>

// 9. NoInfer
function pickDefault<T extends string>(values: T[], defaultValue: NoInfer<T>) {}
pickDefault(['todo', 'doing', 'done'], 'archived')

// 10. Uppercase:文字列以外は渡せない
type U = Uppercase<123>
$ npx tsc --ignoreConfig --noEmit --strict --target es2022 --module nodenext src/errors.ts
src/errors.ts(4,32): error TS2561: Object literal may only specify known properties, but 'titel' does not exist in type 'Partial<Task>'. Did you mean to write 'title'?
src/errors.ts(7,7): error TS2741: Property 'done' is missing in type '{ id: number; title: string; }' but required in type 'Required<Task>'.
src/errors.ts(11,8): error TS2540: Cannot assign to 'title' because it is a read-only property.
src/errors.ts(15,7): error TS2741: Property 'done' is missing in type '{ todo: string; doing: string; }' but required in type 'Record<Status, string>'.
src/errors.ts(18,21): error TS2344: Type '"id" | "name"' does not satisfy the constraint 'keyof Task'.
  Type '"name"' is not assignable to type 'keyof Task'.
src/errors.ts(25,6): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string'.
src/errors.ts(28,22): error TS2344: Type 'string' does not satisfy the constraint '(...args: any) => any'.
src/errors.ts(32,40): error TS2345: Argument of type '"archived"' is not assignable to parameter of type '"doing" | "done" | "todo"'.
src/errors.ts(35,20): error TS2344: Type 'number' does not satisfy the constraint 'string'.
行 型 エラーコード 読み方と直し方
4 Partial TS2561 任意になっても知らないキーは書けない。Did you mean の候補に直す
7 Required TS2741 done が必須になった。値を足すか、Required をやめる
11 Readonly TS2540 読み取り専用。新しいオブジェクトを作る({ ...frozen, title: '発注' })
15 Record TS2741 キー done の書き漏れ。全キーの網羅を型で保証できる
18 Pick TS2344 Pick は存在しないキーをエラーにする
21 Omit エラーなし Omit は存在しないキーを受け付ける(次の章)
25 NonNullable TS2345 null を除いた型なので null は渡せない
28 Parameters TS2344 関数型以外は渡せない。値なら typeof fn を渡す
32 NoInfer TS2345 defaultValue は1つ目の配列の値だけが許される
35 Uppercase TS2344 文字列リテラル型だけを受け付ける

TypeScript 5.9.3 で同じファイルを実行すると、18行目は '"name" | "id"'、32行目は '"done" | "todo" | "doing"' と、ユニオンの並びだけが違いました。7.0 では型の並び順が安定化されたため、表示される順序が変わることがあります。エラーコードと位置は同じです。

NoInfer がないとエラーにならない

NoInfer を外すと、'archived' も T の候補として推論に使われるため、エラー0件になりました。

// src/noinfer.ts
function pickDefaultLoose<T extends string>(values: T[], defaultValue: T) {}
pickDefaultLoose(['todo', 'doing', 'done'], 'archived') // エラーにならない
$ npx tsc --ignoreConfig --noEmit --strict --target es2022 --module nodenext --lib es2022 src/noinfer.ts
(出力なし=エラー0件)

「型は1つ目の引数から決め、2つ目の引数はそれに合わせてほしい」というときに NoInfer を使います。

Omit の落とし穴:存在しないキーでもエラーにならない

lib.es5.d.ts の定義を見ると、理由がわかります。

type Pick<T, K extends keyof T> = { [P in K]: T[P] }
type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>

Pick の K は keyof T(その型のキー)に制限されていますが、Omit の K は keyof any(任意の文字列・数値・シンボル)です。そのため、つづりを間違えても何も除かれず、エラーにもなりません。

// src/omit-pitfall.ts
import type { Equal, Expect } from './equal.js'

type Member = { id: number; name: string; email: string; password: string }

// password を消したつもりが、つづりを間違えた
type PublicMember = Omit<Member, 'pasword'>

// エラーにならず、password が残っている
type Check = Expect<Equal<PublicMember, Member>>

// 対策:存在するキーしか受け付けない Omit を自作する
type StrictOmit<T, K extends keyof T> = Omit<T, K>
type PublicMember2 = StrictOmit<Member, 'pasword'>
src/omit-pitfall.ts(13,41): error TS2344: Type '"pasword"' does not satisfy the constraint 'keyof Member'.

9行目の Expect<Equal<PublicMember, Member>> が通った(エラーにならなかった)ことで、password が残っていることが確認できます。StrictOmit にすると、つづりの間違いが13行目でエラーになりました。

比較 Omit<T, K> StrictOmit<T, K>(自作)
K の制約 keyof any keyof T
存在しないキー 何も除かず通る TS2344 エラー
向いている場面 ユニオン型など、キーが型ごとに違う場合 通常のオブジェクト型(公開用の型など)

実務パターン

作成用・更新用DTO(Partial と Pick の組み合わせ)

// src/practical.ts(抜粋)
type Article = {
  id: number
  title: string
  body: string
  tags: string[]
  author: { id: number; name: string }
  createdAt: Date
  updatedAt: Date
}

// 作成用DTO:サーバーが決める項目を除く
type CreateArticleInput = Omit<Article, 'id' | 'createdAt' | 'updatedAt'>

// 更新用DTO:id は必須、編集できる項目だけ任意
type UpdateArticleInput = Pick<Article, 'id'> & Partial<Pick<Article, 'title' | 'body' | 'tags'>>

const u1: UpdateArticleInput = { id: 1, title: '新しいタイトル' } // OK
const u2: UpdateArticleInput = { title: '新しいタイトル' } // id がない
const u3: UpdateArticleInput = { id: 1, createdAt: new Date() } // 編集できない項目
src/practical.ts(21,7): error TS2322: Type '{ title: string; }' is not assignable to type 'UpdateArticleInput'.
  Property 'id' is missing in type '{ title: string; }' but required in type 'Pick<Article, "id">'.
src/practical.ts(22,41): error TS2353: Object literal may only specify known properties, and 'createdAt' does not exist in type 'UpdateArticleInput'.

Partial<Article> だけだと id まで任意になり、createdAt も送れてしまいます。「必須のキーは Pick、編集できる項目は Partial<Pick<...>>」と分けると、どちらの間違いもエラーで止まりました。

APIレスポンスの型を取り出す(Awaited・ReturnType・Extract)

type ApiResponse<T> = { ok: true; data: T } | { ok: false; error: { code: string; message: string } }

async function getArticle(id: number): Promise<ApiResponse<Article>> {
  throw new Error('省略')
}

type Res = Awaited<ReturnType<typeof getArticle>> // ApiResponse<Article>
type Data = Extract<Res, { ok: true }>['data']    // Article
type C1 = Expect<Equal<Data, Article>>            // 一致(エラー0件)

ReturnType で Promise<...> を取り出し、Awaited で中身にし、Extract で成功側だけを選ぶ、という3段の組み合わせです。関数を変更すると、使う側の型も自動で追従します。

状態ごとのラベルを漏れなく書く(Record と satisfies)

type Status = 'draft' | 'published' | 'archived'

const statusLabel = {
  draft: '下書き',
  published: '公開中',
  archived: 'アーカイブ',
} satisfies Record<Status, string>

satisfies Record<Status, string> にすると、キーの漏れはエラーにしつつ、statusLabel 自体の型は書いた値のまま保たれます。Status に値を追加したとき、ラベルの書き漏れをコンパイル時に見つけられます。

Readonly は浅い(ネストは書き換えられる)

const a: Readonly<Article> = {
  id: 1, title: 't', body: 'b', tags: [], author: { id: 1, name: '山田' },
  createdAt: new Date(), updatedAt: new Date(),
}
a.author.name = '佐藤' // エラーにならない
a.tags.push('新着') // エラーにならない

src/practical.ts 全体を型チェックした結果、エラーは上の DTO の2件だけで、この2行はエラーになりませんでした。Readonly が効くのは1段目のプロパティだけです。

自作型は短く:DeepPartial・DeepReadonly

// src/extra.ts(抜粋)
type DeepPartial<T> = T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T
type DeepReadonly<T> = T extends object ? { readonly [K in keyof T]: DeepReadonly<T[K]> } : T

type Settings = { theme: { color: string; size: number }; notify: boolean }
const s: DeepPartial<Settings> = { theme: { color: 'blue' } } // size を省略できる
const r: DeepReadonly<Settings> = { theme: { color: 'blue', size: 12 }, notify: true }
r.theme.color = 'red'
src/extra.ts(11,9): error TS2540: Cannot assign to 'color' because it is a read-only property.

ネストの中まで効かせたいときは、再帰する自作型を使います。ただし Date や Map などのクラスも「object」として展開されるため、対象の型がシンプルなデータのときに使うのが扱いやすいです。

つまずきやすいポイント

ReturnType とオーバーロード

function parse(v: string): number
function parse(v: number): string
function parse(v: string | number) { return typeof v === 'string' ? Number(v) : String(v) }

type R = Expect<Equal<ReturnType<typeof parse>, string>> // エラー0件

オーバーロードがある関数では、ReturnType と Parameters は最後の宣言(ここでは number を受け取って string を返す方)を使います。すべての戻り値の型がほしい場合は、関数の側でユニオン型を明示的に書きます。

Record のアクセスは undefined を含まない

const stock: Record<string, number> = { pen: 10 }
const n: number = stock['eraser'] // 型は number だが実際は undefined

通常の strict ではエラーになりません。--noUncheckedIndexedAccess を付けると、次のエラーで気づけました。

src/extra.ts(27,7): error TS2322: Type 'number | undefined' is not assignable to type 'number'.
  Type 'undefined' is not assignable to type 'number'.

キーが決まっているなら Record<'pen' | 'eraser', number> のようにユニオン型で書く、決まっていないなら noUncheckedIndexedAccess を有効にすると安全です。

ThisType は単体では何もしない

type Counter = { count: number }
const m: { inc(): void } & ThisType<Counter> = { inc() { this.count++; this.total++ } }
tt.ts(2,77): error TS2339: Property 'total' does not exist on type 'Counter'.

this.count は通り、Counter にない this.total はエラーになりました。

ThisType<T> は目印のための型で、交差型(&)でオブジェクトリテラルの型に付けたときだけ働きます(noImplicitThis が必要。strict に含まれます)。

ユーティリティ型のチェックリスト

チェック項目 確認
同じ形の型を手で書き直していないか(Pick / Omit で導けないか) □
公開用の型の Omit で、キーのつづりを確認したか(または StrictOmit) □
更新用DTOで id まで任意になっていないか □
Readonly がネストに効かないことを理解しているか □
async 関数には Awaited<ReturnType<...>> を使っているか □
状態の一覧を Record<Status, ...> や satisfies で網羅しているか □
Record<string, T> の読み取りで undefined を考慮しているか □
オーバーロード関数に ReturnType を使っていないか □

よくある質問

Q. Omit と Exclude の違いは何ですか? A. Omit はオブジェクト型からプロパティを除く型、Exclude はユニオン型からメンバーを除く型です。実際、Omit<T, K> は内部で Pick<T, Exclude<keyof T, K>> と定義されており、キーのユニオンに Exclude を使っています。

Q. Pick と Omit はどちらを使うべきですか? A. 残す項目が少ないなら Pick、除く項目が少ないなら Omit が読みやすくなります。ただし Pick は存在しないキーをエラーにしますが、Omit はしません。パスワードなど「確実に除きたい」項目には、Pick で残す項目を列挙するか、StrictOmit を使うと安心です。

Q. TypeScript 7 でユーティリティ型の使い方は変わりましたか? A. 22種類の定義と変換結果は変わっていません。この記事のコードは TypeScript 7.0.2 でも 5.9.3 でも同じ結果でした。違いとして、エラー文に出るユニオン型の並び順が変わることがあります。

Q. DeepPartial などは標準で用意されていませんか? A. 2026年9月時点の lib.es5.d.ts には含まれていません。必要な場合は記事中のような短い再帰型を自作するか、型ユーティリティのライブラリを使います。

まとめ

  • 組み込みユーティリティ型は22種類。よく使うのは Partial・Pick・Omit・Record・ReturnType・Awaited
  • 変換結果は Equal 型で検証でき、TypeScript 7.0.2 で全22種の変換がコメントどおりだった
  • Pick は存在しないキーをエラーにするが、Omit はしない。公開用の型では StrictOmit が安心
  • 更新用DTOは Pick<T, 'id'> & Partial<Pick<T, ...>> で、必須と任意を分ける
  • Readonly と Partial は浅い。ネストまで効かせるなら短い再帰型を自作する
  • NoInfer で「型は片方の引数から決める」を表現でき、候補外の値がエラーになる
  • API の型は Awaited<ReturnType<...>> と Extract で関数から自動で導ける

本記事の内容は、ご自由にお使いください。
ご利用の際は、出典として本ページへのリンクを記載いただけますようお願いします。

(記載例)出典:株式会社RJC「TypeScriptのユーティリティ型一覧|全22種を変換前後とエラー文で解説」

株式会社RJCでは、型を上手に使って変更に強いコードを書く工夫を、プロジェクトの中で仲間と学び合っています。こうした知識を共有しながら、日々技術を磨いています。

株式会社RJC ― SI事業・SES事業・AI駆動開発。RJCは一緒に成長を楽しめる会社です。

WE ARE HIRING

RJCで一緒に開発しながら、
成長を楽しみませんか?

RJCは、Web・モバイル・AIを活用した開発プロジェクトで、テックリードやPM・PMOも活躍するシステム開発会社です。会社を知る、待遇を確かめる、話を聞いてみる。気になるところ見てみてください!

  • 127日年間休日
  • 12時間平均残業時間
  • 毎日ガチャ遊びココロも大切にする福利厚生。アマギフなどの賞品ラインナップ!

ほかにも、チケットレストラン、書籍読み放題、2年ごとの慰労報奨(休暇 or 金一封)、11期連続の黒字決算。

ABOUT RJC RJCがどんな会社か知る 考え方、研修、働き方、福利厚生、社員の前職まで。RJCのことが丸わかり! RJC丸わかりページへ JOB DESCRIPTION 仕事内容・待遇を見てみる 仕事内容、給与・待遇、選考の流れ。経験者も未経験も!応募前に知りたいこと、まとめました! 募集要項を見る ENTRY エントリーする エントリーは1〜2分・履歴書不要です。まずは話を聞いてみたい、という方でも歓迎です! エントリーフォームへ

成長のヒミツ、 ぜんぶ丸わかり