Skip to content

Invalid async/await call #38

@philipjonsen

Description

@philipjonsen

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions