Type checking for JavaScript functions