What are the advantages of angled typing?

4

I would like to enjoy the maximum that Angular can offer. And one of the things I want to understand well is everything what tipagem of Angular helps me at the time of development.

I saw that one of the advantages is that IntelliSense in Visual Studio Code is often activated when typing the information with which we are working.

What would be the others, I am studying Angular at the moment and I am finding the same incredible.

    
asked by anonymous 01.10.2017 / 17:45

2 answers

2

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.

    
03.10.2017 / 22:00
3

You have this tipagem , in fact, thanks to Typescript . Angular 2 is designed to work with Typescript , which is basically a superset of Javascript compiling your typed code for pure Javascript. All Angular documentation is written based on it.

Among the advantages :

  • Because you have a% strongly typed%
  • You take advantage of JavaScript to write better applications POO small or large;
  • JavaScript recommends using Angular2 for its development;
  • Global teams will benefit from the use of TypeScript , since errors can be detected while the code is entered.
  • So, TypeScript is a super set of language TypeScript that provides JavaScript , classes and interfaces static.

    Adopting tipagem can bring productivity gains and result in a more robust product because of its simplicity and already consolidated idea.

        
    03.10.2017 / 20:38