microsoft / microsoft/TypeScript
NoInfer breaks discriminate union autocomplete
オープン
まだ誰も着手していません。
Experience Enhancement
Suggestion
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
🔎 Search Terms
no infer discriminate union
🕗 Version & Regression Information
Tested on version 5.6.3
⏯ Playground Link
💻 Code
interface A {
type: 'a',
value: string;
}
interface B {
type: 'b',
size: number;
}
type Union = A | B;
function accept<T extends Union>(union: NoInfer<T>) {
}
accept({type: 'a'})
🙁 Actual behavior
When trying to autocomplete after writing type a the autocomplete doesn't work (but the result does get type checked):
🙂 Expected behavior
Even with NoInfer it should autocomplete the other properties of the "inferred" discriminate union case as it correctly type checks it if written wrong.
Additional information about the issue
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされている TypeScript Playground の再現から始め、NoInfer と判別可能なユニオンに対する既存の型チェック結果とオートコンプリートの動作を比較してください。type 'a' を入力した後に、選択されたユニオンケースの残りのプロパティが提示され、誤った値が引き続き拒否されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 45/100