Re:A Proposal for Type Syntax in JavaScript
by colejohnson66 on Wednesday March 09, 2022 @04:04PM
(#30619930)
That's a major limitation of JavaScript. For example:
Now, addition is a contrived example because it'll still work with strings, but the point is that such usage violates my code contract because the contract was deleted during compilation. It's possible to do this:
But that's needlessly verbose, and eslint will complain about useless code. If enforceable type annotations could be added to JavaScript, that'd be a huge plus.
[ Parent
| on HN ]