Yes Angular
is an incredible framework. And now in version 4 it is increasingly stable and concise.
But the key question is typing . And the responsible for this within Angular
is TypeScript .
What is TypeScript?
TypeScript is developed by Microsoft, and is a large-scale JavaScript development language. In it you can write programs with object-oriented structure, with interfaces, class, methods and attributes with access level, etc. In addition to having strongly typed variables. TypeScript takes the code written with its structure and turns it into pure JavaScript, so that it can be executed by the browser, any of them, Node.js and JavaScript engines that support ECMAScript 3.
What is the relationship between TypeScript and Angular?
To start Angular
is written in TypeScript
. Soon when designing your application in Angular
it is necessary to use the TypeScript
language to create your classes, interfaces, methods and so on. It is worth remembering that every program JavaScript
is a valid TypeScript program.
Official Site: typescriptlang.org
What are the advantages of TypeScript typing?
No doubt the main advantage is checking the code. If you are working with a variable of type integer
, you will not be able to 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 traceability of errors, and a clearer code regarding the intentions of the same.
We also have:
- The aesthetic factor of the code, which can be considered an advantage by some people.
- The IDE support factor. Allows real-time typing checks, incorrect type assignment errors, and so on. In this regard Visual Studio and Visual Studio Code are well ahead of most.
- The commercial factor. We can not forget that behind this technology is 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 only a blended, the quality of the product depends a lot more on the developer.)
- Other factors: classes (improvements), interfaces, mixins, modules, enumeration, generics, optional parameters and default values in functions and the like, tuples, union types,
What disadvantages do you have?
Given the myriad benefits, I do not think there are really big "downsides". It is worth noting that TypeScript
adds an extra step to every change in the code. You need to transpile the source language for the Vanilla JavaScript which is the target language, without that there is no way to execute your code.