typescript cast string to enum code example
Example: typescript string to enum
enum Day {
BeforeNoon = "AM",
AfterNoon = "PM"
}
var beforeNoon : string = "AM";
var enumValue : Day = (<any>Day)[beforeNoon];
enum Day {
BeforeNoon = "AM",
AfterNoon = "PM"
}
var beforeNoon : string = "AM";
var enumValue : Day = (<any>Day)[beforeNoon];