On
|
return this.http.get<Course[]>("/api/courses") |
it should be
this.http.get<{payload: Course[]}>
so you need to to do additional casting with
|
map(res => res["payload"]), |
as TypeScript would already know the type of the payload, so you can do
and it would already have the correct type.
Same goes for all the other HTTP requests.
On
reactive-angular-course/src/app/services/courses.service.ts
Line 39 in 8fd3888
it should be
so you need to to do additional casting with
reactive-angular-course/src/app/services/courses.service.ts
Line 41 in 8fd3888
as TypeScript would already know the type of the payload, so you can do
and it would already have the correct type.
Same goes for all the other HTTP requests.