by jakelazaroff · 6y ago · 0 comments
It's easy enough to write a runtime type checking library; I wrote a tiny one that I use in basically all my projects: https://npmjs.com/package/narrows
Yes, that is the thing being criticized here.
I understand that it’s not TypeScript’s job at the moment, but it’d be great to enable runtime checks with the flick of a switch without typing extra code.
function upper(s: string) {
return s.toUpperCase();
}
This function could have a nice implicit TypeError instead of “undefined is not a function”