When working with enum types, such as the one shown below:
enum Days {Sun, Mon, Tue, Wed, Thu, Fri, Sat};
The code actually gets parsed like this:
var Days;
(function (Days) {
Days[Days["Sun"] = 0] = "Sun";
Days[Days["Mon"] = 1] = "Mon";
Days[Days["Tue"] = 2] = "Tue";
Days[Days["Wed"] = 3] = "Wed";
Days[Days["Thu"] = 4] = "Thu";
Days[Days["Fri"] = 5] = "Fri";
Days[Days["Sat"] = 6] = "Sat";
})(Days || (Days = {}));
A common question arises regarding whether Days["Sun"] = 0
results in 0 and Days["Mon"] = 1
. Let's explore this further. Thank you.