google-maps-services-js
google-maps-services-js copied to clipboard
Support for Place Types in place autocomplete
Hey all. New to the Maps API so could be missing something here. I'm using the nodejs Maps client to make Places Autocomplete requests. I'm able to make the requests fine, and filter using types: PlaceAutocompleteType.establishment. If possible, I'd really like to be able to filter by other place types a la what's given here. I'm able to do this using the frontend API, but I don't see a way to do this with the server client. Is this supported? Would be great to have if not. Thanks.
Bumping this, would love to know if this is possible. Thanks!
While it would be ideal to have the correct type definitions, you can work around this by ignoring the Typescript errors and providing the array of strings. The param object is simply passed into the underlying axios instance as its param object.
const response = await googleClient.placeAutocomplete({
params: {
...
// @ts-ignore
types: ["bar", "restaurant"],
},
});
Awesome! Didn't realize that would work--thanks for the solution @tj-vaneerten.
Leaving open in case there's intention to update the type definitions, otherwise feel free to close.
This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you!
duplicate in #974