Getting Started

Setting Up Development Environment

To setup a new project we need to create package.json

{
  "scripts": {
    "build": "tsc",
    "typings:install": "typings install"
  },
  "dependencies": {
    "backbone": "^1.3.3",
    "underscore": "^1.8.3",
    "backbone.nativeview": "^0.3.3",
    "es6-shim": "github:paulmillr/es6-shim",
    "ng-backbone": "^0.1.5",
    "systemjs": "^0.19.36",
    "typescript": "^1.8.10"
  }
}

Now we can install dependencies

npm install

and required TypeScript definitions

npm run typings:install

We also need to tell TypeScript how exactly we want it to transpile our sources, so we create tsconfig.json

{
  "compilerOptions": {
    "target": "ES5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "outDir": "build/"
  },
  "files": [
    "./typings/index.d.ts",
    "./src/app.ts"
  ]
}

In brief, we ask here TypeScript to compile our application bootstrap module ./src/app.ts into ./build directory. Also it shall also include index file./typings/index.d.ts for installed type definitions.

Now we are ready to write application code. Of course you can use any text editor, but for any pleasant experience you rather take an IDE with support for TypeScript

I'm personally used to NetBeans, which is out of the list. Yet it has a plugin Netbeans TypeScript Editor.

Last updated