Skip to content

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

Closed
@haseebeqx

Description

@haseebeqx

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' ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions