lokshunhung / pokeapi-types

19 stars 0 forks source link

idea: Adding all the possible sprites to the PokemonSprite -type #609

Closed sakuexe closed 1 year ago

sakuexe commented 1 year ago

Hi, thank you for making this package, it has been so nice and easy to use and has really helped me on my current project.

I was thinking though if it was possible to add all the possible sprites currently in the pokapi to the typings of singular pokemon. Currently the package provides the following:

    front_default: string;
    front_shiny: string;
    front_female: string;
    front_shiny_female: string;
    back_default: string;
    back_shiny: string;
    back_female: string;
    back_shiny_female: string;

While the API provides the following objects as well:

   other: dream_world, home, official-artwork
   versions: generational sprites

Would there be a chance of getting these types into the package too? I extending the types in my current project to include the official artwork and I would be interested in helping with this by adding these types and making a pull request if needed!

Once again, thank you for this package.

lokshunhung commented 1 year ago

Hi @sakuexe thank you for your interest 😄 It's been a while since I last looked at PokeAPI, and I think at the time of making this package, I just defined whatever that is available in the documentation (Pokemon > Pokemon > PokemonSprites) in the types.

You're right, I just checked the example response in the Pokemon endpoint showed there is sprites.other and sprites.versions, but it seems they are not documented, so that's probably why I missed them.

Would you happen to know if sprites.other and sprites.versions have defined keys, or is it better to specify these keys to have type Record<string, string | undefined> so it acts as a catch-all and would work for any keys? (i.e. sprites.dream_world.front_default and sprites.dream_world.any_key_would_work_the_same_here both returns the type string | undefined)

sakuexe commented 1 year ago

That would sound very good to me, since the sprite.other values seem to differ quite a bit. Using them as string | undefined or string | null would most definitely do the job nicely in my opinion!

Thank you for still listening to my idea on this project even when it has been a while ago!

lokshunhung commented 1 year ago

@sakuexe You can find the change at version 0.0.2 :)

sakuexe commented 1 year ago

Thank you very much! I appreciate this a lot! 😊