I am trying to map data from two observables to a third one like
return this.coursesService
.findCourseByUrl(route.params['id'])
.pipe(
switchMap((course: Course) =>
this.coursesService
.findLessonsForCourse(course.id)
.pipe(map((lessons: Lesson[])=> [course, lessons)])
)
);
But I am getting the following exception
Type 'Observable<(Course | Lesson[])[]>' is not assignable to type 'Observable<[Course, Lesson[]]>'.
Type '(Course | Lesson[])[]' is not assignable to type '[Course, Lesson[]]'.
Property '0' is missing in type '(Course | Lesson[])[]'.
I found out that the resultSelector in switchMap is deprecated in rxJs6, that's why I was trying this approach. But got stuck in here.