【发布时间】:2021-04-20 03:44:39
【问题描述】:
在类型脚本中,我有一个接口和一个类。
接口的属性之一就是类本身。如何将类及其成员分配为接口的属性之一?
export interface ITest {
_Id: string;
_UserName: string;
***Criteria: Need to assign the class MyCriteria to this interface's property "Criteria"***
}
export class MyCriteria
{
_Name: string = "department";
_Codes: string[]; // String array
constructor(Name: string, Codes: string[]) {
this._Name= Name;
this._Codes= Codes;
}
}
【问题讨论】:
标签: typescript class interface