microsoft / microsoft/TypeScript
Show function return type inlay hints even for JS functions that have explicit type annotations
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
Suggestion
🔍 Search Terms
- inlay hints
- return type
- function like
- JavaScript
⭐ Suggestion
Currently the javascript.inlayHints.functionLikeReturnTypes.enabled setting in VS Code adds inlay hints to JS functions that do not have an explicit @return annotation:
// Shown here
function foo() /* : number */ {
return 1;
}
// But not here here
/** @return {number} */
function foo() {
return 1;
}
This feels inconsistent, since I now have to look in different locations for the type information
I propose adding a new option that always enables these return types in JS files, even if there is an @return type annotation.
In the example above, this would result in the inlay hints showing on both functions:
function foo() /* : number */ {
return 1;
}
/** @return {number} */
function foo() /* : number */ {
return 1;
}
This lets me read the code more like standard TypeScript
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、既存の javascript.inlayHints.functionLikeReturnTypes.enabled 設定を追跡し、@return アノテーションが存在する場合に戻り値の型がどのように抑制されるかを確認します。新しいオプションとその設定との相互作用を定義し、その後、有効にしたときに、アノテーション付きとアノテーションなしの両方の JavaScript 関数で戻り値の型のインレイヒントが表示されることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, typescript
- 領域
- developer-experience, tooling
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100