4 ms·
They are a compile time contract at best, they are nothing like a test.
by lucisferre 8y ago
They are a compile time contract at best, they are nothing like a test.
- mort96 8y agoA 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.
- azangru 8y agoThey 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.
- Sammi 8y agoHalf the tests I write for Javascript code are type tests. Typescript does that much better.
- coldtea 8y agoTest 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.