That's what I loved about the [basically] now-deceased Actionscript 3 [1]. It was an optionally typed Javascript with compile-time and runtime checking, packages, and namespaces. It was an absolute pleasure to code with. I would generally start my prototypes untyped to get something running quickly as a throwaway, and then rewrite strictly typed as I better understood the problem. I was very happy to ditch Flash years ago, but I would have loved to have AS3 replace Javascript.
1: http://en.wikipedia.org/wiki/ActionScript#ActionScript_3.0