James Governor's Monkchips

TypeScript is Exploding, JavaScript is the Fittest

Share via Twitter Share via Facebook Share via Linkedin Share via Reddit

RedMonk publishes a regular state of the nation examining programming language popularity as a function of activity in Stack Overflow and GitHub. The rankings have become more useful as we have established a reasonable time frame to examine trends, and as such my colleague Rachel Stephens recently published the above chart. When I first looked at it the data point that immediately struck me was the rise of TypeScript. At a glance it looks like TypeScript is about to overtake Swift in terms of popularity. But then, the chart is actually about the position of languages relative to one another, rather than reflecting any absolute metrics. Swift remains the fastest growing programming language we’ve ever seen using our methodology–it exploded in mid 2016. But new technology adoption tends to look like an s-curve, and Swift may indeed have begun to saturate its niche.

Developers were hungry for an alternative to Objective-C, and Apple provided one, but Swift has not established itself in new niches, such as server-side development. When considering Rachel’s chart I thought we should probably examine some other metrics. Using the same methodology as our overall language rankings analysis, here is a chart of growth in pull requests across public GitHub repositories, with language determined by a repository’s base language.

Pull requests are an indirect measure of community activity and as such this chart is quite something. It’s also notable that the TypeScript growth looks like it’s a cumulative graph, when in fact that’s just growth in annual numbers.

GitHub Stars are an indicator of developer interest, and it is interesting to triangulate trends over time. The majority of the interest in Swift came immediately following Apple’s initial launch. Similarly, Kotlin saw a spike in interest when Google added it as a first-class supported language for Android. TypeScript on the other is less spiky and possibly more sustained in that it’s not correlated with major vendor launches.

So what is driving TypeScript growth? One high level answer is that more strongly typed languages – in which you need to define the type of information in a variable up front – are having a renaissance. Rust, for example, has gained a passionate following in the systems programming space – you can now get jobs writing Rust with folks including Cloudflare, Fastly and PingCAP. (And for the inevitable questions about why Rust is not included in the Top 20 Languages chart: it’s currently sitting at #23.)

JavaScript is a weakly typed language – you don’t need to specify the type in a variable. TypeScript though is a superset of JavaScript, with optional static types which then compiles to plain JavaScript.

What are the advantages of typing? Some good examples are found in one of the drivers of the TypeScript growth – the Angular framework. It turns out static typing is valuable when you’re building and maintaining a framework. This post by Viktor Savkin – Angular: Why TypeScript – is an excellent read. Stronger typing is particularly valuable in refactoring – because it makes interface boundaries explicit. This driver, combined with TypeScript’s focus on being tool-friendly, makes it an excellent choice for a large project. Savkin also emphasizes that TypeScript is still extremely flexible in that – you can write untyped JavaScript where appropriate and mix and match the two.

“TypeScript takes 95% of the usefulness of a good statically-typed language and brings it to the JavaScript ecosystem. You still feel like you write ES6: you keep using the same standard library, same third-party libraries, same idioms, and many of the same tools (e.g., Chrome dev tools). It gives you a lot without forcing you out of the JavaScript ecosystem.”

Savkin’s point on tool support is particularly telling because one of the most well known pieces of software written in JavaScript and TypeScript is the much loved Visual Studio Code, which has become the code editor of choice for many language communities including JavaScript and Go. According to npm’s annual survey for 2018 46% of JavaScript developers now write some TypeScript. By npm’s most recent survey numbers a “whopping” 61% of all JavaScript developers report using TypeScript.

ZDNet recently wrote a post asking Could TypeScript replace JavaScript. The framing feels a little awkward, given TypeScript essentially is JavaScript, but there is no doubt that developers with JavaScript skills looking for some type safety in their code are gravitating towards TypeScript.

From a Darwinian perspective it is precisely the ability of JavaScript to adopt to new niches as it evolves that makes its growth so sustainable.  It is indeed the “fittest” language for a number of niches.

Another notable space where TypeScript has found a home for itself is in configuration as code tools. Both Atomist and Pulumi make extensive use of the language. Atomist founder Rod Johnson knows a bit about abstraction and productivity, being the creator of the Spring Framework, and he decided to standardise on TypeScript at Atomist for building automation tools, what he calls a Software Delivery Machine. In a New Stack interview he argues:

“I think TypeScript is probably the most important language right now, because if you think about languages, you could think about a language that’s ideal and wonderful and makes something like 50 times better, but if it isn’t easy to adopt there’s no point. You can think about a language that’s incredibly easy to adopt and makes everything twice as good. The former is Haskell, the latter is TypeScript.

TypeScript makes JavaScript twice as good, and that’s a conservative estimate. It takes an astonishing amount of things you need to do and means you’re going to be significantly more successful. In terms of impact, TypeScript is the most important thing right now possibly.”

The idea that TypeScript could find converts from the legions of Java developers out there is interesting. William Saar, who has been writing Java since 1996 asks Is TypeScript the only language your company needs? One point I really like in his analysis is that frameworks such as TypeORM and NestJS were written with types in mind and provide constructs such as dependency-injection that are familiar to developers with experience from Java frameworks like Spring and Hibernate. Frameworks of course drive language adoption.

Some thoughts on Microsoft given it’s the company’s Build 2019 conference this week.

While it’s currently fashionable to talk about opportunities that Microsoft has missed, there are some things it’s never lost sight of – namely the important of developer productivity. Visual Studio Code has won converts in multiple languages – even more impressive because code editors are one of the things software developers are least pragmatic about. Code offers excellent, “just works”, support for TypeScript. Developers love Code, they love TypeScript, and they love GitHub. These are all excellent platforms in their own right. Together that’s an amazing, rich set of services to build momentum on.

JavaScript continues to fill new niches, and in a world of engineering – that is where tradeoffs are appropriate – TypeScript is exploding.

 

 

 

Disclosure: Microsoft is a client. Atomist is also a client.

 

 

 

 

 

 

 

8 comments

  1. Hi,

    Only two first images loads for me. Anything from https://files.slack.com/files-pri/T02538102-FJ65G4YNB/swift_typescript_kotlin.png doesn’t load.

    1. thanks paul should be fixed now

  2. Image number three and four don’t show. When I try to open them, I get a slack login page. So you probably need to move them somewhere else 🙂

  3. […] looked at it the data point that immediately struck me was the rise of TypeScript,” Governor said. “At a glance it looks like TypeScript is about to overtake Swift in terms of popularity. But […]

  4. […] is exploding: the amazing chart here that shows x5 increase in TypeScript PRs remove any doubt, researches tell that it prevents errors […]

  5. […] is exploding: the amazing chart here that shows x5 increase in TypeScript PRs remove any doubt, researches tell that it […]

  6. […] pode estar interessado em saber que Angular 2 está escrito nele. Tem um blog na internet chamado RedMonk que explica mais sobre Nullam id dolor id nibh ultricies vehicula ut id elit. Curabitur blandit […]

  7. […] market. There’s a growing demand for TypeScript developers, as illustrated by RedMonk’s list of the most popular programming languages in which TypeScript earned 12th place — 5 ranks higher than the year […]

Leave a Reply to Reinout van Rees Cancel reply

Your email address will not be published. Required fields are marked *