Typescript

Typescript

Typescript is a fairly new programming language released by Microsoft in 2012 and since then it become massively popular.

Introduction

Typescript has taken a ton of previous work for major applications. It is also popular. And all that is, an improved version of JavaScript. TypeScript took a lot of JavaScript, looked at it, said what was wrong with this, added those changes, and off it went, here you go. And the good thing about TypeScript is that it actually varies a lot with JavaScript. In fact, any TypeScript code you type can be changed and translated into native JavaScript code. So you can use any JavaScript you already know within TypeScript, and you can use all the features of TypeScript. Then when it comes time to launch this code, you will translate it into a traditional JavaScript file and use it. This is really powerful because this means that if you want to convert JavaScript files into TypeScript files, it is really easy to do that and vice versa. So that’s where this flexibility comes from and why so many people use TypeScript because it’s just the same, why not? It simply has better features than native JavaScript.

Now TypeScript really shines on great projects and applications at the business level. I would say it is probably a little too much to use it as a small separate project or object when you have one or two JS files. But when you get to a place where you have a lot of structure involved in your system, a lot of things happen, and a lot of people offer thousands of lines of code, TypeScript really shines. The reason for this is because of the features that add up to JavaScript. So as I said, if you know JavaScript, you already know TypeScript well. Anything you can write in traditional JavaScript, almost linear, you can type the same in TypeScript. Then an important feature that actually adds power is the ability to add vertical typing to JavaScript. So this does not change the fact that JavaScript is a duplicate typed language and does not change that when it comes to actually using this code. But it does mean that when you type in the TypeScript code, you have a variety of constraints and you can choose if you want to declare the type of variable, path parameters, return types, whatever it is.

So the reason for static typing is so important that it comes with so many different benefits. If you have solid typing and you have type reinforcement, the first thing that is big money is that catching mistakes becomes much easier. With languages ​​like Python or JavaScript typed, almost all of your errors occur in Runtime Now. That’s not a good thing that you usually don’t want to find your mistakes in Runtime because that means, first of all, you have to find out what’s going on in Runtime, which is more complicated than ever during compilation. But there are also opportunities for you to miss out because you have not yet run, do you? In Python, you can write random gibberish that does not make sense, but will still compile, still use the program. And unless you hit that line of code, you may not know that error really exists. And the same thing is in JavaScript right now. If you have TypeScript here, this is pretty much the solution, I would say, about 90 percent of the errors you usually get in a randomly typed language because now these errors are displayed before you can even start the program. So you have to adjust it if you want to use the code, you will see it because they are squiggly red lines in your editor. Although if you remove an error in Runtime now, you probably need an error correction that you may not be able to access. It is very difficult, in my opinion, to do that during runtime because there are many other things to consider, and then you have to find out where your code actually happens if it is a module. There are a number of potential pitfalls if you do not catch these bugs during integration and when you are working with very large software that results in millions of people, you want to make sure you catch all of them. those bugs, and that you get them in your vision before you go to the software. So that's why this is really a big deal.

Now, TypeScript comes with a lot of other great features, but what I really wanted to drive here was that type. And some people might think that, oh, you know, it would be a pain. I have to announce the varieties, in fact it is not very difficult. It is voluntary, as I said. So you can have two people working on the same code base, one person who likes the genre feature and does all of that, and the other one doesn't. And your code is still relevant and valid. There may be potential problems with that, of course, but the point is that it is optional. So if you are in a situation where it is unreasonable to do so, you do not have to do it. Although in some editing languages ​​it is really mathematical, you have to do it.

So in my opinion, TypeScript is a great language. I do not see why you did not need it. It's that simple, especially if you already know JavaScript. It makes things even more powerful.