microsoft / microsoft/TypeScript
Destructuring or bracket notation on `never` shouldn't be allowed
オープン
まだ誰も着手していません。
Awaiting More Feedback
Suggestion
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
Bug Report
You can destructure or use bracket notation on never type, but you can't access props using the dot notation. It should disallow all forms of property access.
🔎 Search Terms
never destructuring destructure bracket dot notation
🕗 Version & Regression Information
⏯ Playground Link
🙁 Actual behavior
const { prop } = ({} as never); // does not error
const prop2 = ({} as never)["prop"]; // does not error
🙂 Expected behavior
TS should not allow this, same as you can't access props using the dot notation:
const prop = ({} as never).prop; // error
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされている TypeScript Playground の例から始め、never としてアサートされた値に対するプロパティアクセス、ブラケット記法、分割代入を比較してください。コンパイラーがこれら 3 つの形式をどのように処理するかを追跡し、それぞれが一貫して拒否されるように回帰テストを追加または更新してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100