How to Setup a Basic Test-Driven Typescript Environment

Fast and easy instructions for new developers

Jonathan Hsu
Code 85

--

If you’re starting out learning Typescript, then the implications to project structure are just as daunting as (if not more so) than cleaning up your JS code to be type-safe.

Moreover, if you’re looking to publish your project to NPM then there are even more considerations with how you setup your development space. Since one of the main reasons to use Typescript is to produce safer code, it’s also a great time to throw in automated testing… but isn’t that overwhelming?

I thought so at first, but what I discovered is it’s really not and it actually accelerated my development. So, in this tutorial we’re going to be starting up a Typescript project, then setting up automatic building and testing so you can develop freely all within a single project directory.

Setting up the Typescript Project

In this section we’re going to initialize a NodeJS project then setup Typescript.

We’ll assume you’re already in your project directory whether that means you cloned an empty GitHub repo, locally ran git init, or simply made a truly barebones directory.

--

--