My current problem involves a function that returns an Rx.Observable
created from a promise. Here is the code snippet:
var data$ = fetchData();
fetchData() {
return Rx.Observable.fromPromise(fetch("someUrl"));
}
When I hover over the variable data$
in Visual Studio Code, it displays the type as Observable<Response>
. However, if I explicitly declare the return type of the function like this:
fetchData(): Rx.Observable<Response> {...}
, I receive an error stating "Cannot find name 'Response'."
It does work when I declare the return type as Observable<any>
, but that is too generic for my needs. How can I properly declare the function return type to match the Observable<Response>
type of data$
?