Skip to content
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

Usage of await + .then in documentation #1232

Open
robert-westenberger opened this issue Oct 4, 2024 · 0 comments
Open

Usage of await + .then in documentation #1232

robert-westenberger opened this issue Oct 4, 2024 · 0 comments

Comments

@robert-westenberger
Copy link

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));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant