Live data from Hacker News

Ask HN: Is TypeScript worth it?

news.ycombinator.com

301–310 of 469 posts

Re: Ask HN: Is TypeScript worth it?

#301
post #266

I've been working with JavaScript for 20 years. And 5 years with TypeScript. And, well. I still am not convinced. Too much overhead for me. I really dislike typing obvious things and boilerplate. Probably my fluency with JS is to blame. I don't need to see types and autocompletion. If I really need to — I just go to the source and inspect the source code, that is how I familiarise myself with the interface. I also th…

Let's think about what happens on a team: If a single person goes and reads the source code to learn how the public API works instead of simply using the exported types, that's a wasted thirty minutes instead of two - okay, fine, whatever. If all of my engineers have to do this, suddenly each of them is spending that amount individually; and just like that, we've wasted an entire man-day, for nothing. As you declared…

I am a strong believer that every developer on a team should know how the code works. Emphasis on HOW. You only know that if you go to the source of truth. That is how people become proficient with a skill — by doing and re-doing and re-doing things.

I disagree that it's wasted time. The time spent investigating how a piece of code works is time extremely well spent.

If the code is too difficult to understand — of course one can hind behind types.

So, yeah, to sum it up — I think types are an overhead for a well written piece of code.

Re: Ask HN: Is TypeScript worth it?

#302
I have been using TypeScript at work since 2019. Personally I am not convinced that it is worth it, broadly for the reasons you note and also because TypeScript has in practice a soft dependency on Visual Studio, and in turn other MS services such as GitHub and Axure. Adopting TypeScript can often lead to de facto vendor lock-in.

There is a good argument for using types (and also a good argument for not doing so). If the argument for wins out, then types will be included in the native js spec and the need for TypeScript will disappear. If the argument against wins, then TypeScript will also disappear.

If TypeScript really floats your boat then by all means use it, but treat it for what it is- a hairy dependency that only a minority of developers love or need.

Re: Ask HN: Is TypeScript worth it?

#303

I'm old enough to have worked on two different large enterprise applications which predated TypeScript and it was a nightmare. Personally I've found that JavaScript lends better to a functional style of coding but there are no protections in the language to enforce this and both codebases I saw had a weird mismatched set of object oriented and functional style principals. Defined classes, prototypical inheritance, mo…

> I agree the TypeScript compiler's error messages are confusing but you should have see the types of stack traces JavaScript produces.

Non-transpiled js produces fairly sane and useful stack traces. Its just a shame that non-transpiled js is so rare these days.

Re: Ask HN: Is TypeScript worth it?

#304
post #264

Earlier quoted context omitted.

I think stuff like this really comes down to getting used to and accepting. I had the same views on code prettiers. I thought, aligning your code by hand makes you think about the structure. That you'd invest more time in making your code readable and thus it would be more readable. When I first got to use prettier on a team and accepted it's value, the benefits I perceived were so vast, that my arguments seemed irre…

Sure! I want prettier for types. So I don't have to manually type the obvious things. The IDEs are smart, but I haven't found one that would be that smart.

I'm wondering what do you mean by obvious things, do you have any example? TypeScript can infer types[0] even through context, and it's even a good practice to let TypeScript do that for you.

[0]: https://www.typescriptlang.org/docs/handbook/type-inference....

Re: Ask HN: Is TypeScript worth it?

#305
Short answer:

It is worth it if you want me on the team. I refuse to work with anyone who throws out TS for JS in 2023.

Slightly longer answer:

I have said a number of times

    "Javascript is a simple version of Java in the same way as a bike with one wheel is a simpler version of an ordinary bike."
The same can be said about JS and TS. If you want to do any serious work you go for the serious thing even if it means occasional adjustment of brakes and gears, or in Typescripts case, sometimes figuring out something.

If anybody suggest to use Javascript today I won't take them seriously.

i) I have used Typeescript since 2017. For some reason I don't have these problems and never had.

ii) Yes, some libraries are poorly documented, that is for me a reason to prove why I am a software engineer by either figuring it out, complain until they fix it or even better use my gut feeling and use some libraries that aren't stuck 10 years ago.

iii) Error messages can be hard, but compared to debugging the mess that happens without typing it isn't hard at all.

iv) Have someone look at your project setup.

And before someone says I don't know Javascript: I wrote my first javascript application (OK ECMAScript since it was in Adobes SVG plugin), which was a working map, dynamically updated based on GPS position, back in the spring of 2005, that is half a year or so before Google Maps and years before most people took Javascript seriously so I should be qualified to have opinings. Yes, it wasn't production quality, but I built the logic more or less alone in 5 months in between other school work.

Re: Ask HN: Is TypeScript worth it?

#306
I can't imagine not having static typing. Maybe I am a bad coder but there is no way I would be able to catch some of the spelling mistakes, objects that are missing a property, etc. I am not sure how people catch these mistakes other than just getting value errors or doing unit tests for the smallest thing.

Re: Ask HN: Is TypeScript worth it?

#307
post #284
post #234

Earlier quoted context omitted.

try out dart, its much better than TS

How is it objectively "better"? This depends on context. I am sure Dart is worse given a specific condition. I'm not bashing dart, but you cannot say that "A is better than B" without any sort of context to the statement. It's like saying "apples are better than oranges".

much less overhead setting it up, it can be both interpreted and compiled. Troubleshooting errors in dart is a much more pleasant experience compared to Typescript. Transpiled languages like Typescript has given me so much trouble over the years at work.

Re: Ask HN: Is TypeScript worth it?

#308
You're at the whim of the crap dependencies that you choose to use in your projects. If they don't document their code or if they force you to upgrade your tooling, it's not the fault of the TS team.

I try avoid 3rd party libraries very aggressively and I don't have half the issues people talk about in front end dev. My normal set up is angular and go.

Re: Ask HN: Is TypeScript worth it?

#309
I had some pretty strong pressure applied to use Typescript for pianojacq.com but resisted it for a very simple reason: no tooling other than an editor reduces the barrier for contribution so much that it makes it possible for outsiders that just know Javascript (a large multiple of the ones that know TS) to contribute to the project.

It also means there is no 'development environment' as such, it's just a repo on gitlab that anybody can read, fork and contribute to from within gitlab if they want.

I have also tried to keep the number of dependencies to an absolute minimum, which also helped to make something that doesn't feel like a moving target.

Re: Ask HN: Is TypeScript worth it?

#310
post #234

Earlier quoted context omitted.

try out dart, its much better than TS

Is Dart object oriented language? What is its roadmap? I know it was created by Google, but is it replacing js?

Yes it's Object oriented, it was supposed to replace JS long time ago, but google kinda dropped the ball on that. I wish it replaced JS. Dart was almost dead for a long time but flutter kinda saved it. Developing on flutter for cross platform applications has been a joy to work with even though there are still a lot of drawbacks to flutter right now.

you can find their blog here where they talk about future releases and planned features https://medium.com/dartlang

Post reply on HN