1. 10

  2. 5

    I’ll admit to being an early skeptic. The earliest examples I saw looked like a C# straightjacket: interfaces, interfaces extending other interfaces, classes implementing interfaces that extend other interfaces, generics on decorators that decorate classes that implement interfaces that extend other interfaces. None of what I loved about JavaScript was readily visible in that soup of OOP. Then I saw TypeScript’s implementation of enums and decided, “Not for me, thanks.”

    It wasn’t much later that a bunch of projects I really respected all seemed to all be jumping on the TypeScript bandwagon: Babylon, Deno, Vue, and several others. So I gave it another go and found a surprisingly expressive type system, some of which had been there all along: unions, intersections, narrowing, good built-in utilities, conditionals, inference, inferred generics, as const, keyof, typeof, keyof typeof. I also stumbled into fp-ts around that time, which really blew my mind.

    It isn’t a perfect language. I’m still wary of enums since they erode the boundary between the supposedly “fully erasable” type system and the JavaScript runtime’s data structures. Not allowing .ts extensions in ES module imports and even encouraging developers leave file extensions off altogether is a weird design choice. Many of the errors are relatively inscrutable.

    Nevertheless, I’m grateful to the TypeScript team. Having just completed a year-long project written with it and watching the Application Insights reports on Azure, this is the closest I’ve ever gotten to Elm levels of runtime exceptions (basically none) without actually using Elm.

    1. 2

      I’m struggling to think of a more impactful project in the last 10 years, in terms of adoption and everyday value provided. 10 years ago, web dev was often criticized for not being “real” programming (I don’t personally like distinguishing between real and unreal programming, but I heard this very often from other people). It was just hacking together strings of different web technologies, almost always in dynamically typed languages. Sure, web frameworks in statically typed languages existed, but they sure felt like the minority.

      I was doing native mobile dev around 10 years ago, and all mobile SDKs are in statically typed languages. We tried to tell web teams about some of the awesome things that static typing gave you, like forced null checks, but it just never translated. “That’s not necessary with web programming,” I often heard in objection.

      Then all of a sudden, TS was just everywhere. It’s like it clicked with everyone at the same time - larger projects need static types, end of story. And TS’s type system is so wonderfully ergnomic that it’s both easy to pick up, but also easy to start adding incrementally to your project to capture the existing patterns that you already use.

      Now relatively advanced type system features like union types and type narrowing are mainstream, and it makes talking about language predecessors like StandardML or OCaml much easier. Suddenly these amazing language features that have always been deemed as impractical research features are getting applied at work. That’s a great thing, which is why I can’t think of another more impactful project than TS recently.