Hacker News new | ask | show | jobs
by sdegutis 2559 days ago
I've been a big fan of TypeScript for a few years, but lately I've been Considering Removing Typescript[1] from my project, because it seems to have just as many drawbacks as benefits, and the freshness of pure JavaScript is starting to look appealing again.

But I haven't heard anyone take this perspective and I'd be really curious to hear people's thoughts on this idea.

[1] https://sdegutis.com/2019-06-20-considering-removing-typescr...

1 comments

> Browsers don’t support it, so it adds an extra build step. Type-completion has gotten slower the bigger our project gets.

This is something a faster computer can mitigate. Also I would compare the time you spend guessing what parameters actually are in vanilla JS vs the seconds you lose waiting for a Typescript build. Silicon time is much cheaper than carbon time.

I don't understand how anyone doesn't use Typescript for large projects. Javascript is just too lenient. It doesn't even complain when you're not matching a method signature that you call; you can't even catch these ninja errors let alone explicitly know they dropped on you. There's a lot of value when you have a system that adds more checks and validation before runtime.

That's the general consensus and how I mostly feel too. But I'm starting to feel like the drawbacks might possibly be outweighing the benefits.
If we were talking about Ruby or Python, you'd have a stronger point. However Typescript's benefits far outweigh its drawbacks in light of Javascript's excessive lenience. Since, you're complaining about types, have you made good use of Typescript's interfaces and class inheritance? They're pretty powerful and even more flexible than something like Java.
Yes, I use TypeScript types very idiomatically and have received very positive feedback on my TypeScript code. But just running `tsc` takes >10 seconds on a relatively small project, and IDE support is becoming proportionately slow, e.g. hovering over anything to show its type often takes 5-10 seconds before VS Code will actually have something to show me. It's becoming painful, and that feature which I once heavily relied on has become nearly useless to me.
Is the time spent compiling drastically more than the time spent debugging code because of the lack of types? A few seconds of compiling is because than the potential hours wasted on debugging. Besides, you can mitigate compile times by getting a faster computer. Silicon time is still way cheaper than carbon time.
It's not just "seconds wasted in compiling". It's having my IDE say "thinking..." for 3-10 seconds every time I want to see what type something is. Or having create-react-app load for 5-15 seconds, every time I save any file before letting my browser update (even if I press refresh manually), because it's compiling. And when this happens on a minute-by-minute basis, it drastically slows down development time.