Yes the Angular
is an amazing framework. And now in version 4 is becoming more stable and concise.
But the key question is typing. And responsible for it within the Angular
is the Typescript.
What is a Typescript?
Typescript is developed by Microsoft, and is a large-scale Javascript development language. In it you can write programs with object orientation structure, with interfaces, class, methods and attributes with access level, etc. Besides having strongly typed variables. Typescript takes the code written with its structure and transforms it into pure Javascript, to be executed by the browser, any of them, Node.js and Javascript Engines that support Ecmascript 3.
How Typescript relates to Angular?
To begin the Angular
is written in TypeScript
. Logo when designing your application in Angular
it is necessary to use the language TypeScript
to create your classes, interfaces, methods, etc. It is worth remembering that every program JavaScript
is a valid Typescript program.
Official website: typescriptlang.org
What are the advantages of typing Typescript?
Without a doubt the main advantage is code verification. If you are working with a variable of type integer
, cannot assign a value of type string
to this variable, unlike what would happen in Javascript Vanilla. This allows you to test your application more easily, allows for bug tracking, and clearer code regarding its intentions.
We still have:
- The aesthetic factor of the code, which can be considered an advantage by some people.
- The FDI support factor. Allows real-time, typing checks, errors attribution of incorrect types and etc. In this regard Visual Studio and Visual Studio Code are well ahead of most.
- The commercial factor. We must not forget that behind this technology lies Microsoft, one of the giants when it comes to software development. Knowing that your framework is maintained by Google and Microsoft, brings credibility and trust to your product (Of course this is just a "Blended", the quality of the product depends much more on the developer).
- Other factors: classes (improvements), interfaces, mixins, modules, enumeration, Generics, optional parameters and with default values in functions and related, tuples, Union types, type aliases.
And disadvantages have some?
Given the numerous benefits, I do not think that there are really large "disadvantages". It is worth noting that the TypeScript
adds an extra step to each change in the code. Required transpire from source language to Javascript Vanilla which is the target language, without this there is no way to execute your code.