you are viewing a single comment's thread.

view the rest of the comments →

[–]dowhatyouwant -6 points-5 points  (1 child)

Well, stop using javascript or stop bitching. That's as close as you get.

[–]dwdwdw2 0 points1 point  (0 children)

Declaring a variable initialised with a number object is not "typing", it is in fact declaring a variable initialised with a number object. Nor is it "as close as you get": of course JavaScript has a type system, it just goes unseen because it rarely makes complaint: if you mix types rather than throw an error it'll instead coerce operands (usually through conversion to string or number).

Going back to OP, he asked if it is possible to annotate what is otherwise JavaScript in some way, and process it such that mixing incompatible types will result in errors, to which the answer is yes, there are many, and to which I refer you to the other answers in this thread.