Skip to content

Error when destructuring private property in a parameter #28562

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

Merged
2 commits merged into from
Nov 16, 2018

Conversation

ghost
Copy link

@ghost ghost commented Nov 15, 2018

Previously the check was only done if parent.initializer existed, which meant it worked for variable declarations but not for parameters.

@ghost ghost requested a review from sheetalkamat November 16, 2018 00:04
@ghost ghost merged commit e0dca0b into master Nov 16, 2018
@ghost ghost deleted the destructureParameterPrivateProperty branch November 16, 2018 20:47
@princed
Copy link

princed commented Nov 17, 2018

Don't you want to add a test for this one?

@ghost
Copy link
Author

ghost commented Nov 17, 2018

See the bottom of privateProtectedMembersAreNotAccessibleDestructuring.ts.

@princed
Copy link

princed commented Nov 17, 2018

Oh, I'm sorry, I was going to comment in #26760, so there would be nested destructuring context.

I thought we could add something like this to privateProtectedMembersAreNotAccessibleDestructuring.ts:

let nested = { k };
let {k: {priv: an, prot: bn, privateMethod: pmn}} = nested; // error

What do you think?

@ghost
Copy link
Author

ghost commented Nov 17, 2018

PRs accepted. 👍

This pull request was closed.
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

Successfully merging this pull request may close these issues.

2 participants