Weather App TS organises its TypeScript types across two dedicated modules.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/cristhianblaffita-web/Weather-App-Ts/llms.txt
Use this file to discover all available pages before exploring further.
src/types/api.ts defines the raw shapes returned by the Open-Meteo APIs — these types mirror the JSON response objects exactly and are used inside the useWeather and useGeocoding hooks. src/types/weather.ts defines the component-level interfaces used by the UI layer — props passed into components and the transformed data structures the app works with after normalising API responses. Keeping these two modules separate ensures that API contract changes don’t leak directly into component signatures, and vice versa.
API Response Types (src/types/api.ts)
These types map one-to-one onto the JSON objects returned by the Open-Meteo forecast and geocoding endpoints. They are used as the return types of the data-fetching hooks and as the source of truth for all downstream data transformations.
CurrentWeatherResponse
Represents thecurrent object in a forecast response — a single snapshot of live conditions at the requested location.
ISO 8601 datetime string of the most recent observation (e.g.,
"2024-07-01T14:00").The update interval for the current-conditions block, expressed in seconds.
Air temperature measured at 2 metres above ground level, in degrees Celsius.
Relative humidity at 2 metres above ground, expressed as a percentage.
Feels-like (apparent) temperature that accounts for wind chill and humidity, in degrees Celsius.
true when the sun is currently above the horizon at the requested location; false at night. Used by the app to switch between day and night weather icons and themes.WMO weather interpretation code describing the current sky condition (e.g.,
0 = clear sky, 61 = slight rain). The app maps these codes to icon and label strings.Total sky cloud cover as a percentage, from
0 (completely clear) to 100 (fully overcast).Wind speed measured at 10 metres above ground, in kilometres per hour.
HourlyWeatherResponse
Represents thehourly object in a forecast response. All fields are parallel arrays — index i across every array refers to the same point in time.
Array of ISO 8601 datetime strings, one element per hour of forecast coverage (e.g.,
["2024-07-01T00:00", "2024-07-01T01:00", ...]).Hourly air temperature at 2 metres above ground, in degrees Celsius. Parallel to
time.Hourly WMO weather interpretation code. Parallel to
time.DailyWeatherResponse
Represents thedaily object in a forecast response. All fields are parallel arrays indexed by day across a 7-day window.
Array of ISO 8601 date strings in
YYYY-MM-DD format, one element per forecast day.Representative WMO weather code for the day, chosen to reflect the most significant condition. Parallel to
time.Daily maximum air temperature at 2 metres, in degrees Celsius. Parallel to
time.Daily minimum air temperature at 2 metres, in degrees Celsius. Parallel to
time.Local sunrise time for each day, represented as an ISO 8601 datetime string. Parallel to
time.Local sunset time for each day, represented as an ISO 8601 datetime string. Parallel to
time.WeatherResponse
The top-level object returned by the Open-Meteo forecast endpoint. This is the type theuseWeather hook stores in state after a successful fetch.
The UTC offset for the requested location in seconds. Useful for converting UTC-based timestamps to local wall-clock time.
IANA timezone identifier for the location (e.g.,
"America/New_York"). Returned when timezone=auto is passed to the API.Map of each requested current-weather variable name to its unit string. For example:
{ "temperature_2m": "°C", "wind_speed_10m": "km/h", "relative_humidity_2m": "%" }. The app reads these values directly to render unit labels without hardcoding.The current-conditions snapshot. See CurrentWeatherResponse.
Map of each requested hourly variable name to its unit string.
The hourly forecast arrays. See HourlyWeatherResponse.
Map of each requested daily variable name to its unit string.
The daily forecast arrays. See DailyWeatherResponse.
Place
A single geocoding result returned insideGeocodingResponse.results. Carries everything needed to identify a city and call the forecast endpoint.
Stable, unique numeric identifier for the city in the Open-Meteo geocoding database. Used as a React list key when rendering search results.
City or locality name in the requested language (e.g.,
"Berlin").Full country name in the requested language (e.g.,
"Deutschland" when language=en still returns the native form for some locales).ISO 3166-1 alpha-2 country code for the city’s country (e.g.,
"DE" for Germany). Displayed alongside the city name to disambiguate results.Decimal-degree latitude of the city centre. Passed directly to the forecast endpoint as the
latitude query parameter.Decimal-degree longitude of the city centre. Passed directly to the forecast endpoint as the
longitude query parameter.GeocodingResponse
The top-level object returned by the Open-Meteo Geocoding API. Typed and consumed directly by theuseGeocoding hook.
Ordered array of matching
Place objects. May be empty if no cities match the search term.Time in milliseconds the Open-Meteo server spent generating this response.
UI Component Types (src/types/weather.ts)
These types are used by the React component layer. They represent transformed or extracted slices of the API data that components actually render, keeping components decoupled from the raw API shape.
WeatherVar
A generic value-and-unit pair used wherever the app pairs a numeric (or string) measurement with its unit label.The measurement value. Most weather variables are
number, but the type allows string for flexibility (e.g., pre-formatted display strings).Optional unit label (e.g.,
"km/h", "%"). When present, components render it alongside the value. Sourced from the *_units maps on WeatherResponse.WeatherNavProps
Props accepted by theWeatherNav component, which renders the top navigation bar showing the current city, date, time, and condition icon.
The name of the currently selected city, displayed in the nav header.
WMO weather code for the current condition. Used to select the appropriate status icon and label.
Formatted date string for display in the navigation bar.
Formatted time string (current local hour) for display in the navigation bar.
Indicates whether the current time is daytime. Controls day/night icon variants in the nav.
CurrentWeather
The shape of the current-conditions data object passed to theCurrentWeather component. Fields are normalised from CurrentWeatherResponse into display-ready values.
Current air temperature in degrees Celsius.
Wind speed as a
WeatherVar — value holds the numeric speed and unit holds the label (e.g., "km/h").Relative humidity as a
WeatherVar — value holds the percentage and unit holds "%".Feels-like temperature as a
WeatherVar — value holds the numeric temperature and unit holds "°C".Total cloud cover percentage as a plain number.
HourlyWeather
Represents a single entry in the hourly forecast list rendered by theHourlyWeather component.
The formatted hour string for this entry (e.g.,
"14:00").WMO weather code for this hour, used to select the appropriate icon.
Air temperature at 2 metres for this hour, in degrees Celsius.
Whether this hour falls during daylight hours. Controls day/night icon variant selection.
DailyWeather
Represents a single entry in the daily forecast list rendered by theDailyWeather component.
The formatted date string for this day (e.g.,
"Mon 1 Jul").WMO weather code representing the day’s dominant condition.
Daily maximum temperature in degrees Celsius.
Daily minimum temperature in degrees Celsius.