I have a string enum type like:
export enum UserRole {
admin = "admin",
active = "active",
blocked = "blocked"
}
I
Javascript does not have the concept of Enum so it's not possible, When compiling, typescript translates the enum definition to normal Javascript object that you use everyday. No information about Enum is reserved for you to inspect.
So this enum definition below
enum UserRole {
admin = "admin",
active = "active",
blocked = "blocked"
}
Will be translated to something like this
var UserRole;
(function (UserRole) {
UserRole["admin"] = "admin";
UserRole["active"] = "active";
UserRole["blocked"] = "blocked";
})(UserRole || (UserRole = {}));