export type MapboxFeatureType = | 'country' | 'region' | 'place' | 'locality' | 'postcode' | 'district' | 'neighborhood' | 'street' | 'address' export type MapboxWorldView = | 'ar' | 'cn' | 'in' | 'jp' | 'ma' | 'rs' | 'ru' | 'tr' | 'us' export type MapboxConfidenceScore = 'exact' | 'high' | 'medium' | 'low' export type MapboxMatchCode = | 'matched' | 'unmatched' | 'not_applicable' | 'inferred' | 'plausible' export type MapboxAccuracy = | 'rooftop' | 'parcel' | 'point' | 'interpolated' | 'approximate' | 'intersection' export type MapboxSearchOptions = { autocomplete: boolean bbox: number[] country: string language: string limit: number permanent: boolean proximity: number[] | 'ip' types: ReadonlyArray worldview: MapboxWorldView } export type MapboxGeometry = { coordinates: [number, number] type: 'Point' } export type MapboxContext = { address: { address: string address_number: string } place: { wikidata_id: string } region: { region_code: string region_code_full: string wikidata_id: string } country: { country_code: string country_code_alpha_3: string wikidata_id: string } } & Record export type MapboxProperties = { bbox: [number, number, number, number] context: MapboxContext coordinates: { // https://docs.mapbox.com/api/search/geocoding/#point-accuracy-for-address-features accuracy: MapboxAccuracy latitude: number longitude: number routable_points: { name: string; latitude: number; longitude: number }[] } feature_type: MapboxFeatureType full_address: string // name, place_formatted mapbox_id: string // https://docs.mapbox.com/api/search/geocoding/#smart-address-match match_code: { confidence: MapboxConfidenceScore } & Record< MapboxFeatureType, MapboxMatchCode > name: string name_preferred: string place_formatted: string // region, country } export type MapboxFeature = { id: string geometry: MapboxGeometry properties: MapboxProperties type: 'Feature' } export type MapboxGeocodingResponse = { attribution: string features: MapboxFeature[] type: 'FeatureCollection' } export type MapboxApiError = { error_code: string message: string status: number }