Live data from Hacker News

Ask HN: Is TypeScript worth it?

news.ycombinator.com

381–390 of 469 posts

Re: Ask HN: Is TypeScript worth it?

#381
The short answer is no. Typescript is not worth it. The reason is because:

- WebAssembley (which other, controversially better or at least more adopted languages also target)

- Javascript's spec. is not time invariant (https://github.com/tc39/proposals#readme)

- Typescript isn't the best solution (There are better less adopted solutions providing types, like Elm, Rescript, or Purescript)

For Javascript, the real solution is hygienic macros and contracts, but because `eval()` can't get no love or safety on the browser side, everyone on the server-side has to suffer.

Ironically, introducing a fake compilation step where Javascript transpiles to Javascript (not like babel.js which targets older JS, but literally just the same lang spec) is the way to side step the `eval()` problem, lol! (expanding those `eval()` in a fake compile step)

Re: Ask HN: Is TypeScript worth it?

#382

Earlier quoted context omitted.

whoever said that javascript was a simple version of java? the two languages have almost nothing in common - at least a unicycle and a bicycle share the concepts of "wheel" and "pedals".

The syntax is very similar on the surface, at least compared to Perl, PHP, Python, C and - I would personally say - C++ and a number of other languages. Yes, there is no way you'd mistake one for another if you have worked in any of them - but they look superficially similar.

No they really do not

Re: Ask HN: Is TypeScript worth it?

#383
post #276

TypeScript feels like it's trying hard to become Java Enterprise level of complexity :)

I think that's right. I was thinking about that as I composed my own reply to this thread: it's got many of the hallmarks of J2EE.

That is to say, it's got features that a thoughtful CTO in a very large organisation somewhere, somehow has a well-articulated and nuanced use-case for, but it's not you and it's not anyone you know. And there are a lot of such features.

Re: Ask HN: Is TypeScript worth it?

#384
post #165

Earlier quoted context omitted.

> If you don’t see the benefits of types then typescript may not be for you. At this point in my 20+ year career working with mostly dynamic languages, my feeling is that if you don't see the benefits of types, then programming isn't for you.

Eeexactly. Untyped Python and Javascript are amazing if you're doing things solo or maybe with one other person who has the same style. Now try that with a 20 person group poking the same codebase. The amount of weird bugs you run into because it's not clear what type(s) a function can take in or return is bonkers.

Types are indispensable even just for me. They reduce how much I have to jump over to the docs and how much runtime debugging I do.

Most importantly, they help when I revisit something after even a few weeks and forget what certain parts of the code did.

Re: Ask HN: Is TypeScript worth it?

#385

Earlier quoted context omitted.

> TS saves me time every day. Hmm, not my experience. I do TS for years now and still today I'm spending more time on fighting/pleasing TS compared to the actual code. JS with all its node_modules dependencies is a complete nightmare to get the typing right. I regularly have to change good solid code to please TS, but at the same time TS often doesn't complain when the typing is obviously wrong. I once started with A…

I’m noticing a pattern in your arguments. You need to understand that I (and I suspect many others) don’t have the same experience as you. I don’t _fight/battle with_ the type system, I work with the type system - and I enjoy it. It saves me countless hours. I don’t actually use javascript without TypeScript anymore - it’s simply not worth _not_ using it - for me. You ask whether it’s worth using it - and you keep te…

> a pattern in your arguments

> You ask whether it’s worth

> you keep telling people

I just want to point out that the account you're replying to isn't the OP.

Re: Ask HN: Is TypeScript worth it?

#386
post #304

Earlier quoted context omitted.

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....

but wouldn't the static code analysis complain in that example?

at least once you want to do anything meaningful with that x

Re: Ask HN: Is TypeScript worth it?

#387
post #234

Earlier quoted context omitted.

try out dart, its much better than TS

Not that TypeScript doesn't have it's pain points but having tried Dart on an Android application recently, there are so many things I dislike about the language and it's ecosystem compared to modern TS/JS. I feel like it would have been a lot better than JS when it came out but now it's painful to use in comparison. Definitely my preferred route for building mobile apps now though.

I now actually prefer Dart for services and glue code on the backend. I'm so tired of dependabot yelling at me about my hobby projects every week that have yet another vulerability in one of their million dependancies. In Dart I make do with just a handful of deps, then build a binary and call it a day. I tried using Deno with TS, but binaries it generated where absurdly big, 70-100MB depending on the target platform. Also, Deno's --allow-X thing becomes tedious after a while.

Re: Ask HN: Is TypeScript worth it?

#388
My biggest problems with TypeScript are that it regularly gives me null safety bugs even after I add guards. And I can't really trust the types typescript offers.

I've been using typescript for a year now and I just want to go back to Java at this point. Biggest obstacle to that is management believe it or not.

Re: Ask HN: Is TypeScript worth it?

#389
post #357

Earlier quoted context omitted.

> These estimations are pure imagination There are decades of literature on the matter. You simply have to look for it. Statically typed languages are known to lead to slower initial development times, because languages are inherently more complex and there are more concepts to grasp. usually thy also need to be compiled, which makes times even longer and setups harder. Good news is that long term they tend to be ass…

> Statically typed languages are known to lead to slower initial > development times I hear people saying that, but I'm not sure I buy it. Is there any research that supports that, and if so, for which languages? Also, what does "initial development" mean here? The first day, week, month, year? And unless your project is trivial, isn't it somewhat important that as much of the initial work as possible provides a soli…

PDF: https://www.ics.uci.edu/~jajones/INF102-S18/readings/23_hane...

see conclusions

intuitively static typing is less forgiving and forces programmers to write code in a specific form

think how much time has been wasted writing Java boilerplate code.

Re: Ask HN: Is TypeScript worth it?

#390

I share your feelings. These times, whenever I'm setting up a new TS project, feel like: 1) Look up "this months current way of doing things" 2) have a couple of horrible hours wrestling with tooling and the module system 3) add a new feature, install 1 lib with 30 deps 4) figure out that one dep does not work with TS/the chosen module system/whatever versioning related thing 5) go for a walk. scream into the void. c…

This is exactly what I struggle a lot with. I just want JavaScript with simple type checking. TypeScript goes way overboard. I also hate TypeScript decorators. I've seen that grossly abused in codebases that just drive my insane.
Post reply on HN