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

Type conversion on default values is destructive #94

Closed
marcoscaceres opened this issue Oct 26, 2017 · 4 comments
Closed

Type conversion on default values is destructive #94

marcoscaceres opened this issue Oct 26, 2017 · 4 comments

Comments

@marcoscaceres
Copy link
Member

Given

interface X {
  const unsigned long BIT_MASK = 0x0000fc00;
}

Becomes:

"{
  "type": "number",
  "value": 64512
}"

I think the only fix here is not to do the number conversion.

@saschanaz, thoughts?

marcoscaceres added a commit that referenced this issue Oct 26, 2017
@saschanaz
Copy link
Member

👍

{
  "type": "number",
  "value": 64512,
  "raw": "0x0000fc00"
}

Alternatively we can add base: 16 thing but that won't recover preceding zeros, which may be a problem in some situation.

@marcoscaceres
Copy link
Member Author

I like the “raw” member, but I’m still not entirely sure of the use case for doing the conversion during parse. It seems that if a consumer has type “number” and “value”, they can perform the conversion themselves.

@marcoscaceres
Copy link
Member Author

Apologies, I see you answered the above in the PR. 🙏

@saschanaz
Copy link
Member

Yeah, the conversion is reasonably easy so it shouldn't be a big issue for users who uses the resulting number value for whatever reason.

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

2 participants