Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@googlemaps/typescript-guards

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@googlemaps/typescript-guards

TypeScript guards for Google Maps Platform JavaScript.

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19K
increased by17.59%
Maintainers
2
Weekly downloads
 
Created
Source

Google Maps JavaScript API Loader

npm Build Release codecov GitHub contributors semantic-release Discord

Description

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.

Documentation

For the complete API check the reference documentation.

Install

Available via npm as the package @googlemaps/typescript-guards.

npm i @googlemaps/typescript-guards

Example

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();
}

Keywords

FAQs

Package last updated on 22 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc