-
Notifications
You must be signed in to change notification settings - Fork 3
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: Improve typings #11
base: main
Are you sure you want to change the base?
Conversation
531ea0e
to
1d96f45
Compare
525f61c
to
e14d4f6
Compare
So the Readme changes obviously make sense. I'm conflicted on the typings, because they're closely related to the typings over at https://api.hearthstonejson.com/v1/enums.d.ts and I don't really want to maintain updating this library every single time they change. We've also internally seen that it's usually really helpful to just the same language the game does (e.g. "CORE" over "Basic") to reduce confusion. As a library consumer why write In any case the library is also a client library that will load metadata at runtime. It's entirely possible you call |
Besides, using an enum is better for refactoring this library's consumers, I think. Instead of having the codebase littered with somewhat magical looking strings, you'd have a proper enum that you can search for :)
That's understandable. There are 3 enums likely to change with every expansion - |
@beheh what do you think? |
Sorry for the delayed response. I'm not a huge fan of strictly typing these things here, as they do change over time and in the org we have a better way of managing those (enums.d.ts on hearthstonejson) as we don't check for updates to this library every patch. I also think the optional types should only be very cautiously removed. I'm aware of a few weird helper cards in the db that are missing some of these fields, and at the end of day they are just derived from a plain XML file that could probably omit all fields but the card id. |
62ec6c1
to
b3d612c
Compare
Locale
typeCardData
required fieldsREADME
code exampleThis change is