I encountered an issue with
Error TS2554: Expected 0 arguments, but got 4
when dealing with the observable getHappyDays()
.
The getHappyDays()
Observable returns either
Observable<HttpResponse<IHappyDays>>
or Observable<HttpErrorResponse>
. I have provided a StackBlitz demo to illustrate the problem.
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot):
Observable<IHappyDays> | Observable<never> {
return this.happyService.getHappyDays()
.pipe(//=>error thrown here
first(),
mergeMap((res) => {
return of(res.body)
})
)
}
https://stackblitz.com/edit/angular-3iujhb // in happy-resolver.service