Is TypeScript Losing Ground? A Look at Recent Library Decisions
Tags: webdev, typescript, javascript, programming
Published: 2023-09-18 09:25:23

*Subtitle: Exploring the surprising trend of major libraries ditching TypeScript*

---


In the ever-evolving world of programming, adaptability is key. Even legendary JavaScript guru Kent C. Dodds once remarked, "I don't use TypeScript, so I don't ever plan on supporting it." Fast forward to 2023, and TypeScript seems to have won the battle for supremacy in the JavaScript ecosystem. However, recent developments have raised questions about its enduring dominance.

![Kent C. Dodds tweet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/juk6uq100y086atvk6h5.png)


## TypeScript's Rise to Prominence

To understand the recent controversy surrounding TypeScript, we need to rewind to 2012 when Microsoft introduced TypeScript. Initially, it didn't garner much attention, but it gained traction when the Angular 2 framework adopted it, causing many to raise eyebrows. As the 2020s dawned, TypeScript had permeated virtually every corner of the JavaScript landscape, converting its harshest critics into ardent supporters.

But as TypeScript was poised to achieve ubiquity, a surprising shift occurred. Several prominent open-source projects, including Svelte, Drizzle, and Turbo, made a bold decision: they were ditching TypeScript in favor of vanilla JavaScript. What prompted these influential libraries to make such a U-turn?

## DHH's Take on TypeScript

One notable voice in this conversation is David Heinemeier Hansson (DHH), the creator of Ruby on Rails. DHH and the team behind Turbo version 8 recently announced their departure from TypeScript. Their main grievance wasn't the compilation step but the clutter it introduced into the codebase, what DHH referred to as "type gymnastics."

![DHH](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eg9vxwote5oydxpsulv7.jpg)

### DHH Explains:

> "TypeScript pollutes the code with type gymnastics."

As library maintainers, they found that TypeScript introduced overhead, forcing them to navigate intricate type hierarchies. This sentiment resonates with developers who've had to wrangle TypeScript's strict mode for the sake of type inference. The trade-off between code cleanliness and type strictness was a difficult one.

## Svelte's Pragmatic Approach

On the other hand, the Svelte team decided to drop TypeScript for more practical reasons. Rich Harris, the creator of Svelte, shared insights into this decision. With Svelte 5 (or perhaps a future Svelte 5+ version), TypeScript has been replaced by vanilla JavaScript. Their rationale? Increased productivity, thanks to the elimination of the compilation step.


### Rich Harris Explains:

> "No compile step is a huge boost in productivity."

Svelte's approach is unique. While TypeScript is no longer a core part of their development, they leverage JSDoc comments to provide type annotations and documentation, effectively delivering TypeScript-like benefits while retaining the simplicity of JavaScript.

## The Future of TypeScript

So, where does this leave TypeScript enthusiasts? Should we consider returning to vanilla JavaScript? For building applications with tools like Svelte Kit or Next.js, TypeScript's integration remains seamless and efficient. Transitioning to JavaScript documentation comments (JSdoc) might prove cumbersome.

Yet, there's a glimmer of hope on the horizon. An ECMAScript proposal in Stage 1 suggests adding optional type annotations to JavaScript natively. If this proposal becomes a reality, it could render TypeScript nearly obsolete, simplifying the ongoing TypeScript vs. JavaScript debate.

In conclusion, the recent decisions of major libraries to part ways with TypeScript might be indicative of a larger shift in the JavaScript landscape. While TypeScript remains a robust choice for many developers and projects, we should keep an eye on the evolving JavaScript standards, as they might provide an alternative path forward.

As we navigate the ever-changing world of JavaScript development, one thing remains certain: staying open-minded and adaptable is the hallmark of a great developer.