This website uses cookies for analytics and to improve provided services. By choosing I Accept, you consent to our use of them and other tracking technologies according to our Privacy Policy
typescript

Exploring TypeScript from a Business and Software Development Perspective

TypeScript has been around long enough to firmly lodge itself in the developer community, particularly in the JavaScript realm. But what exactly makes this superset of JavaScript so coveted by developers? And does having TypeScript translate into concrete business benefits for companies that use it in their stacks? Let’s find out.

What Is TypeScript?

TypeScript is a superset of JavaScript that outputs code in pure JavaScript. An open-source programming language officially released in 2012, after two years of development at Microsoft, TypeScript was created by Anders Hejlsberg, the lead architect of C#, to address JavaScript’s shortcomings in creating scalable applications.

TypeScript takes a lot of properties from static-typed languages such as C#. In fact, one of the biggest differences between JavaScript and TypeScript is that the latter adds optional static typing to the code.

TypeScript not only transpiles the code into JavaScript, but also allows developers to make liberal use of JS libraries, tools, and frameworks. You can conveniently write in TypeScript using React, Node.js, or jQuery.

Some notable features TypeScript borrows from other languages include:

  • generics
  • interfaces
  • access modifiers
  • null checking
  • namespaces

Popularity

TypeScript has a relatively stable position on the market, consistently placing somewhere in the middle of the pack in the annual Stack Overflow Survey.

 

most popular programming languages, rank from stackoverflow

 

Most popular programming, scripting, and markup languages. Source: Stack Overflow Survey 2019

In terms of popularity, in the last two years TypeScript pulled ahead of Ruby, Shell, and C. In the latest State of Octoverse report, which tracks programming language popularity over time, TypeScript ranks seventh.

 

typescript among other languages - a graph

 

TypeScript among the most popular programming languages in recent years. Source: The State of Octoverse

Developer Affection

Developers love TypeScript. For the past three years, TypeScript has been consistently leading the JavaScript flavour rankings in the annual State of JavaScript Survey.

 

Awareness, interest, and satisfaction ratio. Source: The State of JavaScript 2019

Moreover, TypeScript placed second in the most-loved languages category in the 2019 Stack Overflow Survey—a tie with Python.

TypeScript from a Business Perspective

#1. Less Development Time

Thanks to a 15% reduction in bugs across the board, most developers observe a corresponding reduction in development time, which, in turn, gives them more time to work on application logic and fix errors that can be detrimental to in-app performance and usability. TypeScript’s compiler also helps shorten the QA and testing process in later stages of development.

#2. Easy Migration

Because TypeScript essentially transpiles to JavaScript, the adoption of existing code to TypeScript is easy and fast. Meanwhile, static type analysis and compiler allow developers to migrate to TypeScript by simply running the compiler and adding typing where it’s not recognized by the language. There’s no need to make changes to the code.

#3. Robust Compatibility

TypeScript seamlessly integrates with React or Vue on the frontend, and Node.js on the backend. Moreover, you can also use TypeScript to develop cross-platform mobile apps with React Native.

Backward compatibility is also quite impressive since TypeScript can be transpiled to JavaScript versions as low as ECMAScript 3.

Looking for TypeScript developers?

Our devs are so communicative and diligent you’ll feel they are your in-house team. Work with experts who will understand your business and squeeze the most out of TypeScript!

Talk to our team and confidently build your next big thing.

Who Uses TypeScript?

Slack

Catering to professionals all around the globe with seamless and interactive collaboration and communication tools, Slack has fast become an indispensable resource to many around the globe. It’s also one of the most popular applications to have been built with TypeScript.

Slack decided to adopt TypeScript to keep the risk of their desktop app crashing to a minimum. Slack’s engineering team was particularly happy with the decrease in bugs caused by misspelling or other errors when converting their code to TypeScript.

Asana

The development team behind Asana has also been quite outspoken in their support for TypeScript. Having adopted the technology in 2013, Asana now writes all of its new frontend code in TypeScript.

On their blog, Asana engineers published a number of posts on the subject, including a breakdown of the good practices they have been following for TypeScript, and a detailed list of pros and cons of the language as seen from the developer perspective.

Revolut

A leader in digital banking, Revolut began incrementally adopting TypeScript in June 2018. They liked the language so much that they soon migrated to TypeScript entirely.

Accenture

Accenture’s engineering team has its own Github repository, with 111 repos as of April 2020, and the company is actively looking for developers skilled in TypeScript.

Angular

