-
Notifications
You must be signed in to change notification settings - Fork 1
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
What about destructuring? #2
Comments
Good question. One alternative is "like destructuring", where you can't do multiple of Here, you'd probably want to be able to specify each binding separately. Perhaps: function f({ const foo, notConst, bar: { const xyz } }) {
} But I suspect that going that route would require changing object destructuring itself, for consistency. It might still be worth it. |
Is that actually desirable? I feel like it would work as similar to const variable declarations as possible, i.e. function f(const { your, destructured, properties }) {
} |
@Fishrock123 I think that it should work like regular destructuring, which indeed would require that example: ie, |
It seems like there would be a simple workaround for this -- the user could just not use destructuring if they want only some of the destructured parameters to be function f({ const foo, notConst, bar: { const xyz } }) {
}
// could be replaced with
function f(const arg) {
const { foo, bar: { xyz } } = arg;
var { notConst } = arg;
} This would be a bit tedious, but I suspect this isn't a very common use case. (Personally, I would make all of my parameters |
For example:
I suppose it should be like this:
The text was updated successfully, but these errors were encountered: