首页 > 解决方案 > Angular 2+中组件类的Typescript中的类型是什么?

问题描述

我有一个小问题,但很大的挫败感。对于我的自定义模块,我需要传递一组组件。所以...为了保持良好的习惯,我想用 Typescript 来描述它。它看起来像这样:

export interface ModalModuleConfig {
    title: string;
    z-index: number;
    entryComponents: Component[];
}

Component[]不是合适的类型。它仅适用于any[]. 但我不想偷工减料使用any[]. 我更喜欢使用为角度组件创建的类型。之类的东西Component[]ComponentDecorator[]ComponentClass[]。但它们都不起作用。有人能帮我吗?

标签: angulartypescripttypescript-typings

解决方案


推荐阅读