如何在打字稿中定义两个类型的数组

时间:2018-11-19 20:06:09

标签: typescript

class College {

    collegeTitle: String;
    collegeId:number
    course: String;    
    students: Student[];


    constructor( collegeTitle: String,collegeId:number , classroomname: String , students: Student[] ) {
     this.collegeTitle = collegeTitle ;
      this.collegeId = collegeId ;
        this.classroomname = classroomname;       
        this.students = students ;
    }
}

早期的大学只有一门课程..所以效果很好。 现在有更多的课程,并且必须保持课程排列,这是学院内的学生。.实现此目标的最佳方法是什么? 我真的不需要像map或其他构造之类的东西,因为我没有使用键值来检索它们。我只是迭代并在UI中显示它 是接口数组还是类型数组?代码看起来如何?

0 个答案:

没有答案
相关问题