TypeScript has been on a steady rise over the past several years, with increasing adoption among major frameworks like Angular, widespread usage across codebases, and vocal supporters touting its benefits for writing safer, more maintainable application code. However, we now seem to be at an inflection point where some major open source projects are actually moving away from TypeScript in favor of plain JavaScript.
This apparent change of heart warrants a deeper look into why this is happening and what it could mean for TypeScript moving forward.
The Rise of TypeScript
First, let‘s provide some background context. TypeScript landed on the scene in 2012 as an open-source language that adds optional static typing to JavaScript. It allowed developers to annotate types for variables, functions, classes, etc to enable stronger checking during development. This caught on rapidly as more teams wanted type safety without losing interoperability with existing JavaScript.
According to the StackOverflow Developer Survey, usage of TypeScript among respondents has gone up from 7.8% in 2016 to 37.2% in 2022. This swift growth is likely driven by several key factors:
Angular’s Official Adoption
The Angular framework, maintained by Google, embraced TypeScript as a first-class citizen starting with Angular 2 in 2016. This immediately exposed many developers to its benefits while building Angular frontends.
Over 60% of StackOverflow survey respondents reported using Angular in some capacity – so TypeScript usage got a significant boost through this channel alone.
Addressing Needs of Larger Codebases
As web apps and dev teams have grown more complex, static types provide guard rails to manage scale confidently without too many bugs. Adoption accelerated in larger enterprises dealing with massive codebases – for example SalesForce, Trivago, BMW, etc.
According to GitHub’s Octoverse report, in 2021 median repo sizes with TS grew 17% faster than JS repo sizes indicating increased usage in bigger codebases.
Maturing Tooling Ecosystem
The typing capability and editor tooling around TypeScript has improved exponentially thanks to Microsoft’s focus here through Visual Studio Code and developer evangelism.
This further boosted productivity when writing TS code resulting in rampant growth.
Vocal Advocates in Community
Influential dev advocates like Dan Abramov have publicly praised TypeScript’s advantages especially around scaling JavaScript apps. High profile podcasts like Syntax and conferences drove enthusiasm through the global JavaScript community helping its viral adoption across projects.
Over the last 5 years, TypeScript has cemented itself as one of the fastest growing languages – with usage rapidly eclipsing Dart and other compile-to-JS alternatives.
Per the 2022 State of JS survey, nearly 80% of respondents reported using TS compared to just 46% in 2019 signifying its exploding adoption.
TypeScript usage growth over time across developer surveys and reports
By allowing teams to scale JavaScript apps confidently, TypeScript seemed poised for future domination as the defacto way of writing JS with conversion seeming inevitable.
However, recent developments reveal some cracks in this ascent.
The Move Away From TypeScript
Despite much enthusiasm over typing from the apparent hockey stick adoption, large open source libraries have started deprecating built-in TypeScript support in favor of plain JavaScript:
- SvelteKit – The official Svelte framework that enjoyed skyrocketing adoption dropped TS support from their codebase citing complexity, overhead, and feature delay reasons.
- Drizzle – The Truffle blockchain framework‘s front-end eliminated TS too, although users can still opt-in with a plugin.
- TurboRepo – Basecamp‘s monorepo tooling nixed internal TS usage due to code quality issues introduced while using it strictly.
- Spell – The highly anticipated magic-like JS framework from GitHub also moved away last year.
Maintainers of these high profile libraries believe that despite initial appeal, over time the costs imposed by TS started to outweigh the gains:
- Config Complexity – Juggling Babel, Webpack, Jest, ESLint and other layers becomes exponentially complex with TypeScript configs mixed in. This slows down overall development velocity.
- Code Quality Tradeoffs – Strict typing needs more gymnastics to appease compiler with dynamic code, sometimes impacting runtime readability and package sizes.
- No need to compile – Vanilla JS with JSDoc comments provides adequate IntelliSense, safety, and docs without adding a build step.
In other words, they found plain JavaScript simply worked better for their goals despite TS‘s initial appeal waning over time as the codebase matured.
Perspectives From Both Sides of the Debate
Of course, debates around choice of technology seldom have unilateral perspectives from developers. This recent divide on TypeScript is no different.
Kent C. Dodds, a highly influential developer and instructor, shared recently how he’s gone full circle – from initially rejecting TypeScript to eventually embracing and evangelizing it, to now accepting that it may not be an ideal fit for every codebase:
“Frankly, I think the choice depends a lot on the codebase itself, the team culture and values, the goals etc. Being dogmatic one way or another can set your team up for pain.”
On the other flip side, Michael Shilman, author of Making Sense of TypeScript, called ditching the language a likely premature “fad”:
“Dropping TypeScript is currently a fad IMO. Some high profile libraries are trying plain JS… but it’s too early to have clear data to show tangible wins.”
This is indicative of the mixed opinions among many developers on TypeScript‘s value. According to the latest State of JS survey, about 28% of respondents mentioned compile time and complexity as a dislike about TS:
Top dislikes around using TypeScript from State of JS 2022 responses
The rampant recent growth almost makes it easy to forget TypeScript is only a decade old. As with adoption of most technology, we likely need more temporal distance to judge its lasting impact. Churns in either direction today don‘t necessarily extrapolate far into the future accurately.
Evaluating Alternatives to TypeScript
Most language decisions require evaluating tradeoffs between multiple complex factors. For teams that desire added type safety nets but not the overhead of full TypeScript compilation, what are some alternatives that provide a similar developer experience?
JSDoc comments have been the go-to for adding types in plain JavaScript for years. Libraries like ts-check also let you incrementally add type checking on existing JS code.
For entirely new codebases, novel languages like UnJS and nocobts have emerged taking cues from TS but compiling down to regular objects and functions instead of classes and interfaces.
But undoubtedly, the best type support still stems from prolific progress in IDE tooling around regular ol‘ JavaScript – given its ubiquitous usage. The incredible editor integrations possible these days obviate some need to go all-in on typed supersets just for the ergonomic factors alone:
- VSCode itself offers useful type inference, parameter hints, auto-completions and other static validations for JS.
- Mature IDEs like IntelliJ WebStorm also provide robust static analysis as plugins without compiling code.
- New standards like module namespaces and optional type annotations are being added right to JS to close gaps.
The tooling will likely only improve further thanks to the energy around JavaScript evolution.
TypeScript Still Essential For Scalable Apps
Does the recent ditching among some libraries mean Typed JavaScript has reached its zenith as a passing fad? Probably not.
The selections above focus largely on building foundational toolkit layers – for example SvelteKit, Ember, Turborepo etc. Maintainers of lower level infrastructure libraries often tend to prioritize organic code patterns highly. Teams coding for maximum flexiblity needs down the dependency chain have slightly different criteria for technology choices compared to those directly building end-user applications.
When your components are being used as ingredients in unknown future recipes, you optimize for ergonomic UX above strict guarantees since downstream usage can‘t be predicted. However, for developing complete apps consumed by actual users, capabilities like confident scaling, integrating with other systems, leveraging stability focused versions of the language – TypeScript still likely delivers immense value.
For UI-focused apps, smoother error-catching from types during development and aligning code with strongly typed backends brings material productivity. And while type definitions create friction when changing APIs rapidly, they provide helpful wayfinding for devs inheriting matured, established code much later.
The type safety, ubiquitous editor integrations, and general focus on high quality JavaScript remains unparalleled when used judiciously for app scaling challenges. There‘s a reason TS is the 2nd most loved and the 7th most popular language on StackOverflow as per their 2022 survey.
So while foundational libraries make valid tradeoffs dropping compilation requirements of TypeScript given their architecture needs, adoption still appears healthy for application development use cases based on community data points. Teams will pick what aligns with their constraints best – but TypeScript seems here to stay as an essential part of the modern JavaScript ecosystem even if not universally adopted across every codebase.
Like other prevalent technologies, most complaints likely represent a dissatisfied minority rather than permanent disillusionment by its practitioners. The overall growth trajectory remains strong for now.
Only sustained time will tell whether the recent abandonments among some projects end up as a temporary ideological swing against type systems or a more permanent departure from the language across segments. But given continued rapid user growth across domains, the latter outcome looks fairly unlikely as of now despite occasional hype bubble bursts.
Risks of Dogmatic Technology Stances
Perhaps there’s a bigger insight here beyond TypeScript – on the universal risks of dogmatic rigidity regarding technical choices. As Kent C. Dodds noted earlier, narrow mandates rarely serve engineers well across diverse codebase constraints. Trade-off navigation ends up being far more situational than doctrinaire viewpoints acknowledge.
Very few technologies are optimally suited out-of-the-box for every project situation imaginable. Even a system as meticulously designed as TypeScript – led by the legendary Anders Hejlsberg over 7 years – has been deemed by some as occasionally at odds with JavaScript‘s inherent dynamic, loose flexibility when strictly enforced everywhere.
This is understandable. The needs of a client app can diverge vastly from design parameters guiding lower level runtimes and toolkit engines powering them. JavaScript itself has wisely evolved in a famously incremental style over 25+ years – carefully adding syntax one feature at a time guided by Compatibility, Determinism, and Simplicity principles with a progressive enhancement philosophy favoring runtime resilience.
Perhaps this serves as a reminder for TypeScript to continue iterating without losing sight of its original spirit as well – growing incrementally forwards not backwards.
Meanwhile when assessing options for our own scenarios, it pays to stay open and avoid clinging to particular tech labels dogmatically just because “everyone is using it”. Follow sound engineering principles not just prescriptive peer pressure. Let regularly updated evidence guide decisions, not hype cycles or habitual patterns alone.
No doubt – TypeScript move fast and broke some things re: JavaScript traditions in its quest of rapid ambition. But it also brought tremendous progress modernizing JS development practices at scale not possible earlier. Its contributions are assured regardless of label durability.
Vetted pragmatism triumphs over dogmatism eventually either way.