Hacker News new | ask | show | jobs
by austinthetaco 20 days ago
I'm still not sold on typescript. I've used it off and on professionally for years and it has always just felt like a maneuver to create a safehaven to C# and java devs scrambling to find roles in the modern landscape. Doing purely functional with it is or at least was an absolute chore and so much extra typing happens for extremely obvious variable values that you could derive from the name of the variable. YES you technically can do functional programming (but as i said its a pain) and YES its optional and you dont have to use it everywhere, but try pulling that maneuver on a technical team "lets use typescript where we each feel like it".

I am still of the opinion that well organized and named JS is all that anyone needs and typescript only exists for fresh graduates and fleeing OOP devs.

edit: also the downvote button HN is not for disagreeing with comments or unpopular opinions.

2 comments

Same here, and if you really need its key features just add JSDoc and Zod to any given vanilla JS codebase.

Passing around mixed types is not necessarily an anti-pattern either ie- you can do type-checking at runtime and use them as conditions for branching into different control flow patterns - so I don't see the benefit of universal enforcement; not that most TS codebases do anyway (ironically).

I personally don't have a need for TS which introduces an extra build step, extra ritual when defining functions, and no performance benefit over vanilla JS. If I want stricter coding pattern with performance benefits I will use C/C++ for the job instead.

Basically every JavaScript server runtime and build tool supports TypeScript out of the box these days, so the only situation where it adds an extra build step is if you were previously serving your JavaScript source files directly to browsers. Which is okay at small scale, but if you have a substantial-size app with a real userbase, you're wasting a lot of your users' bandwidth if you do this.

TypeScript and Zod serve complementary, mostly non-overlapping purposes; the former detects bugs in your code, while the latter validates data that comes from outside your program and so can't be trusted. There likewise aren't that many use cases where you can choose between C/C++ and JavaScript/TypeScript based on personal preference; usually only one of the two is suitable.

> I am still of the opinion that well organized and named JS is all that anyone needs

You probably didn't work on any medium or large codebase and didn't have to do a refactor.

> it has always just felt like a maneuver to create a safehaven to C# and java devs scrambling to find roles in the modern landscape

What a nonsense. Perhaps read history of TypeScript and you'll learn why it was created.

You really should just not assume things about people with no reason other than "they dont like the things i like so therefor they must not be experienced". I've worked on plenty of very very large codebases with large teams.

> What a nonsense. Perhaps read history of TypeScript and you'll learn why it was created.

did you? it was created by microsoft, a C# shop, to support their existing workflows around typing and hinting support. The typescript creation team was literally led by the guy who made C#.

> You really should just not assume things about people with no reason other than "they dont like the things i like

That's not the reason for my comment. I truly don't understand how after so many years someone "isn't sold" on TypeScript. Sure, you don't have to use it if you don't want to, but if don't see how it's truly essential in current JS development, I don't know what else to assume, other than OP doesn't have enough experience.

> it was created by microsoft

It was created at Microsft, but it was crated by Anders Hejlsberg who, I'm pretty sure, didn't want to just "create a safehaven to C# and java devs", he was actually solving real problems with JS development, completely orthogonal. You can argue that TS's first syntax was very C/C# inspired, and that Anders also created C#, but that's not what OP meant (or at least how it read).

Its not essential. Good organization. Good functional configuration. Proper separation. Good variable naming. All of these things are what make it more than easy to work without type declaration. People have been working on huge code bases without types for a VERY long time with no issue, especially in functional paradigms.
> People have been working on huge code bases without types for a VERY long time with no issue

People have been successfully writing assembly, your argument is useless.

It's not a questions about if it's possible or not, but if TypeScript makes it easier to do so.
> You really should just not assume things

And yet you follow this up by making assumptions about the motivations behind TS. Anders has mentioned that TS was purely motivated by internal MS teams struggling with huge JS codebases, nothing to do with C# but clearly his work on other languages would have influenced how he approached designing the language.

They have said time and time again it was because their C# team was writing frontend code in a huge codebase and wanted similar support.
No they haven't. It's been said time and time again that their teams were struggling with large JS code bases for Bing Maps and O365 web apps.