Setting up typescript in visual studio





Create a typical Asp.Net 5 MVC applications. Vs2015 provide an excellent tool to work with typscript.

a)  Create a file called package.json and use npm to load the required dependencies.

b) Setup gulpfile.js

c) Run gulp from Task Runner.

1.  Creating package json 

Then you need to create file called package.json






Package json should contains the followings contents :

"devDependencies": {
    "typescript": "^1.5",
    "gulp": "^3.9.0",
    "gulp-typescript": "^2.8.0",
    "merge": "^1.2.0"
  }

2  Creating gulp file  Goto Add->New Item->Client-> Gulp configuration as shown below :-




After you added it, your gulp file should look like something below :-



The thing to note here is that your ts file will be compiled into a .js file and placed in a folder called 'script' (as shown in line 12).
,
3. Start your task runner by press Ctrl + Alt + Backspace or goto View->Other Windows -> Task Runner Explorer.

4. You can create any typescript file and put it under a folder called 'Typescript/definition'. Any file placed here will be compiled into .js by Typescript.

A simple typescript might looks this.














Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm