I was wondering about how typescript would compile an enumeration into a javascript code. So I implemented the following example:
enum Contagens {
UM,
DOIS,
TRES
}
And it was compiled into this:
"use strict";
var Contagens;
(function (Contagens) {
Contagens[Contagens["UM"] = 0] = "UM";
Contagens[Contagens["DOIS"] = 1] = "DOIS";
Contagens[Contagens["TRES"] = 2] = "TRES";
})(Contagens || (Contagens = {}));
But, I don't understand how it works... someone could explain this code to me?