Good afternoon, my problem is this:
I am receiving an error in each of the calls I make to the REST service. This error disappears changing anything in the code (including just "//" for example), but the first time it compiles it always fails.
I would like to know if someone understands the problem.
As I said before, the code works. But it fails the first time. Here is an example:
/** GET carsfrom the server */
getCars(): Observable<Car[]> {
return this.http.get<Car[]>(this.carsUrl)
.map(response => {
let res = response.json().cars;
if (!Array.isArray(res)) {
return [res]
}
return res;
})
.pipe(
catchError(this.handleError('getCars Error', []))
);
}
The error occurs in the first line of the return. The error produced is as follows:
TS2558 error: Expected 0 type arguments, but got 1.