lundi 1 janvier 2018

typescript: Passing a class as parameter

How can I pass a class as parameter? For example:

// 'type' is a ModalDialog class
createComponent(type: <? extends ModalDialog>) {
   const factory = this.resolver.resolveComponentFactory(type);
   // ... more code here ...
}

Then, I would like to write something like this:

this.createComponent(MyModalDialog);





Aucun commentaire:

Enregistrer un commentaire