Skip to content
This repository was archived by the owner on May 30, 2022. It is now read-only.

mudkipme/pokeapi-v2-typescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Type definitions for PokeAPI and pokedex-promise-v2

Installation

npm install --save mudkipme/pokeapi-v2-typescript#<commit hash>

Usage

import Pokedex from "pokedex-promise-v2";

(async () => {
    const pokedex = new Pokedex();
    const species = await pokedex.getPokemonSpeciesByName("mudkip");
    const variety = species.varieties.find((speciesVariety) => speciesVariety.is_default);
    if (variety) {
        const pokemon = await pokedex.resource(variety.pokemon.url);
        const types = await Promise.all(pokemon.types.map((pokemonType) => pokedex.resource(pokemonType.type.url)));
        console.log(types.map((type) => type.names));
    }
})();

Generation (no pun intended)

npm run build

License

MIT

About

TypeScript definitions for pokedex-promise-v2 and PokeAPI endpoints.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published