One of the most prominent examples of TypeScript adoption, Angular was written entirely in the language.

As Google built Angular with large-scale apps in mind, it should come as no surprise then that they chose TypeScript as the main language for Angular-developed applications.

Ionic

Ionic uses TypeScript in a variety of its products: Ionic Framework, Stencil, Studio, and AppFlow. On their company blog, the Ionic team explained that they chose TypeScript to scale large and complex codebases.

Ionic were particularly fond of TypeScript’s static type checking and the resulting decrease in bugs. They also brought up a handful of other features they really liked, including the autocomplete feature integrated with a variety of IDEs as well as the ability to incorporate the latest JavaScript features (otherwise unreadable by some browsers and requiring additional tools, e.g., Babel, to work).

Why Use TypeScript?

Dealing with large JavaScript codebases makes it relatively easy to introduce bugs. Because JavaScript is dynamically typed, the language allows one variable to have multiple properties assigned to it. In other words, JavaScript doesn’t instantly let developers know what a variable can contain, which, in turn, makes it easy to assign wrong properties—JavaScript won’t flag them.

TypeScript, on the other hand, analyzes the code and tries to determine proper variable types prior to runtime. With large codebases, this is an invaluable asset because once a variable type is assigned, it remains unchanged. In JavaScript, variables can start as one property, say, a number, and then change somewhere down the line, into an object or a string. These inconsistencies can then generate lots of problems that are particularly tricky in large apps.

Because of this, TypeScript is the go-to programming language for building larger applications with big codebases, multiple dependencies, and modules.

TypeScript from the Developer Perspective

For a developer, the experience of working with a certain language often has considerable influence on the resulting quality of the built software. And TypeScript has been rather universally praised for features that significantly elevate the developer experience. The two most frequently lauded features of TypeScript, according to developers participating in the 2018 State of JavaScript survey, were:

  • Robust, less error-prone code
  • Elegant programming style and patterns

Now let’s look in detail at how they translate into improving the development experience.

#1. Variable Checks

TypeScript helps developers quickly figure out the purpose of a variable within the code (you can quickly check the variable name and the data it contains). Plus, TypeScript can actually suggest available properties in functions, classes, or components.

Being able to quickly look up a variable is important because it reduces the likelihood of calling the wrong function or accidentally skipping a variable declaration—fixing bugs like these is cumbersome and takes time.

#2. Bug Checks

TypeScript is a static language, meaning it performs type checks upon compilation, flagging type errors and helping developers spot mistakes early on in development.

According to University College London, static type systems can reduce the number of bugs by up to 15%. While that may not seem like a lot at first glance, when you consider large codebases, a drop like that can mean saving hours of precious development time.

#3. Readability

Clear and readable code is easy to maintain, even for newly onboarded developers. Because TypeScript calls for assigning types, the code instantly becomes easier to understand and work with. As such, TypeScript code is essentially self-documenting, which allows distributed teams to work much more efficiently without having to spend a lot of time familiarizing themselves with a project.

#4. Structural Typing

While it might be initially cumbersome to those coming from a JavaScript background, structuring the code using types and interfaces lets developers think ahead in terms of design. Again, this is particularly important in large-scale applications.

JavaScript gives developers more flexibility in this regard, but with that flexibility comes the risk of messing the code up, so it’s essentially up to the developer and their experience with JS to ensure the structure is controlled right from the start.

#5. IDE Support

TypeScript’s integration with editors (equipped with an autocomplete feature) makes it much easier to validate the code thanks to context-aware suggestions. TypeScript can determine what methods and properties can be assigned to specific objects, and these suggestions tend to increase developer productivity (and decrease the need to check the props).

#7. JavaScript Libraries & Tooling

Even though JavaScript libraries can be used freely with TypeScript, they don’t have type definitions by default, so you have to add them manually. The upside is that you can use the community-built repo DefinitelyTyped to conveniently define types and enjoy JS libraries.

Add TypeScript Where It Fits

Before making any major changes in your tech stack, do a cross-analysis of available time, budget, skills, and resources. Just because it’s loved by developers and works well in certain use cases—specifically large-scale applications—doesn’t mean you should go with TypeScript, too. An informed data-backed analysis will give you a clear answer as to whether you should add TypeScript to your app or whether another technology, or even pure JavaScript, will fit your project better.

What's the Future of Proptech Development?
10+ Ways to Optimize Your App Development Cost
jitsi illustration Jitsi, a Video Conferencing Alternative to Zoom and Google Hangouts