Gabb-c/pokenode-ts

Add others interface to pokemon sprites interface

Closed this issue · 5 comments

Describe the feature you'd like to request

I like using your lib for my pet project but I can't use other world images via sprites. in sprites interface there are not have any others sprites.Cause of that I add other type to Sprites interface

Describe the solution you'd like

Add some columns to sprites interface

Describe alternatives you've considered

add others?:[] to sprites interface

Hey @athamov , thanks for your input!
Will be fixed soon in the next release.

Thanks @athamov for your contribution to Pokenode-ts!
Fixed in v1.16.1

DivoK commented

Hey @Gabb-c, I think the typing you added is incorrect: while the other field is optional, its value is not an array but an object (like before this fix). Here's the output from the official API docs (can confirm its updated, I re-ran the query myself):

"sprites": {
    "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/35.png",
    "back_female": null,
    "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/35.png",
    "back_shiny_female": null,
    "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/35.png",
    "front_female": null,
    "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/35.png",
    "front_shiny_female": null,
    "other": {
        "dream_world": {
            "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/dream-world/35.svg",
            "front_female": null
        },
        "home": {
            "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/home/35.png",
            "front_female": null,
            "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/home/shiny/35.png",
            "front_shiny_female": null
        },
        "official-artwork": {
            "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/35.png"
        }
    },
    "versions": {
        ...
    }
},

I can issue a PR that removes the array notation ([]) if you'd like, but I assume it's best you'll double check that I'm not wrong myself 😄
Thanks for the awesome work btw!

@DivoK, I guess you're right. I checked with a few Pokemons.
Will revert the changes and release the fix.

Fixed in 1.17.0