3 ms·
I see a ton of comments that are dismissing this but from my experience most code has implicit typing of some sort. This looks like a nice replacement for hand
by haney 10y ago
I see a ton of comments that are dismissing this but from my experience most code has implicit typing of some sort. This looks like a nice replacement for hand written input validation, if my function expects a number and I pass a string there are 3 options AFAIK:
1) I have the ability to define a type that's required so that the function can't be called without a numeric type.
2) I add boiler plate the the top of my function to validate that I'm receiving a number.
3) I forget to do 1 or 2 and I get a runtime error when a different developer inadvertently passes an incorrect type to my function.