Live data from Hacker News

TypeScript sucked out much of the joy I had writing JavaScript

twitter.com

1–10 of 13 posts

Re: TypeScript sucked out much of the joy I had writing JavaScript

#2
I feel the exact opposite. It changed JS from a language I loathe to one I really like. There are no other mainstream languages with a similar type system, which means it's uniquely easy to do very complex things with type safety.

Even Rust is still nominally typed, which means you have a lot more boilerplate.

Re: TypeScript sucked out much of the joy I had writing JavaScript

#3
Anyone try out the tenets in Reliable Javascript (2015), pre-Typescript?

The authors praise--and begin with an example from--D3.js, and work through handrolled dependency injection, aspects, and test-driven development with Jasmine.

Truly understanding `this`, .bind, .apply, and .call may be essential to a mastery of (vanilla) Javascript.

Re: TypeScript sucked out much of the joy I had writing JavaScript

#5
post #2

I feel the exact opposite. It changed JS from a language I loathe to one I really like. There are no other mainstream languages with a similar type system, which means it's uniquely easy to do very complex things with type safety. Even Rust is still nominally typed, which means you have a lot more boilerplate.

I liked JavaScript before, but TypeScript is like a revelation. Type checking is great in general for preventing all kinds of errors, but the real power is in two areas:

1) Declaring functions with typed output and types on the arguments. This allows you to create large architectures with minimal confusion. It allowed me to write an OS in TypeScript.

2) Declaring message payloads as object interfaces. This imposes a set of predictability and consistency in your services. It's so obvious in hindsight, but before TypeScript I was putting all kinds of safe guards around my service payloads to account for unpredictability that really impacted how the application scaled.

I think where people discover the most challenges migrating to TypeScript is that it exposes some level of unnecessary complexity in prior practice and some people do incredibly weird things with their type definitions to make it feel more OOP.

Re: TypeScript sucked out much of the joy I had writing JavaScript

#6
post #2

I feel the exact opposite. It changed JS from a language I loathe to one I really like. There are no other mainstream languages with a similar type system, which means it's uniquely easy to do very complex things with type safety. Even Rust is still nominally typed, which means you have a lot more boilerplate.

I liked JavaScript before, but TypeScript is like a revelation. Type checking is great in general for preventing all kinds of errors, but the real power is in two areas: 1) Declaring functions with typed output and types on the arguments. This allows you to create large architectures with minimal confusion. It allowed me to write an OS in TypeScript. 2) Declaring message payloads as object interfaces. This imposes a…

I’m confused because the comment you replied to said “There are no other mainstream languages with a similar type system, which means it's uniquely easy to do very complex things with type safety.”, but with the examples you gave, I don’t see why other statically typed languages cannot do this. Or are you just referring to the benefits in general and not a TS specific aspect?

Re: TypeScript sucked out much of the joy I had writing JavaScript

#7
Never have I related less with a take. TypeScript has elevated a truly mediocre language to being the one I am most productive in because its type system strikes such a nice balance. Where is the joy in looking at a variable named `opts` and having no clue what properties it can have?

Re: TypeScript sucked out much of the joy I had writing JavaScript

#8
Rather than defend JavaScript, I just want to say that learning Ruby, and Rails, to me was an amazing experience. I've always enjoyed programming, and I've always preferred loosely typed languages, it was really fun to learn Ruby+Rails because it sets out to maximize the amount of joy that you can have writing code. That mindset is normally constrained to people writing hobby projects in uncommon languages. I think Rails is unmatched in striking a balance between code that is fun to write, and yet extremely productive.

(For those who don't know, the tweet author is the Rails creator.)

Re: TypeScript sucked out much of the joy I had writing JavaScript

#9

Earlier quoted context omitted.

I liked JavaScript before, but TypeScript is like a revelation. Type checking is great in general for preventing all kinds of errors, but the real power is in two areas: 1) Declaring functions with typed output and types on the arguments. This allows you to create large architectures with minimal confusion. It allowed me to write an OS in TypeScript. 2) Declaring message payloads as object interfaces. This imposes a…

I’m confused because the comment you replied to said “There are no other mainstream languages with a similar type system, which means it's uniquely easy to do very complex things with type safety.”, but with the examples you gave, I don’t see why other statically typed languages cannot do this. Or are you just referring to the benefits in general and not a TS specific aspect?

> I don’t see why other statically typed languages cannot do this

It's not that they can't (mostly), it's that it's much harder.

TypeScript gives you a lot of strict typing for free. You can just throw data around, and TypeScript keeps track of its type. If you paste a blob of JSON into TypeScript, there's a new type created behind the scenes, and you can even reuse it with very little extra code.

The magic parts are the structural typing (overlaps quite a bit with duck typing) and type inference. It means that even your basic JavaScript with zero type annotations are type-checked against each other. If you just feed JavaScript into TypeScript, you'll uncover a lot of errors you didn't know were there.

Re: TypeScript sucked out much of the joy I had writing JavaScript

#10
This is the same typed vs. untyped argument which is as old as vi vs. emacs. Different devs have different requirements and preferences. Neither is "wrong". Some people are just naturally anal retentive pedants who must know their code is correct while writing it, even if it means downloading 500mb of build tools and requiring a jury rigged non-standard transpilation step for it to run. The fact that there's not a single example of a well written non-bloated open source project that uses TypeScript won't put them off, and that's perfectly OK! To each their own! Having yet another flame war about it, no matter how deluded many devs are, is just unproductive.
Post reply on HN