Background: Using rxjs Observables
I'm trying to call a method (with an observable) that calls another method. This current setup isn't working for me with the following compilation error in checkIfTrue function in service 1...
A function whose declared type is neither 'void' nor 'any' must return a value.ts(2355)
//component
//makes call to service
process = () => {
this.service1.checkIfTrue().subscribe(x => {console.log(x)});
};
//service 1
//makes call to service 2
checkIfTrue = (): Observable<boolean> => {
this.service2.getInt().subscribe(y => { return y == 1;});
};
//service 2
//makes call to service 2
getInt = (): Observable<number> => {
return Observable.of(1);
};
It seems like I can't return the response from the second method...How can I achieve this?