3 ms·
If such (refactored) method is being called from code that's not covered by tests Well there's your problem :p I agree that if code has no tests, it's more li
by orangecat 6y ago
If such (refactored) method is being called from code that's not covered by tests
Well there's your problem :p
I agree that if code has no tests, it's more likely to be correct if it's in TypeScript than JS. But I don't consider that an acceptable bar, so if I'm doing your code review I'm going to ask for tests in either case. And once you have tests that verify the behavior of the code, you're not getting much incremental benefit from type checking.
- yawaramin 6y agoUnit tests can only prove the presence of bugs; they can never prove the absence of bugs. Only a typechecker can do that (provided an appropriate implementation). E.g. here is an AVL tree that is verified balanced at the type level: https://sketch.sh/s/C7Afz38jtFRMTkkydeBgUA/ https://sketch.sh/s/C7Afz38jtFRMTkkydeBgUA/ No unit tests needed to show that it is balanced :-)