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

CODEBASE: Convert internal enums to const objects 1 #2001

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

catloversg
Copy link
Contributor

We discussed about using TS enum vs as const many times. Currently, there is no final decision. Personally, I'm not convinced by the idea of converting all enums to const objects. It requires meticulous effort, and the benefit, if there is any, is in theory. However, d0sboots raised a valid point at https://discord.com/channels/415207508303544321/1346890150977736747/1347139251917291594.

I feel like it would be a good idea to do a draft PR for changing CityName internally, alongside, so we can ensure that we have the whole thing fleshed out before committing to a big refactor. Although changing the internals is separable from changing the API, and the API changes look good as-is, I wouldn't want to accidentally get us stuck in a position where the API changes make the internal changes hard or impossible.

I agree with d0sboots here. We are going to change how we expose those enums to players. It's best to try converting at least 1 commonly used enum, and check if there are any problems.

In this PR, I converted CityName enum. It's used everywhere, so if there are problems, they will show up soon. This PR is based on #1998. I'll mark this PR as a draft one. After #1998 finishes, I'll mark this one as ready.

The name of this PR may be a bit weird. If we decide to convert all enums (in the future), I'll create a series of PRs. Converting all enums in a single PR is infeasible, especially for maintainers who have to review it.

@catloversg catloversg marked this pull request as draft March 6, 2025 14:49
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

Successfully merging this pull request may close these issues.

1 participant