microsoft / microsoft/TypeScript
Enum declarations should consistently disallow computed keys
オープン
まだ誰も着手していません。
Bug
Domain: Error Messages
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
Bug Report
🔎 Search Terms
Computed property names are not allowed in enumsenum declaration computed
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about enums
⏯ Playground Link
Playground link with relevant code
💻 Code
let y = "y";
type z = "z";
enum Foo {
['x'],
[{}],
[y],
[z]
}
🙁 Actual behavior
TS reports Computed property names are not allowed in enums. for [{}], [y] and [z], while it allows ['x'] (in contraddiction with the error message).
🙂 Expected behavior
All of them should be an error, for the reason reported by the error.
📚 Context
This came up at https://github.com/babel/babel/issues/12683: we can implement the current TS behavior in Babel, but I'd first like to check if TS is expected to report an error for ['x'].
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた TypeScript Playground の動作を、['x']、[{}]、[y]、[z] を使った enum のサンプルで再現する。その例の enum の計算プロパティ診断を追跡する。完了条件は、4 つすべての宣言が一貫して報告されたエラーを生成し、示されたケースをカバーすることである。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 35/100