Creating TypeScript Config

A really nice new feature for the TypeScript compiler is the ability to use a json file as the configuration for it. This is a huge win because previously there was not a good story for how TypeScript projects should be setup. Now, this process is streamlined and we don't have to do any hacks to get TypeScript to work everywhere.

We're going to configure TypeScript with a tsconfig.json file.

Let's add it to our project. From your base folder where package.json and gruntfile.js are, create this file:

$ touch tsconfig.json


  "compilerOptions": {
      "module": "commonjs",
      "noImplicitAny": false,
      "removeComments": true,
      "preserveConstEnums": true,
      "sourceMap": true

Here we're giving the compiler a little bit more information about our project. Remember back in the setting up grunt section where we talked about browserify and how it was using a plugin called tsify? Well, tsify knows to go looking for this tsconfig.json file. It's going to find it and read it everytime it tries to compile the TypeScript code.

If you're interested to learn more about the options that we can give to the config file, check out the Microsoft wiki for how to setup a tsconfig.json file.

Let's add and commit this change:

$ git add tsconfig.json
$ git commit -m 'added tsconfig'

Now we're all setup with our development environment. Let's move on to the next section where we will be creating our TodoMVC application!