Hacker News new | ask | show | jobs
by Wazako 1132 days ago
typing saves so much time. Especially since the flexibility of its optionality does not restrict, and allows for really nice autocompletions.

Especially with esbuild which has made this simple and fast, one could even say it has saved javascript.

3 comments

I have ample experience with typed languages like C++, C#, Java, Kotlin, Go, AS3, Swift, etc.

Maybe I just have exceptional memory but I rarely encounter a problem that would have been solved by using TS.

It's about big codebases and team use, not about you.
Yep, they're a communication and documentation tool that happens to have pretty-good machine readability and correctness-checkability. Sometimes the person you're communicating with is your future self, is all. Sometimes it's just yourself five minutes from now, even.
They didn't mention big codebases or working on a team, though. Also, you can just use JSDoc.
Even in a solo project, you import libs from others. Never felt the need for those libs to have types.
Every use case is different.
Typing wastes time. Teammate and I tried switching a backend project to TS, and I kept a mental note of time spent defining types vs time saved not debugging type-related issues. The result was some high number vs 0. Also messed with the toolchain, making things like Node profiling not work.
If you already have an existing, functioning codebase, adding types is not saving you time (right now). It's akin to adding a lot of unit tests. You gain time later, and often indirectly from others not making mistakes your types would prevent.
Ample time passed, we added more after we were already on TS, and it wasn't helping. In fact it was a constant burden on new code.
Alright, good luck out there. I strongly prefer types
Is it a solo project? The time savings of typing is really a function of project size and number of collaborators. For a small, solo project it’s either neutral or a negative.
It was team-sized. So, not writing open-source libs used by multiple companies or something, but ~10 people were looking at the code.

At my current job we do have a lot of untyped Python used by tons of people, and it's fine. People can read the code without it asserting in every line what each variable is. You just make sure any widely-used APIs are documented properly, which typing doesn't really help with. Also anything modern is more microservice-oriented which comes with nicer boundaries, and everything has tests (which again typing is no substitute for). Typing seems like a mostly outdated thing for application-level stuff.

Believe it or not, autocomplete is still possible without typing, as any user of any dynamic language could tell you. Seems like a poor reason to add a another full language to the abstraction ladder of your application.