Live data from Hacker News

Ask HN: Is TypeScript worth it?

news.ycombinator.com

71–80 of 469 posts

Re: Ask HN: Is TypeScript worth it?

#71

I'd say for most people, beyond small scripts/cli/micro-microservices, the ceremony of setup/environment overhead for it is worth it, and continually pays dividends. You can usually copy-paste a common config file around to bootstrap. Most of your (pretty good actually) critique are points to make the least-bad way of doing JavaScript even better, and I'd agree could be improved. Others have taken notice. "Native sup…

I haven't found much agreement, or at least to the extent I believe it, that Javascript and HTML and CSS have all been shoehorned and built upon completely beyond their original specs.

Re: Ask HN: Is TypeScript worth it?

#72
To me it's worth it because as opposed to languages designed to be strictly statically typed, the type system is there to serve you, not the other way around. It's pragmatic and tailor made for its use case.

People who've always programmed in traditional statically typed languages like Java scratch their heads on why would anyone not want to have static typing, but the reason for that is simple: in a dynamically typed language you can (and often do) produce code that's hard or impossible to type in said statically typed languages.

TypeScript's designers recognized this, so not only there are escape hatches here and there, but also the type system over time evolved to adapt to the real-life use cases instead of imposing some abstract, complex type system which might not even be very useful when used against all the creative ways JS programmers write their code.

And it works.

Re: Ask HN: Is TypeScript worth it?

#73
Type checking and strongly typed languages are rapidly taking market share and in the near feature, except for niche specific software, mostly everything will be typed. There are a few reasons for this: it makes software easier to change and to test, and in a scenario of fast-growing complexity like the world we live in today, it is better suited for software development.

I would recommend to every software developer to learn the type ecosystem inside their language to make sure they have a good/high-paying job in the near future.

In 5 to 10 years, almost every serious engineering job will be working with an ecosystem that contains types.

Re: Ask HN: Is TypeScript worth it?

#74

Earlier quoted context omitted.

> From a different angle, is this a problem with the language itself or is it a problem with the libraries? It's a problem for me - the developer. From my viewpoint I don't really care where the responsibility of bad documentation lies, only that it makes me not want to use TypeScript. > Are you arguing JS libraries at large are better documented? Sounds highly dubious. You can't really decouple JS libraries from TS.…

> You can't really decouple JS libraries from TS. Most JS libraries still maintained support TS these days. My point is that many of them are still documented using JS with JS examples, and don't fully document the types that go along with all their methods. Ok, but... what you're saying here is that, while you're not convinced by TS yourself, you expect all JS library creators to be convinced. Why should they be?

I am not saying I expect them to be better documented, only that the reality is that they are not well documented in TS and that makes TS difficult to use.

Re: Ask HN: Is TypeScript worth it?

#76

As i said before, a lot of people expect that writing typescript is as easy as writing js, which is not. I estimate the typescript tax to be around 40-100% more time, especially if you want to do typescript right and not use `any` all over the place. And besides, typescript is a poor fit for someone who is used to writing highly dynamic, lambda based code, which is one of the main niceities of js. My guess is that a…

These estimations are pure imagination. I doubt you have `any` real data to support it. Also, that is not the reason why Typescript was created, nor the reason why people adopt it, not even what Typescript really is. Today, almost every Node.js framework supports Typescript out of the box. I challenge you to provide a modern framework that doesn't provide types. And this is not an opinion, nor it is wishful thinking, it is a fact: type checking and strongly typed languages will take over almost every modern software development paradigm.

Re: Ask HN: Is TypeScript worth it?

#77
For the most part, I only hear from typescript when there's a type mismatch.

Understanding the type mismatch is ofter difficult, but it does solve a real problem.

I also like that it gives escape hatches, for when I know what the type should look like, or I don't care what it looks like

I haven't found the typescript updates to be difficult, nor situations where packages I'm depend on require incompatible typescript versions

My pains are on that it's hard to get the setup right where you aren't depending on a giant set of types packages, giving you size bloat for things you mostly don't care about.

Re: Ask HN: Is TypeScript worth it?

#78

The whole shtick (and beauty) of Javascript is that it is a dynamic language. In some point in time corporate Java people started using JS, and now we have this : "is well understood that static typing is a good thing". It's not. But as always you have a vocal minority, influencers and evangelists shouting their BS, about how TypeScript has terraformed theirs lives and they can't imagine life without it. Use your hea…

Id argue the static typing is great, and the best part of Java that is otherwise ruined by OOP. Give me the types and leave out all the OOP factory garbage, and you are left with the best parts. That’s what typescript ends up being.

Typescript is significantly better than java imo, in that it can figure out what the right object shape is on its own for the most part, rather than needing to write another file for every intermediate data object in a process flow

Re: Ask HN: Is TypeScript worth it?

#79
post #23

> I want to skip over the static typing benefits argument, because I think it is well understood that static typing is a good thing and if we could bless JavaScript with a built-in and robust typing system then I don't think many people would be against that. My issue is with the amount of extra work it places on developers, much of it the "dumb" kind of work which can eat up hours and doesn't deliver all that much v…

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% value, 5% BS. It provides such plainly obvious value in my eyes that I've decided I'll never write JS again unless it's a single file script or a small throwaway project/PoC.

Re: Ask HN: Is TypeScript worth it?

#80
post #23

> I want to skip over the static typing benefits argument, because I think it is well understood that static typing is a good thing and if we could bless JavaScript with a built-in and robust typing system then I don't think many people would be against that. My issue is with the amount of extra work it places on developers, much of it the "dumb" kind of work which can eat up hours and doesn't deliver all that much v…

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…

Types help prevent a narrow class of errors. They also help with refactoring. They help avoid messy checks getting in the middle of your business logic. All of this is more than enough to justify using them.

Types do not replace other checks and tests.

I don't think the Mars satellite crashed because they trusted the type system.

Post reply on HN