Live data from Hacker News

Ask HN: Is TypeScript worth it?

news.ycombinator.com

161–170 of 469 posts

Re: Ask HN: Is TypeScript worth it?

#161

Hi there! I work on the TypeScript team and I respect your feedback. Of course I do think TypeScript is worth it, and I'll try to address some of the points you've raised with my thoughts. i. Dependency management is indeed frustrating. TypeScript doesn't create a new major version for every more-advanced check. In cases where inference might improve or new analyses are added, we run the risk of affecting existing bu…

Great of you to hop in. Just want to say that while I can typically navigate error messages in TS, I do occasionally have to do some googling on some error messages (specifically ones around generics that have a super type that apparently doesn’t necessarily agree with a subtype or something — still don’t quite get it), and it’s nice to see that the TS team recognizes the obtuseness of these messages is an issue.

Re: Ask HN: Is TypeScript worth it?

#162

I feel like TypeScript is definitely worth it BUT it seems to be getting ever more powerful but not in a good way, in complex way. Too much time is spend fighting TypeScript as opposed to writing application code. I have a question for the language experts out there .... why is TypeScript getting so complex? Are other strongly typed languages this complex? Or does the complexity arise from trying to overlay typing on…

> Or does the complexity arise from trying to overlay typing on JavaScript which is an incredibly dynamic language?

Mostly this. There’s still some valid constructs in Javascript that are inexpressible in Typescript (though I’m inclined to believe most common ones are covered by now).

But to be honest, that’s not anything you are forced to use. A lot of people do because the benefits it brings are so nice.

Re: Ask HN: Is TypeScript worth it?

#163

I feel like TypeScript is definitely worth it BUT it seems to be getting ever more powerful but not in a good way, in complex way. Too much time is spend fighting TypeScript as opposed to writing application code. I have a question for the language experts out there .... why is TypeScript getting so complex? Are other strongly typed languages this complex? Or does the complexity arise from trying to overlay typing on…

You answered this all yourself. Yes, it's a hack. Yes, probably some other WASM-targeted language will exceed Javascript's mindshare. But that may take many years, and you need to build software now.

Re: Ask HN: Is TypeScript worth it?

#164

100% worth it to me. I love typescript. Working on large enterprise applications where one function calls other function and it goes 10+ layers deep I don't know how I would work without typescript. Just being able to see this function takes argument of type FOO and returns type BAR[] is incredibly valuable.

One thing I often tell people is that if a particular technology makes it easier to work with code that's 10 layers deep, it will also make it more likely that people will write code 10 layers deep where they would previously do 5 layers.

Somewhat similar to https://en.wikipedia.org/wiki/Jevons_paradox

Re: Ask HN: Is TypeScript worth it?

#165

> Is Typescript worth it? > I want to skip over the static typing benefits argument… Typescript, as the name implies, adds types to your script. If you don’t see the benefits of types then typescript may not be for you. > My issue is with the amount of extra work it places on developers… and doesn't deliver all that much value. If you think adding types doesn't add much value then typescript may not be for you. In my…

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

Re: Ask HN: Is TypeScript worth it?

#166
We recently brought a large js project from js to ts and, while we had issues, almost all to do with transpiling and the obvious end result being javascript which is not typed. Coming from f#/c#, and having used Purescript, typescript feels familiar, however, it takes too much from js imho. Especially the automatic coercing is pretty annoying to us and still causes pain we would not have in the other languages mentioned above, but it is miles better than js. We can refactor much faster than we could before.

We definitely are happy with the move. I will never be a fan, but the alternatives I cannot sell to the team.

Re: Ask HN: Is TypeScript worth it?

#167
post #23

Earlier quoted context omitted.

Doesn't your counter-argument beg the question whether it is indeed 20% BS vs. 80% value? I think the OP is asking about pretty much that percentage. Personally I feel it's more like 70% BS vs. 30% value. Types, after all, are a very weak ontology, i.e., you still cannot know for sure that just because your code compiles it interprets the values it's getting from other party's code correctly. I would even argue that…

You need to parse and/or validate any external input before you declare that a variable or field is a certain type, as you probably should be doing without Typescript anyway. Being strict in what you accept and ensuring that you're not lying to the type checker solves the vast majority of these types of issues. It's been a few years since I worked with TS professionally, but at least at the time, I saw it as 95% valu…

In my experience, even the one file scripts eventually get converted to Typescript when I realize I cannot specify my types :)

Re: Ask HN: Is TypeScript worth it?

#168

I feel like TypeScript is definitely worth it BUT it seems to be getting ever more powerful but not in a good way, in complex way. Too much time is spend fighting TypeScript as opposed to writing application code. I have a question for the language experts out there .... why is TypeScript getting so complex? Are other strongly typed languages this complex? Or does the complexity arise from trying to overlay typing on…

Typescript doesn’t just statically type. That’s easy. It does program flow analysis to 1) infer type and 2) ensure the inferred types actually work. I think in most statically type environments, the type analysis engine relies a lot of on the developer to define the correct types in the correct places, but the types in TS are always _logically_ correct. As in absolutely correct (unless of course you eject from the type system using coercion).

Re: Ask HN: Is TypeScript worth it?

#169
TypeScript is great for what it is, and definitely worth it. It is like JavaScript, just better. Just don't go overboard with types, because you don't get proper guarantees anyway!

I am not using many third-party libraries at the moment, and mainly develop my own, so I am not really running into any of your pain points. For my own libraries, developing them in JavaScript rather than in TypeScript would be just plain stupid.

Re: Ask HN: Is TypeScript worth it?

#170
post #148

For ii.) Typescript is a superset of javascript. If it annoys you to try to translate JS documentation into TS, then don't. Just use the JS example and use ts-ignore or something similar. Why throw out TS when you can literally suppress those one-off instances? iii) You should see C++ template errors if you think the TS errors are bad. The TS errors do suck sometimes, but when I see which line of code it's complainin…

There is a big issue with “suppressing one off instances”: the truth is you’re either fully bought in or you’re not. If you have “any” types or ignores littering your code base, you don’t have type safety, and at that point, why even have typescript? There’s not _really_ any such thing as being “mostly” type safe. You could argue that “this part of my code is type safe” but if it interacts with any other part of your code that isn’t, then what’s the win?
Post reply on HN