TypeScript is included as a first-class programming language in Microsoft Visual Studio 2013 Update 2 and later, beside C# and other Microsoft languages. An official extension allows Visual Studio 2012 to support TypeScript as well.
Anders Hejlsberg, lead architect of C# and creator of Delphi and Turbo Pascal, has worked on the development of TypeScript.
The annotations for the primitive types are
string. Weakly- or dynamically-typed structures are of type
The TypeScript compiler makes use of type inference to infer types when types are not given. For example, the
add method in the code above would be inferred as returning a
number even if no return type annotation had been provided. This is based on the static types of
numbers, and the compiler’s knowledge that the result of adding two
numbers is always a
number. However, explicitly declaring the return type allows the compiler to verify correctness.
When a TypeScript script gets compiled there is an option to generate a declaration file (with the extension
The concept of declaration files is analogous to the concept of header file found in C/C++.
TypeScript supports ECMAScript 2015 classes that integrate the optional type annotations support.
Modules and namespaces:
The TypeScript compiler, named
The current version of the compiler supports ECMAScript 5 by default. An option is allowed to target ECMAScript 2015 to make use of language features exclusive to that version (e.g. generators). Classes, despite being part of the ECMAScript 2015 standard, are available in both modes.
The above is a brief about TypeScript. Watch this space for more updates on the latest trends in Technology.