microsoft / microsoft/TypeScript
Default type parameter values always shown on hover
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
🔎 Search Terms
default parameters hover
🕗 Version & Regression Information
- This is the behavior in every version I tried
⏯ Playground Link
💻 Code
export abstract class Kind<
hkt extends (...args: any[]) => unknown = (...args: any[]) => unknown
> {
declare readonly args: unknown
abstract readonly hkt: hkt
}
// Hover: Kind<(...args: any[]) => unknown>
type SomeHkt = Kind
🙁 Actual behavior
Kind's defaulted parameter is displayed on hover.
🙂 Expected behavior
Defaultable generic parameters should not be printed if they are unset in the instantiation and/or explicitly set to their default value.
This could also apply to .d.ts, although that's viewed less often.
Additional information about the issue
This is obviously not a bug but a request that would help reduce visual clutter for many types. Types with several parameters with non trivial default values are relatively common, especially when those defaults are expanded recursively.
It also occurred to me that when combined with autofixes, this could also make types written to a user file much more usable. When using --isolatedDeclarations, one of the biggest problems with the autofixes is that they'd often pull in types with several generic parameters with long defaults, and end up writing some massive type instead of just a single identifier.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
ソースファイルもテストも指定されていません。リンクされた TypeScript Playground から始めて SomeHkt のホバーを確認し、その後、ジェネリック型パラメーターをフォーマットするコンパイラーパスを追跡してください。未設定の場合、または明示的にデフォルト値と等しい場合にデフォルト値付きパラメーターが省略され、記載された .d.ts および isolatedDeclarations のケースも含まれることが完了の条件です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers, developer-experience
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100