google-maps-services-js icon indicating copy to clipboard operation
google-maps-services-js copied to clipboard

Refine typings for `AutocompleteRequest.types` to allow for all variations allowed by the API

Open amelekhin opened this issue 2 years ago • 1 comments

Issue description

In the documentation for the placeAutocomplete method it is said that it supports

Up to five values from Table 1 or Table 2

separated by a vertical bar | as a valid value for the types parameter of the autocomplete endpoint.

However, in places/autocomplete.ts the type of the types property is an enum PlaceAutocompleteType, which supports a very limited set of types/filters for this API, which makes it impossible to use the method with the values from the aforementioned tables without tricking TypeScript with as unknown as PlaceAutocompleteType cast.

This contradicts the documentation of the endpoint, makes it impossible to use singular or combined values from the aforementioned tables and limits the capabilities of the autocompletion.

Suggestion

If these capabilities of filtering by types are not to be deprecated by Google Maps API itself, I would suggest changing the type of types field to string to reach parity in filtering autocompletion predictions between raw API calls and this library.

I would also appreciate if anybody could suggest me another way to, for example, send { types: 'postal_code' }, if there is one in this library and I'm not aware of it. It is supported in raw API calls and I see no reason why it should not be supported in the library.

amelekhin avatar Apr 20 '23 15:04 amelekhin

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.

@amelekhin Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

wangela avatar Apr 20 '23 15:04 wangela