Skip to content

Using TypeScript

Carson edited this page May 7, 2023 · 2 revisions

Why TypeScript

TypeScript is a strongly typed language that makes documentation, code security, debugging and error avoidance astronomically better. When The International rewrote its second version using TypeScript instead over the initial JavaScript version, we found our code was structured more resiliently to unforeseen issues, and had astronomically less errors, allowing us to focus our energy on actually programming the bot.

The Screeps TypeScript Starter Also comes with a ton of awesome tools that make project management a trillion times easier. With rollup you can specify where you want your code sent to - to MMO, a private server, or a community one - all with one simple command. Additionally, your code project folder can be anywhere on your computer, making version control with git safer (sometimes the Screeps bot code folders reset, get corrupted, etc. when editing) and much easier.

There's also a great community in the typescript channel in the Screeps Discord to help you out if you get stuck, and there are tons of open source bots made with TypeScript. Developing with TypeScript is truly empowering.

Setup

First you should choose a starter it. It's recommended you try forking / cloning either The International's or screeper's. Both have pretty comprehensive setup guides that should help you have everything setup for development.

From here, you can start programming your own bot. You should probably overwrite the template bot provided in the src folder, though make sure you utilize the ErrorMapper to conveniently source error stacks for debugging.

Next, visit Using Git to setup your bot's repository

Clone this wiki locally