TypeScript is a programming language based on JavaScript.
TypeScript development began in late 2012. Although it originated at Microsoft, and its actual creator is the programmer Anders Hejlsberg, also known as the creator of such languages as Delphi, C #, but this project immediately began to develop as OpenSource. And from the very beginning, the new language began to spread rapidly due to its flexibility and performance. A lot of projects that were written in JavaScript began to be ported to TypeScript. The popularity and relevance of the ideas of the new language led to the fact that a number of these ideas subsequently became part of the new JavaScript standard. The benefits of TypeScript have been taken up by the creators of a number of common and widely used frameworks. By the way, some of the most popular web frameworks – Angular 2+ and Vue3 are completely written in TypeScript.
However, it would seem, why do we need another programming language for the client side on the Web, if traditional JavaScript, which is used on almost every site, which is owned by many developers and for which the support in the programming community is quite high, does the same job perfectly. . But TypeScript is not just new JavaScript.
First, it should be noted that TypeScript is a strongly typed and compiled language, which would perhaps be closer to programmers of Java, C#, and other strongly typed languages. Although at the output the compiler creates the same JavaScript, which is then executed by the browser. However, strong typing reduces the number of potential errors that might occur when developing with JavaScript.
Second, TypeScript implements many of the concepts that are native to object-oriented languages, such as inheritance, polymorphism, encapsulation and access modifiers, and so on.
Thirdly, the potential of TypeScript makes it faster and easier to write large complex complex programs, respectively, they are easier to maintain, develop, scale and test than in standard JavaScript.
Fourth, TypeScript is developed as an open source project and, like many projects, is hosted on github. The repository address is https://github.com/Microsoft/TypeScript . In addition, it is cross-platform, which means that we can use both Windows and MacOS or Linux for development.
At the same time, TypeScript is a typed superset of JavaScript, which means that any JS program is a TypeScript program. In TS, you can use all the constructions that are used in JS – the same operators, conditional, cyclic constructions. Moreover, the code on TS compiles to javascript. Ultimately, TS is just a tool that aims to make application development easier.
The JS code generated by the TypeScript compiler is supported by the vast majority of browsers. Although during the development process, we ourselves can set the target standard for ECMAScript.
How to use TypeScript? Since this language is OpenSource, all its tools are available to everyone. To work with TypeScript, we can use both Windows and Linux and MacOS.
The TS compiler itself can be installed using the npm package manager command that is used in Node.js:
> npm install -g typescript
To write code in TypeScript, you can use any of the simplest text editors. Many text editors and development environments, such as Visual Code Studio, Atom, Sublime, Visual Studio, Netbeans, WebStorm, and others, have TypeScript support at the plugin level, which allows you to take advantage of a number of benefits, such as code highlighting or tooltip on types and constructs language.