- Notifications
You must be signed in to change notification settings - Fork8
TypeScript guards for the Google Maps JavaScript API.
License
googlemaps/js-typescript-guards
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This package providesTypeScript 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 thereference documentation.
Available via npm as the package@googlemaps/typescript-guards.
npm i @googlemaps/typescript-guards
The following example narrows a union typegoogle.maps.LatLng | google.maps.LatLngLiteral togoogle.maps.LatLngLiteral using theisLatLngLiteral guard.
import{isLatLngLiteral}from"@googlemaps/typescript-guards";constlatLng:google.maps.LatLng|google.maps.LatLngLiteral= ...;if(isLatLngLiteral(latLng)){lat=latLng.lat;lng=latLng.lng;}else{lat=latLng.lat();lng=latLng.lng();}
About
TypeScript guards for the Google Maps JavaScript API.
Topics
Resources
License
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors7
Uh oh!
There was an error while loading.Please reload this page.