TypeScript (TS) is a modern open source language, which extends the Javascript syntax, providing it with a strict markup of data types, classes and modules.
Nowadays, Javascript has become a very popular language, it is not the same as it was ten years ago. In today’s market it is no longer only mandatory to know Javascript, but to know it well.
JavaScript allows us to develop all kinds of solutions and large companies are betting on it, and through the amazing Nodejs platform, Ionic and Electron technologies are integrated for the development of mobile and desktop applications.
But we must recognize that Javascript still has some limitations
- Lack of strong and static typing (strict variable types).
- Access modifiers (public, private, static).
- Lack of interfaces and inheritance.
- Modules (partially solved with require.js, although it is far from perfect).
Typescript overcomes these limitations, allowing us to develop in Javascript in a more comfortable, orderly, clean and completely object-oriented way.
TypeScript will compile to Javascript code, therefore, it will be compatible with all your projects and with almost all the libraries you use, such as Angular, jQuery, among many others.
This language does not require any type of plugin, since what it does is to generate standardized Javascript code, which runs on any browser, platform or operating system.
Using TS will allow us to use Javascript with:
- Strong typing
- Interfaces and inheritance
- Array Types
- Classes and modules
There are several on the market such as CoffeeScript and Babel, but TS is supported by Microsoft and personally we find its documentation and syntax much more rich and friendly. An example of its use is Angular2 which has been written entirely in TypeScript.
If you want to have a closer look at TypeScript you can use the online compiler Playground.
To install and learn TypeScript we obviously recommend their web site and read all their documentación, but there are currently free basic courses available:
https://www.udemy.com/typescript
https://www.edx.org/course/introduction-typescript-microsoft-dev201x-1 (without certificate)
After using TypeScript you won’t want to go back to conventional JavaScript.