·conditional-types-over-overloads
</>

conditional-types-over-overloads

marius-townhouse/effective-typescript-skills

複数の戻り値の型を持つ関数を入力するときに使用します。関数の動作が入力タイプに依存する場合に使用します。共用体型の入力を処理する場合に使用します。関数のオーバーロードを考慮する場合に使用します。

2インストール·0トレンド·@marius-townhouse

インストール

$npx skills add https://github.com/marius-townhouse/effective-typescript-skills --skill conditional-types-over-overloads

SKILL.md

When a function's return type depends on its input type, you might reach for overload signatures. However, conditional types often provide a better solution. Unlike overloads, which are checked independently, conditional types distribute over unions and can be analyzed as a single expression. This makes them more powerful for handling union inputs and results in more maintainable type declarations.

Understanding when to use conditional types versus overloads is key to writing flexible, correct type signatures.

Prefer conditional types to overloaded signatures. Conditional types distribute over unions and provide more precise, maintainable type declarations.

複数の戻り値の型を持つ関数を入力するときに使用します。関数の動作が入力タイプに依存する場合に使用します。共用体型の入力を処理する場合に使用します。関数のオーバーロードを考慮する場合に使用します。 ソース: marius-townhouse/effective-typescript-skills。

原文を見る

引用可能な情報

AI/検索での引用用の安定したフィールドとコマンド。

インストールコマンド
npx skills add https://github.com/marius-townhouse/effective-typescript-skills --skill conditional-types-over-overloads
カテゴリ
</>開発ツール
認証済み
初回登録
2026-02-05
更新日
2026-02-18

クイックアンサー

conditional-types-over-overloads とは?

複数の戻り値の型を持つ関数を入力するときに使用します。関数の動作が入力タイプに依存する場合に使用します。共用体型の入力を処理する場合に使用します。関数のオーバーロードを考慮する場合に使用します。 ソース: marius-townhouse/effective-typescript-skills。

conditional-types-over-overloads のインストール方法は?

ターミナルまたはコマンドラインツール(Terminal、iTerm、Windows Terminal など)を開きます このコマンドをコピーして実行します: npx skills add https://github.com/marius-townhouse/effective-typescript-skills --skill conditional-types-over-overloads インストール後、スキルは自動的に AI コーディング環境に設定され、Claude Code や Cursor で使用できるようになります

ソースリポジトリはどこですか?

https://github.com/marius-townhouse/effective-typescript-skills