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

Invalid async/await call #38

Open
philipjonsen opened this issue Sep 13, 2023 · 0 comments
Open

Invalid async/await call #38

philipjonsen opened this issue Sep 13, 2023 · 0 comments

Comments

@philipjonsen
Copy link

DESCRIPTION

Detected awaiting a value that is not a "Thenable" (an object which has a then method, such as a Promise).

While it is valid JavaScript to await a non-Promise-like value (it will resolve immediately), this pattern is often a programmer error, such as forgetting to add parenthesis to call a function that returns a Promise.

BAD PRACTICE

await 'value';

const createValue = () => 'value';
await createValue();

RECOMMENDED

await Promise.resolve('value');

const createValue = async () => 'value';
await createValue();

Look here: Unexpected await of a non-Promise (non-"Thenable") value
src/implementations/deterministic/mnemonic-phrase.spec.ts

});

it('creates mnemonic correctly', async () => {
const mnemonic = await MnemonicPhrase.create();
return expect(mnemonic.mnemonicPhrase).toEqual(fMnemonicPhrase);
});

Give star and donate for my work :)

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