Reputation: 101
This line of typescript code is throwing an error when transpiling.
getXXX(): Observable<any> {
return this.http.get('api/xxx').catch(err => {return err});
}
The error is
Supplied parameters do not match any signature of call target
I have the following imports in my script
import {Observable} from "rxjs/Rx";
import 'rxjs/add/operator/catch';
How doI fix it
Upvotes: 0
Views: 367
Reputation: 38209
this is syntax error for Typescript. When arrow function
has {}
, in {}
there must have a return
, relevant link.
this.http.get('api/xxx').catch(err => { return err; });
or simply not use {}
this.http.get('api/xxx').catch(err => err);
Upvotes: 1