ottypes / json0

Version 0 of the JSON OT type
447 stars 64 forks source link

Add type check in string inject function #18

Closed ovvn closed 6 years ago

ovvn commented 8 years ago

Got an "Uncaught TypeError" when s1 param wasn't a string (e.g. a boolean value)

ovvn commented 8 years ago

@josephg, @devongovett any feedback, please?

josephg commented 6 years ago

I see what you're going for here. But we don't usually do this sort of thing in javascript unless the mistake is common, dangerous or both. The reason is that if we did we'd need to add type checks to all the other parameters too, and aint nobody got time for that.

If you want nice error messages on parameter type mismatches, I recommend typescript.