microsoft / microsoft/TypeScript
Too wide diagnostic with array spread
オープン
まだ誰も着手していません。
Bug
Domain: Related Error Spans
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
🔎 Search Terms
array spread, diagnostics
🕗 Version & Regression Information
- This is the behavior in every version I tried and I have reviewed the FAQ
⏯ Playground Link
💻 Code
type Abc = "a" | "b" | "c";
const array1: Abc[] = ["a", "b"];
const array2: Abc[] = [
...array1,
"a",
"b",
"d",
]
🙁 Actual behavior
The whole contents of array2 is highlighted in red.
🙂 Expected behavior
Only the "d" should be highlighted in red, as it is the only incorrect part of array2. Note that if we remove the spread ...array1, then it works as expected.
Additional information about the issue
With more complicated types/data, this bug can make it pretty hard to diagnose where the problem is.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた TypeScript Playground の再現例と、issue の array-spread の例から始めます。配列リテラルに対してどのように診断が生成されるかを追跡し、その後、spread と有効な要素はハイライトされず、"d" 要素だけがハイライトされることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100