Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

They are a compile time contract at best, they are nothing like a test.


Test and compile time contracts both check invariants.

Abstractly speaking, there's no big conceptual chasm that separates a test in a test suite from a test the compiler makes.


A lot of tests end up testing things which would've been caught by the type system. Static and strong typing doesn't make tests in general unnecessary, but it does mean you don't need quite so many trivial tests.


Half the tests I write for Javascript code are type tests. Typescript does that much better.


They are checking the shape of inputs and outputs, making it unnecessary to test that a function returns a value of a particular type or that this value has particular fields. They make sure you don't make stupid mistakes, leaving it up to you to test really valuable bits of logic.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: