如何解决此错误。 我需要在函数中声明接口类型的变量
//interface
export interface Activity {
id: number;
name: string;
}
/*import statements are here*/
export class SelectActiivityComponent implements OnInit {
private activityList: Activity[];//its working
changeView(){
activityList: Activity[];
//error here
//'Activity' only refers to a type, but is being used as a value here.
}
....
....
...
答案 0 :(得分:2)
我认为您打算这样做:
let activityList: Activity[];