typescript
Представление enum в качестве ключей объекта:
enum Direction { Up = 1, Down, Left, Right, } let b: Direction = 4; b = 3; b = 5; type Some2 = keyof typeof Direction; let c: Some2 = 'Down' type Some = { [key in keyof typeof Direction]: any[] }; let a: Some = { Left: [], Down: [], Up: [], Right: [], } a[Direction.Left] = [1]; a['Left'] = [5] a.Left = [6] console.log(a.Left)
(ваш голос учтен)