I am having the following problem with my code:
I cannot figure out how to initialize nestedStudents. Every time I try to do it, it just tells me that that the object might be undefined.
export class StudentDto {
students: number;
nestedStudents: {
grades: number;
classes: number;
}
constructor(
props: {
students?: number;
nestedStudents?: {
grades?: number
classes?: number
}
} = {},
) {
this.students = props.students || 0;
//How can I initialize nestedStudents here?
}
}