question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

proposal:symbol enum

See original GitHub issue

I want symbol enum.

syntax example:

symbol enum Example{
  X,Y,Z
}

var Example;
(function (Example) {
    Example[Example["X"] = new Symbol("X")] = "X";
    Example[Example["Y"] = new Symbol("Y")] = "Y";
    Example[Example["Z"] = new Symbol("Z")] = "Z";
})(Example || (Example = {}));

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:18
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

16reactions
fbarthocommented, Jan 18, 2018

Not to bikeshed, but wouldn’t a more consistent syntax be:

enum Example: Symbol {
  X,Y,Z
}
// or
enum Example<Symbol> {
  X,Y,Z
}

Rather than introducing a new keyword of symbol these options either use inheritance style, or Generics, and would pave the way for arbitrary-valued enums?

9reactions
DanielRamosAcostacommented, Jun 27, 2018

This would be very useful with Redux actions…

Read more comments on GitHub >

github_iconTop Results From Across the Web

proposal-enum/README.md at master · rbuckton/proposal-enum ...
@@formatEnum, "Symbol.formatEnum", A method of an enum object that is used to convert a value into a string representation based on the member...
Read more >
enum to string in modern C++11 / C++14 / C++17 and future C ...
Magic Enum header-only library provides static reflection for enums (to string, from string, iteration) for C++17. #include <magic_enum.hpp> enum Color ...
Read more >
A class-based enum pattern for JavaScript - 2ality
In this blog post, we examine a pattern for implementing enums in JavaScript that is based on classes. We'll also take a look...
Read more >
Python Power Tip: Enumerated Types - Towards Data Science
The result was PEP 435, a proposal to add a new enum module to the ... If you accidentally add more than one...
Read more >
UITableViewDropProposal.Intent - Documentation
Enumeration. UITableViewDropProposal.Intent. Constants indicating how you intend to handle a drop. iOS 11.0+ iPadOS 11.0+ Mac Catalyst 13.1+. Declaration.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found