Strictly-typed functions in JavaScript