X
Business

Microsoft's TypeScript language: Startup reveals long journey to JavaScript spin-off

Startup Heap details how it initially failed to switch from CoffeeScript to TypeScript programming language.
Written by Liam Tung, Contributing Writer

US analytics startup Heap announced five years ago that it was saying goodbye to CoffeeScript and moving the front end of its web app to Microsoft's TypeScript 'superset' of the JavaScript programming language. 

However, the large migration project wasn't a screaming success. A Heap engineer has now revealed that it failed in its first attempt at migrating to TypeScript because it overlooked one key factor: human relationships. 

Fortunately for Heap engineers, they finally cracked the puzzle earlier this year by refocusing its migration so that it became "centered around people, not just tech".

SEE: How to build a successful developer career (free PDF)

According to Heap software engineer Luke Autry, there was a "broad preference for TypeScript" among fellow engineers, but the company was moving in the "wrong direction" in terms of its goal to switch entirely to TypeScript. 

"Yes, we were adding TypeScript code, but we were adding CoffeeScript at a faster rate," explains Autry. 

"TypeScript and CoffeeScript target the same Node.js runtime, which you'd expect to help ease the transition, but despite the widespread desire to shift we hadn't built up much momentum and we weren't trending towards a future without CoffeeScript."

While TypeScript has become one of the most popular JavaScript-related languages in recent years, CoffeeScript has been heading in the opposite direction. 

One study rated CoffeeScript as one of the worst languages to learn in 2019. However, CoffeeScript still has some fans, as can be seen in a debate involving Heap engineers on Hacker News.    

Anyway, according to Autry, the key to reviving the TypeScript migration was figuring out how to get developers on board. His team believed this goal could be achieved by demonstrating to them that they could be more productive when writing TypeScript. 

"If the team saw the change simply as a neutral shift between syntaxes, we'd never get buy-in. If the switch didn't make their day-to-day experience more productive, inertia would win out, even if engineers generally prefer to write typed code," wrote Autry

With the focus now on developer productivity, engineers looked for areas of the codebase that would produce obvious gains, such as concentrating on converting files that delivered quick wins, as well as prioritizing tooling and configuration.

There were also technical barriers to be overcome. The migration team, for example, noticed engineers often needed to import special utilities to use TypeScript. So it focused on helping developers, so that they could write TypeScript in any service or component. 

"Whether it's the back-end, front-end, scripts, or devops tasks, we wanted our engineers to be able to write code in TypeScript and have it just work," explained Autry. 

He details a number of other steps the company took to ensure that the conversion process was simple, safe and automated, as well as improving the code review process. 

SEE: Microsoft TypeScript 3.7: Programming language beta lands with all these features

Of course, ensuring everyone was able to feel and be productive meant offering a way for teammates to share problems that others may have the experience to solve. So the migration created a #typescript channel in Slack where developers leading the migration could answer questions and monitor for common issues. 

"Developers need to know that any language and tooling questions they have will be answered promptly," wrote Autry. 

"We decided to have the 'TypeScript champions' prioritize questions ahead of their own work. While this slowed down their work, it also removed a number of potentially major blocks to the migration." 

The final key ingredients were tracking progress over time and having the fortune of being led by a business that allowed engineers to figure out the best way to achieve the goal of migrating totally to TypeScript.

image2-1168x7221.png

Heap's initial attempts to migrate resulted in the startup writing TypeScript code but still adding CoffeeScript at a faster rate.  

Image: Heap
image1-1168x7221.png

By focusing on developer productivity, Heap this year has succeeded in finally getting TypeScript to outstrip CoffeeScript.  

Image: Heap

More on Microsoft's TypeScript and programming languages

Editorial standards