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

Improve node enum support #6423

Open
FloVanGH opened this issue Oct 1, 2024 · 0 comments
Open

Improve node enum support #6423

FloVanGH opened this issue Oct 1, 2024 · 0 comments
Labels
a:language-javascript JavaScript bindings (mF,bS) enhancement New feature or request

Comments

@FloVanGH
Copy link
Member

FloVanGH commented Oct 1, 2024

          I think this is the correct approach.

As a follow-up (not in this PR), I think we should also place the enums with their values into the module object returned by loadFile. That way the developer gets code completion support and it will match the string enum typescript type declarations of the future (future type safety).

We do the same for structs in the Python port and it works quite well there.

In terms of user experience: it's good to get an error that "Ap" is not a valid value for the enum "Direction", but it would be even better if the diagnosis would include the valid options. That way it's easy to spot typos and figure out how to correct them. The Rust compiler does a great job at that. Another option would be to compute the Levenshtein distance and suggest the nearest match.

Originally posted by @tronical in #6421 (review)

@FloVanGH FloVanGH added a:language-javascript JavaScript bindings (mF,bS) enhancement New feature or request labels Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:language-javascript JavaScript bindings (mF,bS) enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant