typescript enum as number code example
Example 1: enum in ts
enum Direction {
Up,
Down,
Left,
Right,
}
Example 2: typescript enum value to enum
enum Number {
One,
Two
}
const numberOne: Number = "One" as Number;
const otherNumberOne: Number = Number.One;
const stringOne = Number[Number.One];