#Typescript numeric enum is messed up

6 messages · Page 1 of 1 (latest)

brave zephyr
#

Typescript enums with numeric values are effed:

enum Values {
  A = 1,
  B = 2,
}

Is there a way to make them behave like enums made of strings? Or am I missing something? I want to assign explicit number values becasue they're reflected in the database with specific values

#

oh wait, only string enums are non-effed. enums without values are effed too

#
  A,
  B
}```
#

I see https://www.npmjs.com/package/enum-for to deal with this effed-ness

wide belfry
#

There's not really any benefit to using enums