Comment by bazoom42

3 years ago

> If types were added to javascript it could also dramatically improve the performance of javascript virtual machines

Are you sure? In my understanding modern JS engines basically makes type inference on the code anyway, and in the rare case when types are observed to change at runtime, it is special-cased. So static types might simplify this but I dont see how it would dramatically improve performance.

And chances are(?) typescript code are to a larger degree monomorphic than javascript making the JIT more efficient(?).

At least typescript discourage writing functions where the parameters can have wildly different types since this is un-ergonomic and/or hard to type.