Skip to content

Commit

Permalink
fix: un-shim Maps JS types and use new published typings
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 631596386
  • Loading branch information
awmack authored and copybara-github committed May 8, 2024
1 parent 50b6466 commit 3177388
Showing 1 changed file with 6 additions and 41 deletions.
47 changes: 6 additions & 41 deletions src/utils/googlemaps_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,52 +10,17 @@
*/

/** Attribution object for Place photos and reviews. */
export declare interface AuthorAttribution {
displayName: string;
photoURI: string|null;
uri: string|null;
}
export type AuthorAttribution = google.maps.places.AuthorAttribution;

/** Place Photo object. */
export declare type Photo = Omit<google.maps.places.Photo, 'attributions'>& {
authorAttributions: AuthorAttribution[];
};
export type Photo = google.maps.places.Photo;

/** Place Review object. */
export declare type Review =
Omit<google.maps.places.Review, 'author'|'authorURI'|'authorPhotoURI'>& {
authorAttribution: AuthorAttribution|null;
};

/** Search by text request. */
export declare interface SearchByTextRequest {
textQuery: string;
fields: string[];
locationBias?: LatLng|LatLngLiteral|LatLngBounds|LatLngBoundsLiteral;
locationRestriction?: LatLngBounds|LatLngBoundsLiteral;
includedType?: string;
region?: string;
}
export type Review = google.maps.places.Review

/** Updated Place class with new attribution schema. */
export declare interface Place extends Omit<
google.maps.places.Place,
'photos'|'reviews'|'fetchFields'|'accessibilityOptions'> {
photos?: Photo[];
reviews?: Review[];
accessibilityOptions?: {hasWheelchairAccessibleEntrance: boolean|null}|null;
fetchFields: (options: google.maps.places.FetchFieldsRequest) =>
Promise<{place: Place}>;
}

/** Places library. */
export declare interface PlacesLibrary extends
Omit<google.maps.PlacesLibrary, 'Place'> {
Place: {
new(options: google.maps.places.PlaceOptions): Place;
searchByText: (request: SearchByTextRequest) => Promise<{places: Place[]}>;
};
}
export type SearchByTextRequest = google.maps.places.SearchByTextRequest;
export type Place = google.maps.places.Place;
export type PlacesLibrary = google.maps.PlacesLibrary;

/** google.maps.marker.AdvancedMarkerElement. */
export type AdvancedMarkerElement = google.maps.marker.AdvancedMarkerElement;
Expand Down

0 comments on commit 3177388

Please sign in to comment.