2 ms·
I'm a strong opponent against type annotations in JavaScript. JavaScript only have a few types: strings, numbers, boolean, null, undefined, and Symbol (ES6). An
by z3t4 10y ago
I'm a strong opponent against type annotations in JavaScript. JavaScript only have a few types: strings, numbers, boolean, null, undefined, and Symbol (ES6). And annotating them feels stupid. Feel free to use Flow, Typescript et.al. but let the type inferencer do the work, not you. You should only have to think about the abstract meaning of the code. And pick good names for variables and functions.
In order to catch more parameter errors, your functions should throw errors if the parameters are incorrect!