🔎 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
🙁 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.