Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on All JavaScript and TypeScript features of the last 3 years explained. Parent comment
It's better just to use an actual array for enums:
myEnum = ["E1", "E2"...] as const
type myEnum = typeof myEnum[number]
That gets you both an enum type and an enum array you can use at runtime
There are no comments on this comment yet.
It's better just to use an actual array for enums:
myEnum = ["E1", "E2"...] as const
type myEnum = typeof myEnum[number]
That gets you both an enum type and an enum array you can use at runtime