2 ms·
A unit test is a functional assertion. A type is a semantic construct that can provide that, but it provides a lot more. As a trivial example, if I create a ty
by shermantanktop 10mo ago
A unit test is a functional assertion. A type is a semantic construct that can provide that, but it provides a lot more.
As a trivial example, if I create a type alias from “string” to “foobarId,” I now (assuming a compliant language) can prevent code that consumes foobarIds from accidentally consuming a string.