The easiest way to get started with writing scripts in Typescript is to use the
[Github map starter kit repository](https://github.com/thecodingmachine/workadventure-map-starter-kit). It comes with
Typescript enabled. If you are **not** using the "map starter kit", this page explains how to add Typescript to your
own scripts.
## The short story
In this page, we will assume you already know Typescript and know how to set it up with Webpack.
To work with the scripting API in Typescript, you will need the typings of the `WA` object. These typings can be downloaded from the `@workadventure/iframe-api-typings` package.
Furthermore, you need to make the global `WA` object available. To do this, edit the entry point of your project (usually, it is a file called `index.ts` in the root directory).
From there, you should be able to use Typescript in your project.
## The long story
Below is a step by step guide explaining how to set up Typescript + Webpack along your WorkAdventure map.
In your map directory, start by adding a `package.json` file. This file will contain dependencies on Webpack, Typescript and the Workadventure typings:
This will automatically compile Typescript, and serve it (along the map) on your local webserver (so at `http://localhost:8080/script.js`). Please note that the `script.js` file is never written to the disk. So do not worry if you don't see it appearing, you need to "build" it to actually write it to the disk.
Final step, you must reference the script inside your map, by adding a `script` property at the root of your map:
We now have a correct development setup. But we still need to be able to build the production script from Typescript files. We are not going to use the development server in production. To do this, we will add an additional `webpack.prod.js` file.