type checking for the browser and node.js