News for hackers. Stuff that matters.
Re:Deno will stop using TypeScript by hnarn on Sunday June 21, 2020 @12:43PM (#23593125)
> With JS, I almost never want to verify only that a value is of a specific type; I want to look at its contents

We're pretty deep down in abstract discussions here and I have no idea what your code looks like or what it does, but I think it's helpful to point out that knowing the type means you already know the contents to some extent.

The way I see it, checking if a value is what you expect is always good, but if you additionally get an error automatically because your number is now suddenly an e-mail address, or the function you wrote that expects phone numbers suddenly gets a name instead, in my mind that's "built in testing". It doesn't make other testing unnecessary but it sure raises the bar for cleanliness -- which is especially useful when you're working with other components that aren't JS where types do really matter (like databases, for example).

There are no comments on this comment yet.