私のアプリケーションでGoogleのMap APIを使用しようとしています。ただし、次のコンパイラエラーが表示されます。Googleマップ/タイプスクリプト - 一貫してgoogle.maps.Placeを認識しない
[ts] Property 'Place' does not exist on type 'typeof maps'. Did you mean 'places'?
ここで、通常、私は入力や依存関係などがないと思われるかもしれません。しかし、奇妙な部分は、 "Place"プロパティは正しく上に数行だけ再結合されています。
class gMap {
latLong: google.maps.LatLng;
window: google.maps.InfoWindow;
marker: google.maps.Marker;
map: google.maps.Map;
directionsService: google.maps.DirectionsService;
directionsDisplay: google.maps.DirectionsRenderer;
placeID: string;
place: google.maps.Place;
constructor(lat: number, long: number, place: string, info: string, mapEl: Element) {
this.latLong = new google.maps.LatLng(lat, long);
this.window = new google.maps.InfoWindow({ content: info });
this.placeID = place;
this.place = new google.maps.Place(place);
this.map = new google.maps.Map(mapEl, {
center: this.latLong,
zoom: 15
});
this.marker = new google.maps.Marker({ position: this.latLong, map: this.map, });
this.window.open(this.map, this.marker);
}
最初にgoogle.maps.Place(place:google.maps.Place;)を使用すると機能します。コンストラクタ内の1つ(this.place = new google.maps.Place(place);)がエラーの原因です。
私はこのことが明らかな場合は謝罪します。私は、TypeScriptとGoogleマップが比較的新しいです。どんな指導も高く評価されます。ありがとう。クラスではありません