Skip to content

Convert enums to {[key]: string} dicts #155

@appsforartists

Description

@appsforartists

I've been undecided on how to represent constants in this project. In a pure JS project, I'd write code like this:

const ThresholdSide = {
  ABOVE: 'above',
  BELOW: 'below',
};

However, since TypeScript provides built-in enums, I've been tempted to use those (and probably have in certain places):

enum ThresholdSide {
  ABOVE,
  BELOW,
}

My concern is that TS enums desugar to numbers like 0 and 1, which are meaningless when you log them and non-obvious to JavaScript users.

In the interests of author ergonomics, I need to audit all the uses of enum and convert them to Dict<string> where appropriate.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions