You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Downlevel for (this.#x of ...) / for (this.#x in ...) emits __classPrivateFieldGet(...) as the loop target #65413
(Playground, 6.0.3, target ES2017: the .JS tab shows for (__classPrivateFieldGet(this, _A_x, "f") of [11]) { } with 0 errors. The 7.1 nightly in Playground v2 emits the same.)
ReferenceError: Invalid left-hand side in for-loop
🙂 Expected behavior
A valid assignment target, and node repro.js prints k as it does with --target es2022. For destructuring ([this.#x] = [11]) tsc already emits ({ set value(_b) { __classPrivateFieldSet(...); } }).value; the for...in/for...of initializer, when it is not a variable declaration, needs the same treatment.
Additional information about the issue
Private accessors (set #x(v)) behave the same way. The whole module fails to parse, so nothing in the file runs.
This was found with an AI-assisted differential testing tool; the repros and outputs above were re-run on the listed versions.
Activity