A clean-ish way to add type assertions to methods in Javascript