Live data from Hacker News

Ask HN: Is TypeScript worth it?

news.ycombinator.com

231–240 of 469 posts

Re: Ask HN: Is TypeScript worth it?

#231

Learn infer and extends and you will accept all the downsides being zen from the height of your highly well typed codebase. If you don't find the following compelling: type IsParameter = Part extends `[${infer ParamName}]` ? ParamName : never; type FilteredParts = Path extends `${infer PartA}/${infer PartB}` ? IsParameter | FilteredParts : IsParameter ; type ParamValue = Key extends `...${infer Anything}` ? string[]…

Did you write that blog post? Cripes, it is amazing. What a brilliant idea. Thank you to share. My brain is wired for C++ templates, and the technique makes good sense! To your last point: Why not C#? It is interesting did not mention it, as TypeScript came from Microsoft R&D (as I understand).

I did not write the blog post, it was just a simple infer/extends non-trivial example explained in depth, commonly used in packages like express and so forth. TDungeon [1], a game running on the TypeScript type system, really showcases how powerful the type system truly is.

Why not C#? Probably because Anders Hejlsberg [2], lead architect of C# and core developer of TypeScript, wanted something different. More of a sociological, rather than technological, reason.

[1] https://github.com/cassiozen/TDungeon

[2] https://en.wikipedia.org/wiki/Anders_Hejlsberg

Re: Ask HN: Is TypeScript worth it?

#233
I don’t mind it, but I do I think its a stretch to consider it a “skillset” that I need to pass memorized questions about when joining a company

its like, just there. I hate how its existence dilutes the javascript community’s example code for some libraries.

I find it cleaner than just JS but its pretty easy for me to keep up with value inferred type in just JS

I would write my new projects and tests in Typescript

Re: Ask HN: Is TypeScript worth it?

#234
post #214

Is it worth it compared to what? Plain JS? Transpilation from a different language? Rust? Growing apples? I have used plain JS, GWT, and TypeScript. TS is an incredible improvement over the two others. The TS type system is excellent, very expressive and helpful. An important advantage you get from static typing is that your IDE has more information to work with and so becomes more powerful. If you code in a text edi…

try out dart, its much better than TS

Re: Ask HN: Is TypeScript worth it?

#235
v) It’s been well over a year, and IntelliJ Idea still requires me to go to the settings page to enable an experimental feature to be able to run a simple helloworld.ts.

Not sure whose domain this falls in, but the situation is a coal mine canary that tells me the whole ecosystem is not up to the level I want from my production tools

Re: Ask HN: Is TypeScript worth it?

#236
I think what you've done here is document the pain introduced by using TypeScript, but you've not documented the (unknown) pain from not using it.

The question should really be, are the development pains you have more or less than the (most likely) production pains you'd see if you weren't using it?

I personally believe that more problems in development for reduced production outages is the right answer for the vast majority of software development.

If would be interesting to know of cases where projects have stepped away from it. I'm sure there are some examples and it would be interesting to understand their reasoning.

Re: Ask HN: Is TypeScript worth it?

#237

Earlier quoted context omitted.

Thanks for your work, TS saves me time every day. I was saying something similar to the op 3-4 years ago but really cannot picture working without some kind of type safety in JS now.

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

What's Math.sqrt("hello")?

Re: Ask HN: Is TypeScript worth it?

#238

I like it. I wasn't convinced it was worth it for the first year or two, especially when TS was young, but the devs have done a great job and have paved over a lot of the weak spots. Things I didn't even expect would get fixed have been fixed. I just try to type things 90% of the way, until it's good enough, and slap an `as` in there if I get too annoyed or it takes too long to fix. Don't even care. It doesn't put me…

> I just try to type things 90% of the way, until it's good enough, and slap an `as` in there if I get too annoyed or it takes too long to fix. Don't even care.

Still a js dev in spirit <3

Re: Ask HN: Is TypeScript worth it?

#239
I've worked on multiple Typescript projects for years and I'm still not convinced it is actually an improvement over working with plain JS.

Lately I've been using Typescript's JSDoc comments just so I don't have to deal with transpiling code but still get most of the advantages like editor autocomplete and warnings.

Re: Ask HN: Is TypeScript worth it?

#240

Earlier quoted context omitted.

I think its good to bring up SPAs in this context: fundamentally, they shouldn't exist, and you're using the browser wrong. They are the poster child of design smell when it comes to "web apps". Do you need SEO to work, even though Google Search torpedoed effective SEO a long time ago? Search engines disfavor websites that are extremely opaque and are made of a single page or few pages. Do you need to be able to open…

> I think its good to bring up SPAs in this context: fundamentally, they shouldn't exist, and you're using the browser wrong. They are the poster child of design smell when it comes to "web apps". So a universal, cross platform, cross device, responsive, accessible UI stack that has simple distribution, avoids walled gardens and has excellent performance is a "design smell"? > Do you need SEO to work, even though Goo…

I agree someone is doing something wrong, wrt sluggish browser performance and routing. However, I keep being exposed to this in random SPAs I get exposed to; I can only conclude this continues to be a problem that developers have and the popular frameworks somehow footgun them into this.
Post reply on HN