Home United States USA — software Old Habits Die Hard, But Getting New Ones is Essential. Tips on...

Old Habits Die Hard, But Getting New Ones is Essential. Tips on Getting the Most Out of TypeScript

203
0
SHARE

This article looks at the main reasons why TypeScript is so popular with developers and gives some tips to help you get the most out of TypeScript.
Join the DZone community and get the full member experience. In web development, no one is surprised when a new framework or library enters the stage. Implementing complex functionalities and creating UI elements from scratch only using the powers of a specific programming language is not always the most optimal way. Instead, developers either rely on the existing frameworks or create their own for internal use. In the case of programming languages, the situation is a little more complicated. A fairly large number of coders are unhappy with the limitations of the programming language that they use every day. Therefore, from time to time, we can hear about the new programming language release. The question is, will the development community adopt it as a replacement for well-established technologies? As an example, we can take a look at Dart. It was initially released in 2011 but remained quite unpopular until the Flutter framework was launched in 2017. TypeScript can be considered as an exception to this rule. This technology is less than 10 years old, but its popularity among developers is quite high. For example, over the past six months, the number of weekly TypeScript npm package downloads has exceeded 31 million: Today, we’ll consider the main reasons behind such popularity and share some tips that will help you to get the most out of TypeScript. As the name suggests, TypeScript makes more emphasis on using types when you create your application. Its creators took the best of JavaScript and made a step forward by adding type definitions. TypeScript is an open-source language, so any developer who has enough curiosity and skills can dive into the source code and contribute via GitHub. At first sight, a TypeScript app may look like something written with JavaScript with a pinch of typed data. In practice, close attention to types prevents developers from incorrect usage of data. Let’s look at an example any developer can see in one of his or her functions: In TypeScript, when you run this code and try to use something like makeOlder(doggo), you’ll receive an error, since this function is not expecting a string. In the case of JavaScript, you’ll receive Snoopy1 as a result with no error notifications. Such behavior can cause a problem that will pop up somewhere in the code, and you’ll have to show your best bug tracking skills to find its source. Nowadays, the pace of technological advancement is breathtaking. Probably, for everybody, except web developers.

Continue reading...