You can emulate enums with constants: const RED = 0 const BLUE = 1 module.exports = { RED, BLUE } ---------- const { RED, BLUE } = require('./color-enum') const res = fn() if (res === RED) ....
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
You could do similar using js Symbols
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
TypeScript has Enum too
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Having static types in general is expressive
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
ASMR enums
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.