At work, when I was helping with some frontend stuff, we used object literals.
const DIRECTIONS = {
UP: "UP",
DOWN: "DOWN"
} as const;
type DIRECTIONS = typeof DIRECTIONS[keyof typeof DIRECTIONS];
Taken from option 2 in this blog post. https://maxheiber.medium.com/alternatives-to-typescript-enums-50e4c16600b1`___`
I'm not alone! Been a dev for almost 10 years and every time I declare and initialize a dictionary I either have to Google it or stare at it for a minute to realize what I'm doing wrong ๐ I blame JSON.