Typescript provides features like type safety, type checking at the compilation time and gives the error if any. It gives you type checking, explicit interfaces, and easier module exports. Typescript is the Open Source and under the Apache 2.0 license.
For Visual Studio 2013 update 2+: included by default (also you can download from the website http://www.typescriptlang.org/ download section.)
You can easily install tools with
- npm install typescript -g
- git clone https://github.com/Microsoft/TypeScript.git (Github)
For Visual Studio 2012: download the tools “TypeScript for Visual Studio 2012”. Other editors like WebStrom, Atom, Sublime Text and Eclipse also provide support for Typescript.
Microsoft does provide great support in Visual Studio for TypeScript, let start with the example project.
- After the Typescript is installed in visual studio, create the sample project let say “StartWithTypescript”. You can find the project template into the Templates > Other Language > Typescript. Select “Html application for typescript”.
- Project is created with default files index.html, app.css, app.ts. Here “.ts” is the extension for the typescript file. The Build Action for this file must be “TypeScriptCompile”, it is mandatory otherwise the compiled JS file will not be generated.
In visual studio, with build action, all the typescript file in the project will compile and appropriate js and js.map file generated with the same name. Now build the project the app.js file is created from the app.ts. If you can change anything into the .ts file and save it, automatically it will reflect into js file.
- To add the new typescript file, Go in to Add Item and search about Typescript, Add the new typescript file and then build it will generate.js and js.map files
It is recommended to use the latest technology like TypeScript along with ASP.Net MVC to make your DotNet application powerful, scalable and robust.