D
Deno

help

TypeScript enums

DDoctor10/31/2022
So enums are objects with all keys being values and values being keys. Most of the time when using enums though, I place a specific enum, so knowing exactly what the value will be there. Is there a way to instead of referring to the object to get to the value, it just hard codes the value when bundling from ts to js?
UUUnknown User10/31/2022
Message Not Public
Sign In & Join Server To View
DDoctor10/31/2022
It didn’t provide anything new. What I want to do is
enum Direction {
North,
East,
South,
West
}

console.log(Direction.North)
enum Direction {
North,
East,
South,
West
}

console.log(Direction.North)
What I want it to do when bundling to js is
console.log(0)
console.log(0)
UUUnknown User10/31/2022
Message Not Public
Sign In & Join Server To View
DDoctor10/31/2022
Oh my bad. Thanks.

Looking for more? Join the community!