Yep. I've had the foolish (mis?)fortune of scaling a couple of frontend projects from small to not-so-small starting in JavaScript and then converting to TypeScript. In each one, starting out with vanilla JavaScript was faster (no build!), but at some point our velocity would slow as changes required more testing infrastructure. After switching to TypeScript, we were faster than before. Sure, dealing with TypeScript…
Ask HN: Is TypeScript worth it?
51–60 of 469 posts
Re: Ask HN: Is TypeScript worth it?
#52Earlier quoted context omitted.
> Did you upgrade Typescript (and if so, why), What an odd question! Even ignoring new features and better type inference that comes with new versions — once you add typescript to your project, it becomes one of its dependencies. Don't you regularly update your dependencies, just as a good practice, not to let your codebase slowly rot?
> Don't you regularly update your dependencies No. Update dependencies as needed for security patches (which typically avoid breaking changes), other than that never update unless there is an explicit business need.
Re: Ask HN: Is TypeScript worth it?
#53After years of Flow, Typescript, Webpack, React, JSX, etc, I went back to just vanilla HTML, CSS, JS for my most recent production project ( https://play.d2lang.com , which is open source). The experience was great. I didn't find myself missing any of those tools.
Re: Ask HN: Is TypeScript worth it?
#54My use case is a bit odd, but I've been using it for small personal web projects — so small that no dependencies are being pulled in and bare tsc is being used in place of a bundler — and as someone who doesn't have all of the ins/outs and do's/don'ts of JavaScript committed to memory (the vast majority of code I write is Swift or Kotlin) it's wonderful to have something catching errors before I save and reload the b…
Dependencies are where it starts to get tricky. It also gets tough when someone else has configured TypeScript, or you need to add some complex config. I would still opt out for smaller projects because they don't quite benefit so much from TypeScript, and eventually I would expect to run into something that would eat at hours of my time for a simple change.
Re: Ask HN: Is TypeScript worth it?
#55I no longer have to worry about things unknowingly becoming undefined or falsey.
When chaining map, filter, and reduce, I know at every step of the way what kind of object I’m working with.
And when I use a dependency, I don’t have to trust possibly outdated documentation but can rely on types.
Just these three things make it 100% worth it for me.
Re: Ask HN: Is TypeScript worth it?
#56Re: Ask HN: Is TypeScript worth it?
#57Re: Ask HN: Is TypeScript worth it?
#58Yep. I've had the foolish (mis?)fortune of scaling a couple of frontend projects from small to not-so-small starting in JavaScript and then converting to TypeScript. In each one, starting out with vanilla JavaScript was faster (no build!), but at some point our velocity would slow as changes required more testing infrastructure. After switching to TypeScript, we were faster than before. Sure, dealing with TypeScript…
Can you think of examples where it's prevented broken software? I would prefer to spend more time writing good unit test coverage which in my experience would catch anything that TypeScript would have caught. I have seen it be more useful for autocomplete and self-documenting code, which I could get using JSDoc or something similar.