pokenode-ts icon indicating copy to clipboard operation
pokenode-ts copied to clipboard

Usage of await + .then in documentation

Open robert-westenberger opened this issue 4 months ago • 0 comments

Version of Pokenode-ts

1.20.0

Node.js Version

20.16.0

Operating System

macOs

Bug Description

This isn't really a bug, more of a question. Why mix await and .then? Seems like an oversight.

Expected Behavior

Just use await, theres no reason to mix await and .then

Steps to Reproduce

Look at the documentation here https://pokenode-ts.vercel.app/guides/getting-started#basic-example

import { PokemonClient } from 'pokenode-ts';

(async () => {
  const api = new PokemonClient();

  await api
    .getPokemonByName('luxray')
    .then((data) => console.log(data.name)) // will output "Luxray"
    .catch((error) => console.error(error));
})();
import { MainClient } from 'pokenode-ts';

(async () => {
  const api = new MainClient();

  await api.pokemon
    .getPokemonByName('luxray')
    .then((data) => console.log(data.name)) // will output "Luxray"
    .catch((error) => console.error(error));
})();

robert-westenberger avatar Oct 04 '24 16:10 robert-westenberger