News for hackers. Stuff that matters.
Re:From TypeScript to ReScript by z3t4 on Thursday January 13, 2022 @11:01AM (#29922190)
I add a bunch of tests at the top of all JS function - To make sure the parameters are correct. There is no good reason to not write these tests. You can throw friendly errors, and bugs will be detected early.
Re:From TypeScript to ReScript by ragnese on Thursday January 13, 2022 @11:26AM (#29922579)
So you've written a bunch of bespoke type checkers that run at runtime instead of compile-time...

Shouldn't we be able to just have actual static typing instead?

Re:From TypeScript to ReScript by z3t4 on Thursday January 13, 2022 @12:53PM (#29924064)
I also use automatic tests, and most of the time it's the tests inside the functions that detect the error - because the tests runs the code. It's much more simple then trying to prove correctness before the program haven't even run once.