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
Error: Private identifiers are only allowed in class bodies and may only be used as part of a class member declaration, property access, or on the left-hand-side of an 'in' expression
I don't know what isForInStatement is supposed to do there. I was unable to find the commit that introduced thisβgit blame took me to #44648 but that didn't have this condition.
The text was updated successfully, but these errors were encountered:
Launched bug fix #58798 it seems that some of the logics were introduced in the bug fix #46824 .
Some of the thoughts here: first into logic getContainingClass(), after that, check whether it's in a for-in block and privId is the initializer part of the for-in, if so, this would be caught by the checkForInStatement().
Then into the isExpressionNode() logic, which would only allow privId be the left side of the In-expression, which the problem of right sight of for-in block would solved with a Error Diagnosis.
After these logic, we can make sure only privIds in In-expression come out and then we check its declaration.
π Search Terms
Private identifier, for...in
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.5.0-dev.20240603#code/MYGwhgzhAECC0G8BQ1oGIBGAKAlIlq0AZgPYBO0WwJAdhAC7RjQCWN6Geyh0Avgf35A
π» Code
π Actual behavior
No errors
π Expected behavior
Error:
Private identifiers are only allowed in class bodies and may only be used as part of a class member declaration, property access, or on the left-hand-side of an 'in' expression
Additional information about the issue
Noticed this while working on typescript-eslint/typescript-eslint#9232. There's a very suspicious condition in code: https://github.com/microsoft/TypeScript/blob/5a4134470128a062a8297f404dfb3321f8f55798/src/compiler/checker.ts#L33699
I don't know what
isForInStatement
is supposed to do there. I was unable to find the commit that introduced thisβgit blame took me to #44648 but that didn't have this condition.The text was updated successfully, but these errors were encountered: