# Google Maps JavaScript API loader and TypeScript typings

> I maintained the official Maps JavaScript API loader and the auto-generated TypeScript typings at Google.

Canonical HTML page: https://justin.poehnelt.com/projects/google-maps-js-api-loader/.

Role: Author & Maintainer (Google).

Stack: TypeScript, Google Maps, npm.

## Stats

- **29M+** combined weekly npm downloads
- **77** repositories
- **about 8.3M** loader weekly downloads
- **13M+** @types/google.maps weekly

## Links

- [GitHub](https://github.com/googlemaps/js-api-loader)
- [npm](https://www.npmjs.com/package/@googlemaps/js-api-loader)
- [@types/google.maps](https://www.npmjs.com/package/@types/google.maps)
- [Docs](https://developers.google.com/maps/documentation/javascript/load-maps-js-api#dynamic-library-import)

## Loader usage from the package README

```javascript
import { setOptions, importLibrary } from "@googlemaps/js-api-loader";

setOptions({ key: GOOGLE_MAPS_API_KEY });
await importLibrary("core");
```

Source: [googlemaps/js-api-loader on GitHub](https://github.com/googlemaps/js-api-loader), [@googlemaps/js-api-loader on npm](https://www.npmjs.com/package/@googlemaps/js-api-loader), and [@types/google.maps on npm](https://www.npmjs.com/package/@types/google.maps).

## What I owned

As a Senior Developer Relations Engineer at Google, I wrote and maintained the official JavaScript API loader (about 8.3M weekly npm downloads) and the auto-generated TypeScript typings, `@types/google.maps` (13M+ weekly). I also maintained marker clustering (about 3.9M weekly) and the Node.js SDKs.

## Purpose

Loading Maps on the web used to mean pasting a script tag and waiting on a global callback. The loader returns a promise, so you can load Maps from any bundler or framework. For the typings, I built a generator that worked from the Closure Compiler externs behind the Maps API and used custom AST parsing to turn them into TypeScript definitions. The types stay in sync with the real API. Developers get accurate autocomplete and type checks, and nobody hand-writes types.

## Who it was for

Web developers adding maps to React, Angular, Vue or plain JS apps, at startups and large enterprises.

## Impact

Across my Maps and Workspace packages, 29M+ combined weekly npm downloads in 77 repositories.
