Is there is any way to get this result in typescript what I have Is there is any way to get property list of parent class directly from class name not from object my end goal is to get this result
export class A {
public a: string;
public b: string;
}
export class B extends A {
public missingProperty: any;
public constructor(res: any){
super();
this.missingProperty = {};
this.setMissingProperty(res);
}
private setMissingProperty(res: any){
Object.keys(res).foreach(element => {
// if property name match i.e a is present in res as well as class B then assign to the same
// property name
// else assign to missingProperty
}
}
}
what I want
// test
const temp = {a:'testa', b: 'testb', 0: 23, 1: 34, 2:75}
const b = new B(temp);
// b.b gives testb
// b.a gives testa
// b.missingProperty gives {0: 23, 1: 34, 2:75}