react-places-autocomplete icon indicating copy to clipboard operation
react-places-autocomplete copied to clipboard

Update type definition for sessionToken in searchOptions prop

Open greedybrain opened this issue 2 years ago • 0 comments

Hello,

While using the react-places-autocomplete library, I've encountered an issue related to the sessionToken prop in the searchOptions object.

Currently, the type definition for sessionToken is expecting an instance of google.maps.places.AutocompleteSessionToken, as per the error message: "InvalidValueError: in property sessionToken: not an instance of AutocompleteSessionToken". However, according to the Google Places API documentation, a session token should be a random string that identifies an autocomplete session for billing purposes. Google's recommendation is to use a version 4 UUID for this purpose.

In my application, I've followed Google's recommendation and generated a UUID string for sessionToken, but I'm encountering type errors due to the current type definition.

I suggest updating the type definition for sessionToken in the searchOptions prop to accept a string, in accordance with Google's guidelines. This would help users of the library to adhere to Google's recommendation for handling session tokens and avoid unnecessary type errors.

Thank you for your attention to this matter.

greedybrain avatar Jun 15 '23 16:06 greedybrain