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
-
-
-
New movie title: The Boolean is not enough :D
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
OCaml too, and TypeScript. You must handle all possible return states or compiler will complain
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.