Microsoft/TypeScript

ReferenceError caused by const enum

Open

#55,212 opened on 2023幎7月31日

GitHub で芋る
 (2 comments) (0 reactions) (0 assignees)TypeScript (6,726 forks)batch import
BugDomain: enumHelp Wanted

Repository metrics

Stars
 (48,455 stars)
PR merge metrics
 (平均マヌゞ 6d 17h) (30d で 9 merged PRs)

説明

Bug Report

🔎 Search Terms

  • const enum

🕗 Version & Regression Information

  • This is a runtime crash
  • This changed between versions 4.4.4 and 4.3.5
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
  • I was unable to test this on prior versions because _________

⏯ Playground Link

Playground link with relevant code

💻 Code

const enum Foo {
    a = 1,
}

console.log(Foo["1"])

🙁 Actual behavior

console.log(Foo["1"]);

🙂 Expected behavior

console.log("a");

or report error.

コントリビュヌタヌガむド