Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enum values should be objects #86

Closed
marcoscaceres opened this issue Oct 17, 2017 · 0 comments
Closed

Enum values should be objects #86

marcoscaceres opened this issue Oct 17, 2017 · 0 comments

Comments

@marcoscaceres
Copy link
Member

marcoscaceres commented Oct 17, 2017

Given:

enum Things {
    "foo",
    "bar"
};

Enum values current result in,

[
  {
    "type": "ws",
    "value": "\n          "
  },
  "foo",
  {
    "type": ","
  },
  {
    "type": "ws",
    "value": "\n          "
  },
  "bar",
  {
    "type": "ws",
    "value": "\n        "
  }
]

This switching of types makes things really inconsistent. Would have expected an Object like:

  {
    "type": "enum-value",
    "value": "foo",
  }

And maybe, for compat:

  {
    "type": "enum-value",
    "value": "foo",
    toString(){
       return this.value;
    }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant