我的对象层次结构如下所示
export interface MandatoryTags {
key: string;
values: string[];
}
export interface Template {
templateName: string;
mTags: MandatoryTags[];
}
我试图从子接口访问数组。我收到错误Property' mTags'类型'模板'
上不存在this.templateService.getTemplate(value).subscribe(res=>{
this.selectedTemplate = res as Template;
console.log(JSON.stringify(this.selectedTemplate)); //Works
console.log(this.selectedTemplate.templateName); //Works
// this.listOptions = this.selectedTemplate.mTags; --> getting error :Property 'mTags' does not exist on type 'Template'
}, err=>{
console.log(err);
});