jeudi 31 janvier 2019

How to get child Class in parent constructor in typescript?

I try to set, to empty string, every properties of my classes at instantiate time. For that I need to get the "Class" in the parent constructor. Any help would be much appreciate !

I work with typescript 3.1

I found a function who return all the properties through the prototype, including the ones who are not instantiate (what I need), but it needs the "Class" in argument. "this" doesn't work. I call this function in the parents constructor.

  • Any ideas how can I get the Class in the constructor ?
  • Or how can I get a list of all the child Class properties, including the none instantiates ones ?
       function getAllProps(cls: new (...args: any[]) => any): any[] {   
         // return a list of all Class properties.
       }





Aucun commentaire:

Enregistrer un commentaire