Ask HN: Is TypeScript worth it?
Oh, thank heavens! Finally someone says the quiet part out loud. I thought it was heresy and that the TS bubble would never pop. From my perspective, it&#x27;s not worth it at all. It&#x27;s just another hype train. It doesn&#x27;t prevent bad programmers from writing bad code, nor does it cause good programmers to write better code. It mostly just adds bureaucracy and hindrance, in the ways you allude to in your list. It doesn&#x27;t make hard things any easier, but it makes easy things harder.<p>It&#x27;s also way too complicated for what it is. To the extent static typing is beneficial, most developers and projects only need the bottom 30% or so, but the expansive - and expanding - feature set encourages byzantine solutions, especially for showy types for whom tight little chunks of terse syntactic cleverness are an aesthetic (I&#x27;ve been there, I get it). And as if JS build tooling wasn&#x27;t unnecessarily overcomplicated already, let&#x27;s pile on a bunch of transpilation infrastructure?<p>Now, I still use TS, having sensed that it&#x27;s where the centre of gravity was moving as far as JS developer fashions. Plus, of course it&#x27;s not bad to have types in the language in a rudimentary sense. Sure, why not? Moreover, I try to pick technologies that I could hire someone else to work on or collaborate with me on in the future, and TS is definitely &quot;in&quot;. There were subtle nudges from other areas; I&#x27;m a very heavy Vue user, and Vue 3.x certainly doesn&#x27;t mandate TypeScript, but let&#x27;s be real; they want you to use TypeScript.<p>I make a point of using as few &quot;clever features&quot; as possible; 90% of my uses are banally simple interfaces. I think I did foray once into `Map&lt;Partial&lt;keyof RTCSessionEventMap&gt;, RTCSessionEventMap[keyof RTCSessionEventMap]&gt;`, and it&#x27;s not at all clear that this got me anything. But it looks cool, doesn&#x27;t it? I guess that&#x27;s what leads TS-heavy developers to churn out impenetrable gobbledygook. I&#x27;m quite capable of not typoing my own key names. Why are we so fixated on abstruse manipulations of arbitrary contrivances that get transpiled away anyway? I suppose you could ask the same question about any high-level programming language insofar as it ends up machine code in the end, but TypeScript&#x27;s complexity doesn&#x27;t reflect an appropriate humility for its place high up the meta-hierarchy. You need to be an actual programming language to ride this ride; as a fancy templating system, it&#x27;s too entitled with its massive cognitive demands.<p>I&#x27;m not going to say there&#x27;s nothing good about TS. I do appreciate the ability to inspect type definitions to learn more about how a library works, especially if they have crappy documentation--which is often. Naturally, I also pocket the benefits that type definitions afford to IDE autocomplete. But on the whole, it&#x27;s a drag on my productivity, and I spend an awful lot of time either struggling to decipher someone else&#x27;s TypeScript or paying some sort of tribute to the exacting and mercurial TS compiler gods. I&#x27;m not writing better or error-free code because of it. Good end-to-end testing is a check on my code quality; the ever-so-occasional squiggle in the IDE is not.<p>Related thought: &quot;type safety&quot; has become some sort of metaphysical fixture, an unfalsifiable theory of quality and robustness. &quot;I&#x27;m so glad I have type safety!&quot; is a liturgical or ritualistic statement, the kind that nobody in their right mind would question, or attempt to unpack or otherwise anatomise. It&#x27;s a self-evident, ipso facto good. Types in JavaScript seem to have become a religious totem object.
This oft-posited but seldom materialised correlation between &quot;types&quot; and &quot;quality&quot; remains to be illuminated for me. My background is entirely in statically typed languages (C above all else), so I understand the argument and need no convincing that types are good, and even elegant. However, I can assure you I wrote plenty of buggy code in C, C++, Go, Java...<p>It reminds me a bit of the apex of the TDD hypermania about &quot;refactoring with confidence&quot;, or specifically, the naive and childlike optimism of &quot;now that I have unit tests, I can refactor with confidence!&quot; Can you? That depends on many things, doesn&#x27;t it? Truly, how could it not? And either way, an overabundance of confidence owing to some platitudinal methodology is generally not a great vantage point to bring to engineering. Humbleness about breaking things keeps satellites in the sky, not euphoric, LSD-fuelled campfire paeans to TDD, and certainly not the mere presence of types. &lt;&#x2F;rant&gt;