mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-30 23:30:06 +00:00
Add new types for autocomplete session support
See: - https://developers.google.com/maps/documentation/javascript/places-autocomplete#session_tokens - https://developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service#AutocompleteSessionToken - https://developers.google.com/maps/documentation/javascript/reference/places-service#PlaceDetailsRequest - https://developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service#AutocompletionRequest
This commit is contained in:
@@ -418,7 +418,8 @@ let service = new google.maps.places.PlacesService(new HTMLDivElement());
|
||||
|
||||
service.getDetails({
|
||||
placeId: '-a1',
|
||||
fields: ['name']
|
||||
fields: ['name'],
|
||||
sessionToken: new google.maps.places.AutocompleteSessionToken()
|
||||
}, (result, status) => {
|
||||
if (status === google.maps.places.PlacesServiceStatus.NOT_FOUND) {
|
||||
return;
|
||||
|
||||
21
types/googlemaps/index.d.ts
vendored
21
types/googlemaps/index.d.ts
vendored
@@ -1,14 +1,15 @@
|
||||
// Type definitions for Google Maps JavaScript API 3.30
|
||||
// Project: https://developers.google.com/maps/
|
||||
// Definitions by: Folia A/S <http://www.folia.dk>,
|
||||
// Chris Wrench <https://github.com/cgwrench>,
|
||||
// Kiarash Ghiaseddin <https://github.com/Silver-Connection/DefinitelyTyped>,
|
||||
// Grant Hutchins <https://github.com/nertzy>,
|
||||
// Denis Atyasov <https://github.com/xaolas>,
|
||||
// Michael McMullin <https://github.com/mrmcnerd>,
|
||||
// Martin Costello <https://github.com/martincostello>,
|
||||
// Definitions by: Folia A/S <http://www.folia.dk>,
|
||||
// Chris Wrench <https://github.com/cgwrench>,
|
||||
// Kiarash Ghiaseddin <https://github.com/Silver-Connection/DefinitelyTyped>,
|
||||
// Grant Hutchins <https://github.com/nertzy>,
|
||||
// Denis Atyasov <https://github.com/xaolas>,
|
||||
// Michael McMullin <https://github.com/mrmcnerd>,
|
||||
// Martin Costello <https://github.com/martincostello>,
|
||||
// Sven Kreiss <https://github.com/svenkreiss>
|
||||
// Umar Bolatov <https://github.com/bolatovumar>
|
||||
// Michael Gauthier <https://github.com/gauthierm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/*
|
||||
@@ -2542,6 +2543,10 @@ declare namespace google.maps {
|
||||
getQueryPredictions(request: QueryAutocompletionRequest, callback: (result: QueryAutocompletePrediction[], status: PlacesServiceStatus) => void): void;
|
||||
}
|
||||
|
||||
export class AutocompleteSessionToken {
|
||||
constructor();
|
||||
}
|
||||
|
||||
export interface AutocompletionRequest {
|
||||
bounds?: LatLngBounds|LatLngBoundsLiteral;
|
||||
componentRestrictions?: ComponentRestrictions;
|
||||
@@ -2549,6 +2554,7 @@ declare namespace google.maps {
|
||||
location?: LatLng;
|
||||
offset?: number;
|
||||
radius?: number;
|
||||
sessionToken?: AutocompleteSessionToken;
|
||||
types?: string[];
|
||||
}
|
||||
|
||||
@@ -2566,6 +2572,7 @@ declare namespace google.maps {
|
||||
export interface PlaceDetailsRequest {
|
||||
placeId: string;
|
||||
fields?: string[];
|
||||
sessionToken?: AutocompleteSessionToken;
|
||||
}
|
||||
|
||||
export interface PlaceGeometry {
|
||||
|
||||
Reference in New Issue
Block a user