Getting Started With TypeScript 2.0

Hi friends !

In this series of articles, we are going to learn TypeScript with all the features of TypeScript 1.x along with TypeScript 2.0. But, before proceeding for details, let’s start with the very first question that always arises in front of all Server-side developers. If all applications will support only JavaScript frameworks like JavaScript, jQuery, and AngularJS etc., what will be the future of Server-side programs?
 
Well, don’t worry about that. Here is the answer. Microsoft always helps with the new updates in Visual Studio along with new programming languages to support all Microsoft Technology developers. TypeScript is a new language built by Microsoft. So, let’s see more about that.

Q. What is TypeScript?

Answer - As per the official document of TypeScript, TypeScript is an open source programming language and a Super set of JavaScript that compiles to plain JavaScript.

TypeScript

Q. How Does TypeScript Compiler Convert TypeScript to JavaScript?

Answer - TypeScript has its own syntax and types but JavaScript doesn’t. So, TypeScript uses a “transpiler” that converts our TypeScript code (i.e. ES6 + types) to ES5 or ES3 JavaScript code so we can use it in today's browsers.

TypeScript

It is mainly used for making large scale applications in JavaScript. The TypeScript Compiler is itself written in TypeScript. We can write our code in TypeScript syntax and when the .ts code file is saved, it automatically creates a new file into your solution as Code.js; just use this output Code.js file as a Script file reference into your view, like .html file.

If you are a web developer with a rich experience of server side languages like: ASP, ASP.NET, or JSP, you must be familiar with OOPS; but JavaScript is Object Based Script language. Maybe you are not so comfortable with dynamic languages but TypeScript gives you some features with them so you can solve the problem of static type and interfaces, class, inheritance, and many more behaviors of OOPs like we have in C# or Java, to make you feel comfortable.

Q. What are the features of TypeScript?
Answer - TypeScript has lots of features. The important ones are given below. 

Features of Typescript
  1. Type annotation and compile time checking
  2. Support classes.
  3. Support Modules for modular programming.
  4. Allow to use Interfaces
  5. Enumerated Type
  6. Generic
  7. Type inference
  8. Type erasure
  9. Namespaces
  10. Tuple

New Features from TypeScript 2.0

  1. Null- and undefined-aware types
  2. Control flow based type analysis
  3. Tagged union types
  4. The never type
  5. Read-only properties and index signatures
  6. Specifying the type of this for functions
  7. Glob support in tsconfig.json
  8. Module resolution enhancements: BaseUrl, Path mapping, rootDirs and tracing
  9. Shorthand ambient module declarations
  10. Wildcard character in module names
  11. Support for UMD module definitions
  12. Optional class properties
  13. Private and Protected Constructors
  14. Abstract properties and accessors
  15. Implicit index signatures
  16. including built-in type declarations with --lib
  17. Flag unused declarations with --noUnusedParameters and --noUnusedLocals
  18. Allow duplicate identifiers across declarations

So, that was all about TypeScript features and descriptions. In the next article, we’ll see the environment setup and how to create your first program with TypeScript.

Thanks for reading this article and stay tuned with me for more technologies.