microsoft / microsoft/TypeScript
Double error message when referencing variable of type union of string literals from ambient declaration
オープン
まだ誰も着手していません。
Domain: Error Messages
Help Wanted
Possible Improvement
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
🔎 Search Terms
double error, same message twice, ambient declaration, string literal union
🕗 Version & Regression Information
This changed between versions 3.9.7 and 4.0.5
⏯ Playground Link
💻 Code
declare const x: "a" | "b"
const y: number = x
// ~
// Type 'string' is not assignable to type 'number'.
// Type 'string' is not assignable to type 'number'. (2322)
🙁 Actual behavior
You see same error message twice
🙂 Expected behavior
The error message should be the one in 3.9.7 ie...
Type '"a" | "b"' is not assignable to type 'number'.
Type '"a"' is not assignable to type 'number'. (2322)
Or the following message just once also works...
Type 'string' is not assignable to type 'number'. (2322)
Additional information about the issue
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供された TypeScript Playground の再現から始め、診断結果を 3.9.7 および 4.0.5 で示されている動作と比較します。ambient な string-literal union を number に代入する際の、コンパイラーの型チェック診断の経路を追跡します。重複したメッセージが削除され、診断結果が期待される形式のいずれかと一致すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100