You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
enumColors{Red,Blue,Green}typeofColors.Red// `"enum"`, but it's really a stringtypeof(0,Colors.Red)// still "enum"?String.prototype.toString.call(Colors.red)// throws, because it's not a string? "Red", because it's an object boxing a real string with the right internal slots, but then it's not a primitive which means it shouldn't have its own typeof type?
In other words, if enum is a new primitive type, then I think it can't be a "string" or a "number" or a "symbol", it'd have to be something new - probably something that couldn't be coerced casually to those things.
If we stick with the enum primitive type, then I imagine String.prototype.toString.call(Colors.red) would throw (assuming enum Colors { Red = "Red", ... }), since its neither a String nor an Object with a [[StringData]] internal slot.
For example, in:
In other words, if
enum
is a new primitive type, then I think it can't be a "string" or a "number" or a "symbol", it'd have to be something new - probably something that couldn't be coerced casually to those things.#2, however, might address this.
The text was updated successfully, but these errors were encountered: