Hacker News new | ask | show | jobs
by dmmartins 551 days ago
I don't get the "type checking is the solution for the problems of the world". A lot of good things were/are written without type checking. Most of the problems I see in production have nothing to do with the wrong type being used or some forgotten required parameter. Also, typescript is just javascript with a mustache. It's the same thing
2 comments

> Most of the problems I see in production have nothing to do with the wrong type being used

I think this depends on how you use the type system in your code. If you're just passing around strings and numbers, then sure. But if you're making explicit types for all the entities your program processes, and if you're structuring them in a way that means you don't have a bunch of undefined fields in the normal case (e.g. by using tagged unions a lot), then Typescript is absolutely, objectively, transformative compared to Javascript.

yes, but they could have been made robust quicker with types. You still have types in untyped code, they're just in your head and the runtime doesn't know about them. That means you have to be extra thorough to do the type checking manually yourself, and having to write even more tests to validate your types and all those implicit assumptions