Using Typescript

Using TypeScript with Woosmap Map JS API

  1. Overview
  2. Getting Started


TypeScript is a strongly typed programming language that compiles to plain JavaScript. Typing your code allows to catch errors early in your editor and makes it incomparably easier to understand and maintain.

The Woosmap Map JS API has dedicated Typescript typings published on DefinitelyTyped. The DefinitelyTyped project is an open source project that maintains type declaration files for many packages including Woosmap Map. The Woosmap Map JavaScript declaration files ( see source files on GitHub) are published as @types/ package on NPM.

These TypeScript definitions are generated directly from the API source code, bringing you the most accurate up-to-date TypeScript definitions for the Map JS API to use in your web apps.

Getting Started

To start using it, install the types with the following command:

NPM Command
        npm i -D @types/


Or through your package dependencies:

        "devDependencies": {
  "@types/": "~1.4.1",


And here is a basic example on how to create a Map:

Create a Map using Typescript
        let map:;
const initialCenter: = {lat: 42.3, lng: 2.4};
const initialZoom: number = 7;

function initMap(): void {
    map = new"map") as HTMLElement, {


To help you build your locator using Typescript and Map JS API, feel free to look at this sample application on GitHub.

Was this article helpful?
Have more questions? Submit a request