Microsoft/TypeScript

ReferenceError caused by const enum

Open

#55,212 创建于 2023年7月31日

在 GitHub 查看
 (2 评论) (0 反应) (0 负责人)TypeScript (6,726 fork)batch import
BugDomain: enumHelp Wanted

仓库指标

Star
 (48,455 star)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 9 个 PR)

描述

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.

贡献者指南