-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Closed
Labels
Milestone
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.
Reactions are currently unavailable