Nowadays the world of frontend technologies seems overwhelming, some people comment that every day a new technology or a new framework appears, each one selling itself as the best of the best. So being up to date is a challenge.
The frontend is the layer of applications that are most in contact with the user and which encompasses disciplines as important as interface design, UX user experience, usability, graphic design, aesthetic, artistic sensitivity and even psychology. That is why we make such an important effort to improve and apply the latest advances in technology.
I have the opportunity to present a language that does not lack attributes to give much to speak in the coming months.
Typescript
It is called Typescript , originally created by Microsoft , is a language based on Javascript but with some improvements that I will present below.
Only with its name and we can intuit some of its characteristics, " type " in Spanish "type", it induces us to think that it is a typed language, as it is, in Typescript we have static typing optionally, ie we can decide to Priori the nature of the content that we are going to store in a variable.
JavaScript is the quintessential programming language on the client side (web browser) and almost everyone frontend web revolves around this language. And this means that it works very well.
However, each time the work we want to perform is more and more heavy,
And today the purpose of this language is far from the original purpose.
Originally thought to get small effects, animations or some ajax request very locally, giving a little "life" to pure HTML. As a result, little by little we have been squeezing the potential until we can create complete applications with Javascript.
So we can say that it has an infinite power, but it drags some small discomforts that can be limited or prevent your project can climb properly.
Only with its name and we can intuit some of its characteristics, " type " in Spanish "type", it induces us to think that it is a typed language, as it is, in Typescript we have static typing optionally, ie we can decide to Priori the nature of the content that we are going to store in a variable.
JavaScript is the quintessential programming language on the client side (web browser) and almost everyone frontend web revolves around this language. And this means that it works very well.
However, each time the work we want to perform is more and more heavy,
And today the purpose of this language is far from the original purpose.
Originally thought to get small effects, animations or some ajax request very locally, giving a little "life" to pure HTML. As a result, little by little we have been squeezing the potential until we can create complete applications with Javascript.
So we can say that it has an infinite power, but it drags some small discomforts that can be limited or prevent your project can climb properly.
"Typescript is defined as a superset or Javascript superset."
What is a Javascript superconjuno?
In programming, we understand a superset of a language, as another language fully compatible with the first, but also offers new functionalities. Do not worry if it sounds weird, later on we'll give examples.
The superset languages are created to fill gaps or solve certain problems that occur in the language "father", in our case Javascript.
Putting ourselves in context Javascript is based on ECMAScript (ES) and is the one that defines the characteristics of the language.
ECMAScript with each version evolves the language and introduces new improvements.
Typescript tries to adopt such improvements, along with some additional own features.
Specifically for Javascript there are more than 50 superset, which can be consulted in this directory , within this list we can highlight the 3 most popular and important TypeScript , CoffeeScript and Dart . By far the most commonly used is TypeScript.
What sense does TypeScript have when ES evolves?
The problem that exists when a new version of ECMAScript with new features comes out is that to be operative they must also update the interpreters , (in this case the web browsers), and this step is usually slow and expensive.
In this sense TypeScript does very well, since it offers advanced features of the latest ECMAScript standards, but allowing a compatibility with the current web browsers.
In short, with TypeScript, developers can anticipate the future of Javascript and have from this moment of sensible improvements in the language, without worrying about the compatibility with the web browsers of its users.
What does TypeScript offer?
We have already introduced that in TypeScript we have optional static typing, but this is only the beginning.
Some effect of having static typing are as follows:
- Have errors between types at compile time (better than at runtime).
- It makes the IDES (programming environments), give us more help, allowing to autocomplete in a more precise and intelligent.
Other very interesting features:
- The main point of TypeScript is to incorporate the object- oriented programming paradigm (OOP), allowing to create classes and make inheritance, through constructions easier to read or to express (syntactic sugar). All this allowing compatibility with versions prior to ECMAScript 2015.
- Visibility between attributes of the classes, using modifiers "public", "protected" or "private".
- Declaration of variables using `let` instead of` var`, characteristic of (ES6). It offers better control of the range of variables. You can expand the information in the following link .
- Decorators , which allow to add functionality to an object dynamically, extensamene used in Angular2.
This is just one of the most reprehensible things, but there are many more, so I invite you to read the official documentation .
Where is the magic?
The secret of this technology lies in the TypeScript " transpiler ".
It's a kind of compiler that transforms our Typescript code to Javascript with the ECMAScript compatible version we want.
To apply "compilation" on a file we apply the command:
> Tsc example.ts
At the end of the process we will find a new example.js file.
How to install TypeScript?
To install TypeScript the first thing we need is to install NodeJs on our computer, for this go to the official page .
Using the package manager npm we can install TypeScript with the command.
> Npm install -g typescript
Development Environment for TypeScript
To develop with this language we count extensions for the majority of IDEs and publishers.
- Atom, link plugins for atom .
- Sublime Text, link plugins for sublime text .
- Webstorm 2016, it counts very good support for TypeScript.
- Emacs
- Visual Studio Code
- Netbeans
- Eclipse
- Visual Studio
Where can I use TypeScript?
In summary TypeScript can be used in all environments where Javascript is used, either web running in the browser or NodeJS applications.
It is currently having a great success, and is that Typescript has been adopted by Google to develop the new version of its powerful framework AngularJs 2 , with all the controversy that this entailed.
But it's not the only one, many other frameworks have also switched to Typescript, such as React or Ionic2 .
We also have typed versions of the most popular libraries like Jquery.
We also have typed versions of the most popular libraries like Jquery.
Do we see an example?
It is time to put into practice some of the "little things" we have seen, and see a little code.
We start with an easy example, in the next image we see how we generate a Javascript class (right part of the editor) from a Typescript file (left part of the editor).
In the catch we see an error, I purposely commit to see an example of errors due to incompatibility of types when we use static typing.
The example is simple, so you may not be very convinced of the power of Typescript, so I propose an example of a "more complex".
In the following example we see how the inheritance works. In this first fragment of code we see a generic class Vehicle.
In this code fragment we see how from the Vehicle class we inherit to create specific classes for Moto and Truck. Finally we see how we can instantiate the objects and invoke their methods.
We hope this post has helped you to understand a little better Typescript and all the benefits it can bring.
If you find the topic interesting and you think it may be useful for other readers, do not hesitate to share it on social networks and leave a comment if you want to complement the post ;-)
Many of us have often seen a pop up come on our screen which says we need to run Java or update JavaScript. Most of the people get confused between these two and wonder what the difference between Java and JavaScript is.
ReplyDeletesnipplr
cool casino. good reputation. real money good online casino games I was convinced of this self-respecting. and I advise you.
ReplyDeleteI recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing.website maintenance agency
ReplyDeleteAs I website owner I think the articles here is rattling superb , thanks for your efforts. new york website design company
ReplyDeleteDear Katie, I am sorry to hear that your doctor made a mistake and put you on Depo injections. You say that you are still getting injections? These injections are made from progestin, a synthetic form of progesterone which is used mainly as a method of birth control for women who cannot use any other form of birth control. One of the drug’s side effects is weight gain. A single injection lasts for three months. So if you are still getting these injections, please, please, tell your doctor that you don’t want to receive them any longer. The effects of the drug will remain in your body for three months, so during these three months, it may be difficult to lose the added weight which you gained, no matter what you do. There are other more gentler ways to regulate your periods and menses, especially at your tender formative age. Here are some of the negative reasons for not using Depo-Provera: it can cause decreased bone density which can lead to osteoporosis, depression, increased blood clots, liver damage, headaches, hair loss, leg cramps, nervousness, dizziness, abdominal bloating, and weight gain. For your stretch marks on your stomach, you can rub some vitamin E on them. Just puncture a capsule of vitamin E and gently apply to your stomach area once or twice each day. The stretch marks will respond to the vitamin E if you use it regularly and use it as soon as they appear. The older the stretch marks, the longer and more difficult they are to rub away. It is best to use natural vitamin E, which can be distinguished from the synthetic form by the following small print and notations on the vitamin bottle: d- is the natural form, and dl- is the synthetic form. Use only the d- form which is the natural form. I think that synthetic substances have caused enough harm already, and should be laid to rest. Find a doctor who will listen to you, have patience until the Depo drug gets out of your system and body, and continue follow a healthy diet and exercise regimen to get back to your former weight. Please read the posts above to learn more about dieting. Good luck. website designers nyc
ReplyDeleteHmm is anyone else experiencing problems with the images on this blog loading? I’m trying to find out if its a problem on my end or if it’s the blog. Any responses would be greatly appreciated. san francisco design agency
ReplyDeleteRead the blog carefully.
ReplyDeleteWeb Development Easy With AngularJS
En Son Çıkan Perde Modelleri
ReplyDeletesms onay
mobil odeme bozdurma
Nft Nasil Alınır
ankara evden eve nakliyat
Trafik sigortası
dedektör
Website kurma
ask kitaplari
en son çıkan perde modelleri
ReplyDeleteuc satın al
lisans satın al
minecraft premium
nft nasıl alınır
en son çıkan perde modelleri
yurtdışı kargo
özel ambulans