Lets be familiar with TypeScript.

Anders Heijlsberg (father of C#) and Luke Hoban introduce TypeScript. Its a new programming language developed by Microsoft. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. It works with Any browser, Any host, Any OS and it is simply an Open Source.

Introducing TypeScript

What is TypeScript?

TypeScript is a programming language developed by Microsoft. TypeScript is a superset of JavaScript so thats why it is possible to run any javascript programs with TypeScript without any changes. So we can say that every JavaScript program is also a Typescript program.

What are the add-on features of TypeScript?

Now you may ask me that what are the add-on features of TypeScript that makes it different from JavaScript. So here we go, the features which are added in TypeScript are as follows:-
1. Type annotations
2. Classes and Interfaces
3. Modules
4. Lambda Functions

Now lets go through all of them one by one.

1. Type Annotations:

We all know that Javascript is a dynamic typed language that means all the type checking will be done at run time.

But TypeScript provides you an option to go for static typing through Type Annotations that means all the type checking will be done at compile time only. I am saying this as an option because it solely depends on developer to use Type Annotations or not because its an optional feature.
The primitive types which can be used at compile time are : number, bool and string.

function sub(first: number, second: number): number {
return first - second;

2. Classes and Interfaces

TypeScript supports classes that are closely aligned with those proposed for ECMAScript 6 however currently it doesn't support because the standards are not ready(as mentioned in Wikipedia). TypeScript has emitted the consistent, ideomatic JavaScript code to implement classes and modules.

value = 0;
init(a: number)
this.value = a;
return this.value;

If we had to write an interface we can write like this..

interface MyInterface 
value: number;
init(a: number): number;

Typescript classes also supports inheritence.

3. Modules

TypeScript modules provides us a mechanism, so that we can express the module pattern effectively. Now what I mean by this is that in the current version of JavaScript, module pattern helps us to build an organization structure and dynamic loading options by drawing a boundary around software components. And to achieve this module pattern effectively we have TypeScript in front of us.

module abc 
var str = "hi";
export function func()
return str;

abc.func()//How can we call the function func

4. Lambda Functions

We can also use Lambda Functions in our TypeScript program. Lets see how is it Look like...
Function func = (a: number) => a * a;
//Interesting isn't!!

What are the developments tools required?

COMPILER: There is a TypeScript compiler available i.e. tsc
IDE: Microsoft also provides a plug-in for Visual Studio 2012


Simply TypeScript is a superset of JavaScript as I had already mentioned. So it is very much easy to learn typeScript if you are familiar with JavaScript. You can check the source code of TypeScript in CodePlex, since its an Open Source.




Hope this article was useful and do let me know your feedback.


Author: Prachi Kulkarni10 Oct 2012 Member Level: Gold   Points : 0

Thanks for sharing this useful information.

Best regards,
Prachi Kulkarni.

Guest Author: Aneesuddin Arif02 Nov 2012

Hi Gopesh,

Thanks for making simple introduction to TypeScript.

Guest Author: Aneesuddin Arif02 Nov 2012

Hi Gopesh,

Thanks for making simple introduction to TypeScript.

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: