In the web development space, there is always a trend and these trends are not always alike.
When the shortcomings of a well-established stack become too inconvenient, alternatives appear and sometimes pass from the status of novelty to that of an unavoidable trend, before being inexorably replaced in their turn.
Here, with the successive appearance of frontend frameworks: jQuery (2006), Backbone.js (2010), React (2013), Vue.js (2014), PolymerJS (2015), Angular (2016)… Some of these technologies have (almost) fallen into oblivion, while others have now become standards in web development.
Among these trends, TypeScript is certainly one of those technologies that raise the most questions.
In short: YES, you should learn TypeScript when you are a JS developer!
Now, let’s get to the explanations…
TypeScript: What it is and why should I care?
TypeScript is a programming language whose first public version (0.8) was released in October 2012 after two years of internal development at Microsoft.
It can be used on both the client side and server side with NodeJS.
By default, TypeScript compiles to ECMAScript 5 (JS version from 2009, the current standard supported by modern browsers) but can also target ECMAScript 3 (1999 version supported by all browsers) or ECMAScript 2015 (version 6, not supported by Internet Explorer).
What are the benefits of learning TypeScript?
TypeScript is a language whose mastery is increasingly sought after by companies. This growing popularity is easily explained by the considerable advantages that TypeScript brings.
TypeScript makes development easier and improves the developer experience
Conversely, some languages like Java or C++ have static typing: where the type of each variable is defined in the code and is therefore known when the code is compiled.
If a value of a certain type is assigned to a variable (or as an argument of a function) defined as being of another type, an error will be generated during compilation and the program cannot be executed.
There are many different types, the most common of which in programming are: Number ( int for integer, float for decimal), a Character string ( string ), Table ( array ), Boolean ( boolean )… Some do not exist in TypeScript, but this language offers other advanced types such as Any & Unknown, Void, or Never. You can read more about these types in the TypeScript documentation.
Your program then knows, before it is executed, which types of values are accepted for which variables.
No need to waste time digging through many files or in the docs of a library trying to find out which parameters a particular function accepts or which fields are present in a particular object: your TypeScript-compatible IDE (Visual Studio, WebStorm, Eclipse, Atom…) will let you know as you write your code.
This kind of self-integrated and always up-to-date documentation of the latest changes speeds up and facilitates the development of complex applications where many developers are called upon to collaborate and their debugging.
TypeScript will make you a better developer
Although optional, the static typing of variables and functions supported by TypeScript allows you to define specific data structures early in your app development.
This imposes a framework and rules that will have to be respected and thus pushes for a more coherent design of the application as a whole while limiting the risks of breaking by making significant changes in the code.
Learning TypeScript is also a great way to nurture yourself with programming concepts you may not have known before. Beyond types, TypeScript also uses other notions:
- interfaces ;
- Enumerations _or enums ;
- _ Classes ;
- Unions and intersections ;
- _ Namespaces.
Already present in other statically typed programming languages such as C++ or Java, becoming familiar with these concepts will make it easier for you to tackle other languages in the future if you wish.
TypeScript is easy to learn and has an active community
TypeScript is used and supported by the most advanced tech companies such as Microsoft, Google, Airbnb, Shopify, Adobe, and Mozilla.
Since these companies are obviously used to deploying huge, extremely complex applications on a very large scale, one can only be convinced of TypeScript’s ability to guarantee scalability, optimal reliability, and performance.
The adoption of TypeScript by these technology leaders has helped popularize this language and federated a large and very active open-source community that publishes a large number of educational resources and tools.
GitHub Octoverse also places TypeScript in 5th position among the languages with the fastest growth between 2018 and 2019 (161%) ahead of Python (151%) and Go (147%).
For corporate projects, Microsoft has even published a guide to switching to TypeScript discreetly without anyone noticing, and therefore without having to convince your colleagues.
TypeScript does not fix all problems
As you can see, TypeScript is a great solution for facilitating development and communication between developers — but it’s not a miracle solution!
Its power and especially its reliability are thus proportional to the rigor with which the developers will use it.
Its use also does not dispense with setting up unit testing and functional testing.
Is it relevant to learn TypeScript in order to have a better CV?
As we’ve seen; many companies have moved to TypeScript, including the biggest tech leaders. This skill is increasingly demanded by job offers.
For example, about 1100 job postings on Indeed France referred to TypeScript in September 2020, almost as many as those referring to Node.js (about 1200).
Learning TypeScript today is also an opportunity not to be missed: it is still early enough to be in the “ early majority ” and acquire a skill on your CV that will continue to be valued.
- Connecting nodejs with MySQL
- What can Nodejs do?
- Snowflake beginners guide
- Postman guide
- Mongodb guide for beginners