Introduction

  • Superset of Javascript

  • Compiles to plain JavaScript

  • Strongly Typed

  • Class based Object-Oriantation

References

Handbook - http://www.typescriptlang.org/Handbook

Playground - http://www.typescriptlang.org/Playground

Typescript Demo with Webpack - https://github.com/hesing/typescript-webpack-demo

Install Typescript

// Install node js 1st
npm install typescript -g

Using Typescript

// just simple
tsc test.ts

// watch changes
tsc test.ts -w

// change output filename
tsc myfile.ts myoutput.js

// compile multiple ts file in one shot
tsc a.ts b.ts --out myoutput.js

Typescript compiltation with Sublime Text 3

install TypeScript plugin using sublime package manager. use Ctrl + B to compile typescript file.

ts build

it also help in code completion...

code completion

Also you want to install sublime text 3 tslint to get immediate error notification.

Typescript compiltation with Webpack

in webpack.config.js include ts-loader ...

now we can use typescript like below...

Last updated

Was this helpful?