microsoft / microsoft/TypeScript
types 'new (...args: any) => E' and wrapper types constructor for primitive types have no overlap
オープン
まだ誰も着手していません。
Bug
Domain: check: Control Flow
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
TypeScript Version: 3.8.3
Code
class TreeSet<E> {
constructor(elementType: new(...args: any) => E) {
if (elementType === Number) { //This condition will always return 'false' since the types 'new (...args: any) => E' and 'NumberConstructor' have no overlap.(2367)
console.log("hello")
}
}
}
new TreeSet(Number)
Actual behavior:
The error is prompted at compile time "This condition will always return 'false' since the types 'new (...args: any) => E' and 'NumberConstructor' have no overlap.(2367)" but compiled code actually runs correctly.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
TypeScript 3.8.3 playground の再現と、issue に示されている TreeSet コンストラクターの比較から始めてください。ジェネリックコンストラクター型と NumberConstructor の比較に対するコンパイラーの診断を追跡し、続いて提供された例に対して動作を検証して、誤検出の診断が表示されなくなっていることを確認してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100