reactive-angular-course
reactive-angular-course copied to clipboard
Wrong data types in courses service
On https://github.com/angular-university/reactive-angular-course/blob/8fd38880f715484c309c2381dc9fd1bcd7396f4f/src/app/services/courses.service.ts#L39 it should be
this.http.get<{payload: Course[]}>
so you need to to do additional casting with https://github.com/angular-university/reactive-angular-course/blob/8fd38880f715484c309c2381dc9fd1bcd7396f4f/src/app/services/courses.service.ts#L41 as TypeScript would already know the type of the payload, so you can do
map(res => res.payload)
and it would already have the correct type.
Same goes for all the other HTTP requests.