May 2018
Intermediate to advanced
512 pages
11h 3m
English
To avoid future mistakes in returning the unintended type of data from your service, you need to update the getCurrentWeather function to define the return type to be Observable<ICurrentWeather> and import the Observable type, as shown:
src/app/weather/weather.service.tsimport { Observable } from 'rxjs'import { ICurrentWeather } from '../interfaces'...
export class WeatherService { ... getCurrentWeather(city: string, country: string): Observable<ICurrentWeather> { } ...}
Now, VS Code will let you know that Type Observable<ICurrentWeatherData> is not assignable to type Observable<ICurrentWeather>:
Read now
Unlock full access