Wednesday, August 21, 2013

TypeScript v0.9 enum bug

/*
Update, after upgrading to v.0.9.1 it works as it should!
*/

I think I found a bug in the TypeScript enum. in the below example the WindeDirections.None should automatically be assigned the value 4, but it's actually 0.

TypeScript code
enum WindeDirections {
    North = 0,
    South = 1,
    West = 2,
    East = 3,
    None      
}

compiled code:
var WindeDirections;
(function (WindeDirections) {
    WindeDirections[WindeDirections["North"] = 0] = "North";
    WindeDirections[WindeDirections["South"] = 1] = "South";
    WindeDirections[WindeDirections["West"] = 2] = "West";
    WindeDirections[WindeDirections["East"] = 3] = "East";

    WindeDirections[WindeDirections["None"] = 0] = "None";
})(WindeDirections || (WindeDirections = {}));

I will write about TypeScript enum in details later :-)



1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from TypeScript Training in Chennai . or learn thru Javascript Online Training from India. Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Training in Chennai

    ReplyDelete