Closed
Description
π Search Terms
enum, bigint, member key
π Version & Regression Information
This is the behavior in every version I tried.
β― Playground Link
https://www.typescriptlang.org/play/?#code/KYOwrgtgBAolDeAoKKoAYRQLzsQXyA
π» Code
enum E {
0n = 0
}
π Actual behavior
Transformed to
"use strict";
var E;
(function (E) {
E[E[0n] = 0] = 0n;
})(E || (E = {}));
without error
π Expected behavior
It should throw an error "An enum member cannot have a numeric name.", similar to how we handle enum E { 0 = 0 }
. Disallowing numeric value 0
but allowing bigInt value 0n
as enum member key seems inconsistent.
Additional information about the issue
First reported in babel/babel#17331.