Skip to content
Products
Solutions
By industry
By use case
Resources
Products
Solutions
By industry
By use case
Resources
Products
Solutions
By industry
By use case
Resources
Google Maps Platform JavaScript API and TypeScript
Justin Poehnelt
Developer Relations Engineer
Dec 3, 2020
Try Google Maps Platform
Unlock access to real-world data and insights with a monthly $200 Google Maps Platform credit.
Get started

In July, we started rolling out TypeScript samples in the Maps JavaScript API documentation to better support modern web developers. According to a 2019 JavaScript developer survey, nearly 60% have used TypeScript and will use it again, while over 20% are interested in learning it. TypeScript is growing in popularity and we hope to make the experience the best it can be for Google Maps Platform developers. We think it’s important to support TypeScript not only because it’s popular, but because it allows developers to validate that their code is correct and provide better experiences with Google Maps Platform. 

You can find the new sample code by clicking the TypeScript tab on any snippet. For example, here’s our Simple Map sample for JavaScript:

JavaScript Snippet

Code snippets with JavaScript tab

And here it is with added TypeScript support:

TypeScript Snippet

Code snippets now have a TypeScript tab

To help you get started, we also published a TypeScript and Google Maps Platform guide that covers many of the basics including possible compiler options and installation instructions for typings. We want to call out that this wouldn’t have been possible without the work of the open source TypeScript community and the type definitions they maintain and publish on Definitely Typed. These types can be installed via NPM by running the following:

npm i -D @types/googlemaps
Copied to clipboard!

Node.js developers using Google Maps Platform APIs from server environments should not feel left out–a TypeScript rewrite of the client library was published earlier this year.

For more information on Google Maps Platform, visit our website.

Clay cityscape
Clay cityscape
Google Maps Platform
Get going with Google Maps Platform