Microsoft/TypeScript
GitHub ã§èŠãEnum value `1 / 0` incorrectly transformed if there is `Infinity` declared in scope
Open
#55,091 opened on 2023幎7æ20æ¥
BugDomain: enumFix AvailableHelp Wanted
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
Bug Report
ð Search Terms
infinity enum variable let shadow
ð Version & Regression Information
Every version I tested
⯠Playground Link
Playground link with relevant code
ð» Code
{
let Infinity = 3;
enum A {
X = 1 / 0
}
console.log(A.X)
}
ð Actual behavior
{
let Infinity = 3;
let A;
(function (A) {
A[A["X"] = Infinity] = "X";
})(A || (A = {}));
console.log(A.X);
}
and logs 3
ð Expected behavior
It should log the result of 1 / 0, which is Infinity.
Somewhat related to https://github.com/microsoft/TypeScript/issues/54981.