CODEBASE: Convert internal enums to const objects 1 #2001
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 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.