microsoft / microsoft/TypeScript
Union type in element access can prevent deprecated warning from triggering
オープン
まだ誰も着手していません。
Bug
Domain: LS: Suggestion Diagnostics
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
TypeScript Version: 4.1.0-dev.20201027
Search Terms: Deprecated tag, union, element access
Code
const foo = {
faff() { },
/** @deprecated */
fluff() { }
}
declare const k: "faff" | "fluff";
//Expected: deprecation warning
//Actual: no warning
foo?.[k]?.();
const bar = {
/** @deprecated */
faff() { },
fluff() { }
}
//Expected: deprecation warning
//Actual: deprecation warning
bar?.[k]?.();
Expected behavior:
foo?.[k]?.(); should show deprecated warning because if k is "fluff", then we'll be calling a deprecated method.
Actual behavior:
foo?.[k]?.(); has no deprecated warning.
Playground Link: Playground
Related Issues: Couldn't find any
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされている TypeScript Playground の再現コードから始め、報告された TypeScript バージョンを使って foo?.[k]?.() と bar?.[k]?.() のケースを比較します。Union キーによるオプショナルな要素アクセスに対して非推奨警告がどのように生成されるかを追跡します。foo のケースで非推奨警告が報告され、既存の bar のケースにリグレッションが発生しなければ完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 35/100