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

Error when treating a Promise as a boolean #35435

Closed
bs85 opened this issue Dec 1, 2019 · 1 comment
Closed

Error when treating a Promise as a boolean #35435

bs85 opened this issue Dec 1, 2019 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@bs85
Copy link

bs85 commented Dec 1, 2019

Treating a Promise as a boolean in an if block is currently allowed. Given that it'll always be trueish, I don't think the pattern has any legitimate use.

Turning it into an error would be really useful in code using async validation / assertion functions, e.g.:

// always true
if (checkOwnership(subject, account)) {

// should be
if (await checkOwnership(subject, account)) {
@MartinJohns
Copy link
Contributor

Please respect the issue template for bug reports and the issue template for feature requests.


This is a duplicate of #34717.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants