typescript use type to define enums code example Example: enums in typescript enum Direction { Up = 1, Down, Left, Right, }