What advantages does angular typing offer?

Asked

Viewed 471 times

4

I’d like to enjoy as much as Angular can offer. And one of the things I want to understand well is all what the tipagem of Angular helps me at the time of development.

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

What would be the others, I’m studying the Angular at the moment and I’m finding the same amazing.

2 answers

3

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

Among the perks:

  1. Because you have a JavaScript heavily typed;
  2. You take advantage of the knowledge of POO to write better apps JavaScript small or large;
  3. The Angular2 recommends the use of TypeScript for its development;
  4. Global teams will benefit from the use of TypeScript, whereas errors can be detected while the code is typed.

Thus, TypeScript is a super set of language JavaScript that provides classes, interfaces and tipagem optional static.

Adopt the TypeScript can bring a productivity gain and result in a more robust product due to its simplicity and already consolidated idea.

2


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.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.