I'm trying to use typescript with graphql, and their enum systems are causing some headaches for me. I'm using number indexed enums, without specifying the value on the ts enum like:
enum Enum { A }
Because graphql enums can't have numbers, I'm having a custom resolver to convert the string value to the corresponding index. For test what I'm trying to do is:
const a: Enum = Enum[Enum.A]
However, I'm getting an error of:
Type 'string' is not assignable to type 'Enum'.(2322)
I'm sort of getting the logic behind, because in [] I could put key that doesn't exist on the enum, but the key itself is the enum itself, so it should be enough confidence for it to return the enum, not just string. And because Object.values(Enum) is returning both the keys, and values, getting the key should still be enum.
Are there any workarounds for this?
