Copyright 2021 Google LLC
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+This package provides TypeScript guards for the Google Maps JavaScript API.
+A type guard (or type predicate) is an expression that performs a runtime check that guarantees the type in some scope. Type guards are used to narrow the type of a variable or parameter.
+For the complete API check the reference documentation.
+Available via npm as the package @googlemaps/typescript-guards.
+npm i @googlemaps/typescript-guards
+
+
+The following example narrows a union type google.maps.LatLng | google.maps.LatLngLiteral
to google.maps.LatLngLiteral
using the isLatLngLiteral
guard.
import { isLatLngLiteral } from "@googlemaps/typescript-guards";
const latLng: google.maps.LatLng | google.maps.LatLngLiteral = ...;
if (isLatLngLiteral(latLng)) {
lat = latLng.lat;
lng = latLng.lng;
} else {
lat = latLng.lat();
lng = latLng.lng();
}
+
+
+Copyright 2021 Google LLC. All Rights Reserved.
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at.
+ Http://www.apache.org/licenses/LICENSE-2.0.
+
+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+
Copyright 2021 Google LLC
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at
+ +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+