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

Functions with union Promised return types "Promise<void> | void" will fail eslint checks. #67

Closed
RonaldZielaznicki opened this issue May 21, 2023 · 1 comment

Comments

@RonaldZielaznicki
Copy link

ESlint is not able to handle conditional returns like this in terms of awaiting.

Looks like folks over at typescript-eslint suggest to always mark functions that can return a promise with async, even if it returns immediately.

typescript-eslint/typescript-eslint#6421

Ran into this problem when awaiting drain, eslint threw back this error in response.

Unexpected `await` of a non-Promise (non-"Thenable") value. [Error/@typescript-eslint/await-thenable]
Placing a void expression inside another expression is forbidden. Move it to its own statement instead. [Error/@typescript-eslint/no-confusing-void-expression]
@RonaldZielaznicki
Copy link
Author

After some more digging, I found the PR comment that notes that this is intended.

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