Hacker News new | past | comments | ask | show | jobs | submit login
On TypeScript (schwartz.world)
1 point by schwartzworld 24 days ago | hide | past | favorite | 8 comments

So much I disagree with here.

* The rules in place for any types were created in good faith but small exceptions should be allowed for externally defined structures you don’t own. It’s nice when type libraries exist on definitely typed but there is not a dined type set for everything.

* I love TypeScript but loathe OOP. When I encounter developers utterly dependent upon OOP I stereotype them as CS students who are largely incapable of self learning and incapable of forming original data structures. That sounds mean, but it’s usually correct. I have yet to encounter a JS developer hopelessly dependent upon OOP that can walk the DOM or asynchronously walk the file system. Earlier in my career this stereotype was reserved for many Java developers but this is no longer the case.

> hopelessly dependent on OOP

What are you talking about?

Sure OOP has its downsides, but

JS classes are just functions used to build custom data types. You could just as easily create the same structures with arrow functions that return objects.

Some languages paradigms encourage OOP more than others. TypeScript is one of them, even if you choose to ignore it, as most React devs seem to.

TypeScript is a superset of JavaScript. It only encourages type declarations and all the restrictions that come with that. My last three personal projects are written in TypeScript. My current personal project is fairly large at 8mb of documentation and code.

I also dislike Typescript. Like the author stated, the typing comes across as an afterthought. This half-measure results in uglier code that still doesn't come with enough guarantees. The language's supporters tout this as a strength: that this incremental progress is more approachable to vanilla JS devs. I completely understand that point, but it may be more beneficial in the long run to transition to something like Purescript or Elm, and it may not be too difficult to get there.

There is a tendency among aging millennials to liken every news event to Harry Potter, which has made the response "read another book" popular. I think some web devs need to be told "learn another language." Not everything should be hammered into a JS shaped hole.

> Not everything should be hammered into a JS shaped hole.

TypeScript exists because most web developers have to use JavaScript.

People realized that massive JavaScript code bases were impossible to maintain, and TypeScript is the solution to that problem.

The relationship between the type system and running code isn't perfect, but it's better than nothing. It's not reasonable to port a 100k+ LoC project to another language.

Comparing TypeScript to [insert your favorite language] is not the point of TypeScript. The point is to make JavaScript maintainable at scale.

Now that you've provided an extreme and obvious counter-example, I would still suggest that developers working on a codebase with less than 100k LoC do not in fact have to use JS, and may be selling themselves short by myopically opting for TS when more robust solutions exist.

I can't give you an exact figure, but at my previous position we gradually migrated a codebase that was 10s of ks worth of JS/TS over to Purescript, and everybody's life was better off for it.

"Minimalist" can be readable. If you're going to ask people to read and engage with your blog, please use the most basic accessibility guidelines (thicker fonts, higher contrast, etc.) You've actually gone out of your way to make something that's difficult to read.

I put this page in LightHouse and the only missing this was that the HTML "lang" setting was missing.

As for the font, it's Courier New. I wanted to use one of the browser's built-in fonts for speed. if you have trouble reading it, I'd like to know which of the built-in fonts you recommend. I may eventually make it toggleable by the user.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact