For 25 years, EMCAScript is weakly typed; always has been. At this point, what benefit is there to make a change as drastic as adding types? I get that the run-time is different, but really, is it worth making a gigantic change just to save a couple of microseconds?
I guess my main question would be: What would JS types do, that TS doesn't already do?
ftr, TS doesn't "make sure of that" if the value comes from the network, or the disk, or the user, or third-party code - the types of JS vars change all the time.
Are you talking about that Microsoft article? I saw it earlier today.
One benefit I can think of is that JS types possibly wouldnt require a build/compile step. Small benefit but would be a huge win for projects that want a less complicated setup but still want the typings.
The main point of adding types to ES would be to have automatic type validation as part of the language. This would make it easier to catch various types of errors that can occur due to an unexpected value type being assigned to a variable. This would incur a small (possibly negligible) performance hit in any ES engine regardless of the code since every variable write would need to be tested to see if the data being written is compatible. However, that same test written as ES logic is far more expensive.