Convert one object list to another in Typescript
Suppose I have a list of student information as follows:
1 2 3 4 |
const students: Student[] = [ { id: "1", name: "Khanh" }, { id: "2", name: "Quan" }, ]; |
with the Student class with the following content:
1 2 3 4 |
interface Student { id: string; name: string; } |
If I now define another class StudentInfo that also contains student information with more information about the class as follows:
1 2 3 4 5 |
interface StudentInfo { id: string; studentName: string; className: string; } |
To convert the list… Read More