get enum value by name typescript code example Example: enum in ts enum Direction { Up, Down, Left, Right, }