简体   繁体   中英

What is the TypeScript type of an array of different Angular components?

In my app there are a lot of various components. I would like to have an array of components. There is no rule of what components can be in the array. The only rule is that these should be Angular components.

How to define properly a TypeScript type of an array of Angular components?

Something like:

myComponents: AngularComponent[];

Specifically what is the proper replacement for my imagined "AngularComponent" class?

There is an interface Component:

myComponents:Component[]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM