News for hackers. Stuff that matters.
Re:TypeScript is terrible for library developers by Aeolun on Wednesday August 24, 2022 @08:26PM (#32587752)
To go through them point by point:

> Documentation: there's docs on how to use the language as a whole, but nothing focused on writing libraries (how to build/publish, type tricks that libraries may need that apps don't, etc)

Why would there be? Building and publishing libraries is a npm thing, and has nothing whatsoever to do with Typescript. Type tricks that libraries may need? If you are going to write a section like that it’s pointless to write it about libraries in specific. There is nothing about building libraries in specific because Typescript isn’t about building libraries.

> Debugging: debugging types is a nightmare - you basically have to hover over temp variables to see what intermediate values are

Sort of, if you’ve managed to make your types complex enough that you cannot reason about them. But then again, I don’t know of any other language that feels the need to provide a type debugger. The fact that people working with Typescript think they need it is either testament to their competence, or the ridiculous constructions they make.

> Complexity: TS types for real-world lib code can get complicated

Well, yeah. But it’s exactly as complicated as you make it.

> Testing: testing types is necessary, and the community has had to invent tools to help with that

I don’t know of any other language that thinks testing types is necessary. The big issue in Typescript is that types don’t guarantee anything about runtime behavior.

> Maintenance: maintaining types and responding to issues takes up time

Well yes. Maintaining any library in any language takes time. Do people think this is unique to Typescript?

I guess my own point mainly comes down to no other language having any of these things, and the OP’s idea that it’s on the TS authors to provide it feels misplaced. It’s not core to the language, and a lot of the problems are self inflicted.

The blog post/slides were interesting though :)

Re:TypeScript is terrible for library developers by acemarke on Thursday August 25, 2022 @12:54PM (#32596514)
I'm afraid I'll have to disagree with all of the above, especially the part about building libs.

Per the OP's article and my slides, there _are_ many aspects of maintaining a lib that are unique to TS above and beyond a plain JS lib, and it would be really helpful to have additional docs and tools available to help with our use cases.