The Rise of TypeScript

Read what makes TypeScript the ultimate choice for your company's complex projects.

...
Kris MulliahPublished on

Launched in 2012 by Microsoft TypeScript is now the open source programming language that programmers are looking to as the solution to the essential tool for handling complex systems. TypeScript has steadily gained popularity over the years to finally become one of the top 10 languages amongst programmers, according to GitHub.

Always seen as a close relative of JavaScript, TypeScript is finally coming into its own as enterprises come to accept that JavaScript was never intended as the foundation for large systems and the modern web. Instead, TypeScript is now the hero that programmers are counting on.

But if TypeScript is so similar to JavaScript then what extra does TypeScript bring to the party? That’s what we will take a closer look at with this article.

TypeScript plays nicely with others

TypeScript brings with it a range of extra functionality that helps programmers to boost productivity whilst easing the development of complex codebases. It’s ability to handle large projects is a key factor behind the success of TypeScript, but that would be a moot point were it not for its inherent versatility.

Compatibility

Browsers and platforms that run JavaScript will work with TypeScript thanks to the compiler that renders TypeScript into basic JavaScript. So, if compatibility issues have stopped you from making the transition to TypeScript there is no need to put it off any longer.

Longevity

Some are concerned about making the transition to a new coding language and subsequently discovering that it will no longer benefit from significant support. There is no such cause for concern with TypeScript since its versatility and compatibility mean it is hugely popular and only growing in popularity.

TypeScript is supported by Microsoft and benefits from a thriving worldwide community of developers. Other than Microsoft, many major companies use TypeScript. They include Asana, Capital One, Lyft, Slack and T-Mobile.

Angular

If you’re planning on using Angular, or adding it to your toolset with a course, then guess what? Yes, Google used TypeScript to build it and it is the main language used for creating Angular apps.

React

Being compatible with JS libraries and frameworks, TypeScript is a natural bedfellow for React and others within the JavaScript universe. Its versatility is one of the factors that makes TypeScript a popular choice for programmers and enterprises.

Upskilling

Since much of the knowledge, skills and syntax used in JavaScript is common to TypeScript it does not take much effort for a programmer to learn what makes TypeScript tick and discover its charms. Bridging the gap in knowledge between the two languages should be a smooth process.

Support

With almost 12 million JavaScript developers worldwide there is no shortage of potential TypeScript coders. Perhaps your company is considering making the transition to TypeScript but is wary of finding coders familiar with the language. If you already have JavaScript developers then with a little training they should quickly pick up the necessary knowledge. There is still much to learn, but JavaScript programmers will already have a big advantage.

Big projects suit TypeScript

Thanks to shared attributes with JavaScript TypeScript is incredibly versatile, but it offers extra qualities that make TypeScript the better choice for complex projects involving distributed teams.

Optional Static Typing

As a dynamically typed language JavaScript users only discover mistakes at the runtime. With TypeScript users are alerted to type mistakes before they ever get to the runtime thanks to Static Typing. This means the code has less opportunity to include errors and offers better performance.

This quality also results in better organised code that is self-documenting and makes debugging more efficient resulting in a team receiving a significant boost in productivity. What makes TypeScript extra versatile with regards to Static Typing is that it does not compel developers to stick to it. Unlike other statically typed languages, developers can adjust how strictly they wish to adhere to the type, and come to a happy medium.

Identifies Common Bugs

At the compile stage TypeScript regularly identifies roughly 15% of common bugs. This saves time and means developers can address those discrepancies. The compiler itself means that testing, while still absolutely necessary, does not need to be done to the same extent.

Syntactic Sugar

The strict types, as well as other elements, mean it is ideal for distributed teams that need to understand what each developer is trying to accomplish. Within TypeScript, code is written in such a way that it is self-explanatory with a developer’s intentions made very clear to others, making it less likely that a project will suffer from lack of communication amongst team members.

Some argue that the syntactic sugar (or syntax sugar) advantage is only possible with the writing of more code, resulting in more work being added to the development process, creating larger files. However, all the extras will be removed once it is transpiled and the browser uses the pared down JavaScript.

Integrated Development Environments (IDE)

With types IDE can really come into its own with features such as code navigation and autocomplete. The editor can spot coding mistakes as soon as the developer makes it, cutting down on time spent on rectifying errors later.

Refactoring

With TypeScript the necessary process of refactoring is simplified. Tools such as find all references, or go to definition are facilitated by the power of IDEs, making it easy to update your app without the way it works being affected. Mistakes can be made during refactoring, but TypeScript will flag the problem, a huge boon when working with the codebase.

Object-Oriented Programming (OOP)

Classes and inheritance are just two supported class-based OOP elements. OOP eases the way for scalable code to be organised, something that is essential as the codebase expands.

Transpiling

Some use transpiling as an argument against TypeScript, saying that it is an extra task that other languages do not require. Yes, it is an extra necessary step since browsers are not currently able to display directly from TypeScript. The code needs to be translated into JavaScript before it can be run. However, the process does not take much time since it is mostly automated.

Sure, there are some downsides to TypeScript, what programming language does not have its drawbacks. Typescript requires transpiling, programmers cannot step directly from JavaScript to TypeScript without some upskilling, and the syntactic sugar quality requires some extra code be written. However, the efficiency and versatility offered by TypeScript when dealing with large and complex projects means the benefits far outweigh the perceived drawbacks. TypeScript is evolving and improving with each new version. At the time of this post’s publication version 4.0 is in beta and includes Variadic Tuple Types, custom JSX factories, editor improvements, and much more.


EDC4IT runs an online and onsite instructor-led TypeScript course.

Follow us on social media for all our updates and to catch the next blog. If you are considering a training course for yourself, or your team, contact us directly. You can also use the chat function on our website.

LinkedIn

Twitter

Facebook

YouTube

Instagram