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's not worth it at all. It's just another hype train. It doesn'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't make hard things any easier, but it makes easy things harder.<p>It'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've been there, I get it). And as if JS build tooling wasn't unnecessarily overcomplicated already, let's pile on a bunch of transpilation infrastructure?<p>Now, I still use TS, having sensed that it's where the centre of gravity was moving as far as JS developer fashions. Plus, of course it'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 "in". There were subtle nudges from other areas; I'm a very heavy Vue user, and Vue 3.x certainly doesn't mandate TypeScript, but let's be real; they want you to use TypeScript.<p>I make a point of using as few "clever features" as possible; 90% of my uses are banally simple interfaces. I think I did foray once into `Map<Partial<keyof RTCSessionEventMap>, RTCSessionEventMap[keyof RTCSessionEventMap]>`, and it's not at all clear that this got me anything. But it looks cool, doesn't it? I guess that's what leads TS-heavy developers to churn out impenetrable gobbledygook. I'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's complexity doesn'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's too entitled with its massive cognitive demands.<p>I'm not going to say there'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's a drag on my productivity, and I spend an awful lot of time either struggling to decipher someone else's TypeScript or paying some sort of tribute to the exacting and mercurial TS compiler gods. I'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: "type safety" has become some sort of metaphysical fixture, an unfalsifiable theory of quality and robustness. "I'm so glad I have type safety!" is a liturgical or ritualistic statement, the kind that nobody in their right mind would question, or attempt to unpack or otherwise anatomise. It'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 "types" and "quality" 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 "refactoring with confidence", or specifically, the naive and childlike optimism of "now that I have unit tests, I can refactor with confidence!" Can you? That depends on many things, doesn'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. </rant>