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

Avoid mutating ?? true to && true #3395

Closed
nicojs opened this issue Jan 28, 2022 · 3 comments
Closed

Avoid mutating ?? true to && true #3395

nicojs opened this issue Jan 28, 2022 · 3 comments
Labels
🐛 Bug Something isn't working

Comments

@nicojs
Copy link
Member

nicojs commented Jan 28, 2022

Summary

image

The above mutation always survives, we should not make it. I think.

Similar to #3339

@nicojs nicojs added the 🐛 Bug Something isn't working label Jan 28, 2022
@nicojs
Copy link
Member Author

nicojs commented Jan 28, 2022

@edi9999 maybe you want a go at this one again 😅

@nicojs
Copy link
Member Author

nicojs commented Jan 28, 2022

Never mind. It's getting late I think. This is clearly not a mutation that always survives.

@nicojs nicojs closed this as completed Jan 28, 2022
@edi9999
Copy link
Contributor

edi9999 commented Jan 28, 2022

?? can be converted to && in some occasions and change the behavior.

If for example I have this code :

function xxx(options) {
    const param = options.param ?? true;
    return param;
}

If I call xxx({param: 10}) it would return 10 before the mutation and true after the mutation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants