google-maps-services-js
google-maps-services-js copied to clipboard
The `region` parameter is not implemented for `placeAutocomplete`
Based on the place autocomplete web service documentation, there is an optional parameter called region
If I understood correctly this parameter allows to bias in the search result to be more locally relevant to a given region.
It looks like this parameter was not implemented in this package.
Steps to reproduce
import { Client as GoogleMapsClient } from '@googlemaps/google-maps-services-js'
const autocompleteResponse = await googleMapsClient
.placeAutocomplete({
params: {
input,
key: process.env.GOOGLE_API_KEY || '',
language: 'en',
region: 'CA',
},
})
.catch(() => null)
Typescript error
Type '{ input: string; key: string; language: string; region: string; }' is not assignable to type '{ input: string; sessiontoken?: string | undefined; offset?: number | undefined; origin?: LatLng | undefined; location?: LatLng | undefined; radius?: number | undefined; language?: string | undefined; types?: PlaceAutocompleteType | undefined; components?: string[] | undefined; strictbounds?: boolean | undefined; } ...'.
Object literal may only specify known properties, and 'region' does not exist in type '{ input: string; sessiontoken?: string | undefined; offset?: number | undefined; origin?: LatLng | undefined; location?: LatLng | undefined; radius?: number | undefined; language?: string | undefined; types?: PlaceAutocompleteType | undefined; components?: string[] | undefined; strictbounds?: boolean | undefined; } ...'.ts(2322)
autocomplete.d.ts(45, 5): The expected type comes from property 'params' which is declared here on type 'PlaceAutocompleteRequest'
Object literal may only specify known properties, and 'region' in type 'PlaceAutocompleteRequest['params']'
Is the region parameter still a valid parameter to use? It looks like the JavaScript client does support the region parameter so I presume it's just missing from this package?
If you would like to upvote the priority of this issue, please comment below or react with :+1: so we can see what is popular when we triage.
@nbouvrette Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:
- Check the issue tracker - bugs and feature requests for Google Maps Platform APIs and SDKs
- Open a support case - Get 1:1 support in Cloud Console.
- Discord - chat with other developers
- StackOverflow - use the
google-mapstag
This is an automated message, feel free to ignore.