Refine typings for AutocompleteRequest.types
to allow for all variations allowed by the API
#974
Labels
next major: breaking change
this is a change that we should wait to bundle into the next major version
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Issue description
In the documentation for the
placeAutocomplete
method it is said that it supportsseparated by a vertical bar
|
as a valid value for thetypes
parameter of theautocomplete
endpoint.However, in
places/autocomplete.ts
the type of thetypes
property is an enumPlaceAutocompleteType
, 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 withas 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 tostring
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.The text was updated successfully, but these errors were encountered: