microsoft / microsoft/TypeScript
raise a type error on attempt to strict-equal-compare a value of string | null to undefined
オープン
まだ誰も着手していません。
Awaiting More Feedback
Suggestion
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
the following examples are almost certainly bugs:
declare var one: string | undefined;
// expected a type error: Operator '===' cannot be applied to types 'string | undefined' and 'null'
// actual no problem
if (one === null) {
// unreachable, because one can't ever be null, undefined was likely meant instead
}
declare var another: string | null;
// expected a type error: Operator '===' cannot be applied to types 'string | null' and 'undefined'
// actual no problem
if (another === undefined) {
// unreachable, because one can't ever be undefined, null was likely meant instead
}
consider raising a type error for the above situations
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、issue にある 2 つの TypeScript の例を再現し、文字列ユニオンと null または undefined を含む厳密等価比較に対するコンパイラーの型チェック動作を調査します。両方の不可能な比較で型エラーが発生し、有効な比較は引き続き受け入れられれば完了です。payload にはソースファイルもテストも記載されていません。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100