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

Implementation of inheritance not compatible with Object.getOwnPropertyNames() #13163

Closed
haseebeqx opened this issue Dec 25, 2016 · 3 comments
Closed
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@haseebeqx
Copy link

haseebeqx commented Dec 25, 2016

TypeScript Version: 2.12.0

Code

class A{
private n :number= 1;
public x :number =2;
protected y: number =3;
}
class B extends A{
private m :number = 2;
}

var obj = new B();
console.log(Object.getOwnPropertyNames(obj)); 

Expected behavior:
this should only give ['m']

Actual behavior:
this when running with nodejs compiled with commonjs module gives [ 'n', 'x', 'y', 'm' ]

@aluanhaddad
Copy link
Contributor

See this comment #10425 (comment) and the question above it.

@mhegazy
Copy link
Contributor

mhegazy commented Dec 26, 2016

should be addressed by #12488

@mhegazy mhegazy added the Suggestion An idea for TypeScript label Dec 26, 2016
@RyanCavanaugh RyanCavanaugh added Working as Intended The behavior described is the intended behavior; this is not a bug and removed Suggestion An idea for TypeScript labels Aug 13, 2018
@RyanCavanaugh
Copy link
Member

This is the expected behavior

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

4 participants