3 ms·
After working on large Javascript projects and running into and cleaning up countless issues that static typing would solve, I've come around to being a huge fa
by AgentME 11y ago
After working on large Javascript projects and running into and cleaning up countless issues that static typing would solve, I've come around to being a huge fan of static typing. Now, every line in an untyped codebase looks like a potential typo or reference to an old function that was refactored ages ago just waiting to blow up at runtime. Tests help, but only after you've written them.
I really like Javascript, so I've been using Facebook's Flow type checker, and it's been great. I was already using Babel (with Browserify), so nothing about my build process even needed to change. It makes it easy to gradually add type-safety to a codebase. It doesn't get in the way of common Javascript patterns. Callbacks are still lightweight, but well-typed. I can still bypass the type-safety and monkey-patch a property onto an object while I'm testing something.
- henryw 11y agoAfter coding for awhile now, I've also developed a penchant for statically typed languages. I've been forcing myself to use TypeScript whenever coding JavaScript for the static typing.
- danieldisu 11y agoIt happen the same to me, I ended up migrating the codebase to Typescript, and now I can have almost everything I want from a language, types and functions...
- ucho 11y agoCode completion(API) has big impact on my productivity in larger systems. With dynamic typed languages I ended up with type annotations everywhere - so advantage of not having to declare variable types kinda disappears.