Issue TS2322 (TS) The type 'HttpEvent' cannot be assigned to the type 'Student[]'. The type 'HttpSentEvent' cannot be assigned to the type 'Student[]'. The property 'length' is missing in the 'HttpSentEvent' type.
The error mentioned above is occurring in my code:
Here are the declarations:
public Students: Array<Student> = [];
model: any = {};
constructor(private httpService: HttpClient) {
}
async LoadStudentData() {
var temp = await this.httpService.get<Array<Student>>(URL, this.model).toPromise();
this.Students = temp;
}
Is there a way to handle the casting issue?