Skip to content

Violation of encapsulation #26957

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

Closed
ghost opened this issue Sep 7, 2018 · 2 comments
Closed

Violation of encapsulation #26957

ghost opened this issue Sep 7, 2018 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@ghost
Copy link

ghost commented Sep 7, 2018

Hi all,
I've tested the following code:

class TestPrivate {
    public publicField: number;
    private privateField: number;
    constructor(pr: number, pub: number) {
        this.privateField = pr;
        this.publicField = pub;
    }

}

const obj1 = new TestPrivate(123, 789);

const temp = { fakeWrapper: obj1 };

const { fakeWrapper: { privateField } } = temp;

console.log(privateField);

And I see in console 123 output. It seems that we have a violation of encapsulation here.

@jack-williams
Copy link
Collaborator

Duplicate of #26760

@ghost ghost added the Duplicate An existing issue was already created label Sep 7, 2018
@ghost
Copy link

ghost commented Nov 17, 2018

Fixed by #28562.

@ghost ghost closed this as completed Nov 17, 2018
This issue was closed.
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

1 participant