I have 2 Classes:
export class A extends B {
private prop1: string;
private prop2: string;
constructor() {
this.prop1 = "A";
this.prop2 = "A";
}
}
export abstract class B {
private prop3: "B";
constructor() {
this.prop3 = "B";
}
}
let a = new A();
let b = new B();
If I now do Object.getOwnProperties(a)
I also get the properties of the inherited class b
.
–> prop1, prop2, prop3
Ist there any way to ONLY get prop1
and prop2
, and omit prop3
as it is only an inherited property?
I know that Object.getOwnProperties(a) is the wrong approach, but is there any other approach I can go to ONLY get the properties of the baseClass, and not it`s inherited class also?