I am receiving data from an API, and I have defined its structure like this
interface DailyData {
dt: number;
sunrise: number;
sunset: number;
moonrise: number;
moonset: number;
moon_phase: number;
temp: {day: number, eve: number, max: number, min: number, morn: number, night: number}[];
feels_like: {day: number, night: number, eve: number, morn: number}[];
pressure: number;
humidity: number;
dew_point: number;
wind_speed: number;
wind_deg: number;
wind_gust: number;
weather: { id: number, main: string, description: string, icon:string }[];
clouds: number;
pop: number;
uvi: number;
}
interface WeatherProps{
weather:{
lat: number;
lon: number;
timezone: string;
timezone_offset: number;
daily: DailyData[];
}
}
When trying to access props.weather.daily.weather[0], it gives me the error "Property 'weather' does not exist on type 'Daily[]'." Why is that happening and how do I resolve this issue?