rxjs: finally is not passing observable through properly
RxJS version: rxjs 5 beta 6
Code to reproduce:
getSessions() {
this.spinnerService.show();
return <Observable<Session[]>>this.http
.get(sessionsUrl)
.map(res => this.extractData<Session[]>(res))
.catch(this.exceptionService.catchBadResponse)
.finally(() => this.spinnerService.hide());
}
See code example here … https://github.com/johnpapa/event-view/commit/da21a922faf74aa3f2b6fbf1af5d1d666419b24e#diff-a115014ed5c151b197295d50f1ce2a54R24
Expected behavior:
TypeScript’s tsc
should think getSessions
should return Observable<Session[]>
Actual behavior:
TypeScript’s tsc
thinks getSessions
is returning Observable<{}>
Additional information:
- When I comment out the
finally
TypeScript is happy - When I cast the return type as
<Observable<Session[]>>
tsc is happy
Error message:
> tsc -p ./src/client
src/client/app/+sessions/session-list/session-list.component.ts(34,9):
error TS2322: Type '{}' is not assignable to type 'Session[]'.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 19 (11 by maintainers)
Commits related to this issue
- chore(typings): update type definition for finally - pass type of source observable closes #1672 — committed to kwonoj/rxjs by kwonoj 8 years ago
I am getting this problem as well even with the latest. I was running Beta 6 and now running Beta 9. I’m using Visual Studio Code. An example of the call I’m making:
Think I found cause.