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

refactor(jsonc): replace enum with string union type #3837

Merged
merged 5 commits into from
Nov 23, 2023

Conversation

realpha
Copy link
Contributor

@realpha realpha commented Nov 22, 2023

This PR replaces the used typescript enum in the jsonc module with a
const object as requested here.

As this enum is only used internally, merging this change wouldn't constitute a
breaking change.

This change seems a little bit clunky but does the trick.

@realpha realpha requested a review from kt3k as a code owner November 22, 2023 21:49
@github-actions github-actions bot added the jsonc label Nov 22, 2023
Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would changing TokenType to a union type make more sense in this case?

@realpha
Copy link
Contributor Author

realpha commented Nov 22, 2023

Would changing TokenType to a union type make more sense in this case?

IMO yes. Wasn't sure if the convetion in the codebase in general is to prefer maps over simple string unions.

Will push the changes

jsonc/parse.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you.

@iuioiua iuioiua changed the title chore: replace enum in jsonc module refactor(jsonc): replace enum with string union type Nov 23, 2023
@iuioiua iuioiua merged commit 0a5429e into denoland:main Nov 23, 2023
11 checks passed
realpha added a commit to realpha/deno_std that referenced this pull request Nov 24, 2023
* feat(jsonc): replace TokenType enum with const object

* refactor(jsonc): TokenType is now a union based upon TokenTypeMap

* refactor(jsonc): TokenType enum to string literal union
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants