tc39 / proposal-type-annotations

ECMAScript proposal for type syntax that is erased - Stage 1
https://tc39.es/proposal-type-annotations/
4.27k stars 47 forks source link

TS sometimes redefines for..of to mean something completely different #223

Open conartist6 opened 3 months ago

conartist6 commented 3 months ago

If type syntax support is added, much existing TS code will become valid JS overnight. Most of this will be safe, but there will be subtle bugs and failures related to the TS downlevelIteration setting, which can cause TS to treat for .. of as meaning for (let i = 0; i < arr.length; i++);

conartist6 commented 3 months ago

Typescript's non-spec decorators implementation would become a similar runtime landmine if JS runtimes support both early-days TS syntax and final-release annotations

conartist6 commented 3 months ago

Not supporting TS syntax is providing valuable practical protection against these kinds of issues.