-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Bug: [prefer-readonly] False positive if property was assigned after type guard for class properties #7221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
🤔 I don't understand what's being asked for here. Also, the playground link and code snippet aren't the same code. Could you please edit the post so they're the same, and provide an explanation for why the |
|
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=5.1.6&fileType=.tsx&code=MYGwhgzhAEAqCmEAu0DeAoa0AOBXARiAJbDQB288AJhLAPYBC8AIvAGZEVUD8AXObgC2%2BeACcA3Okw5RRAG5gk8cnSQAleGCp0yIAJ4AxOnT4DhYydOyyFSles3bdehmFGmyQkRKlY8hEmglZABZeCQACzoqIzoACgBKNGksIjZoOIBCSKIIADpQSAgABVE6bDEkPQBxXDcqRKSMLBboUXDcUTJJVoBfFKCI3LyyVQ0tHX1Y6ABeaABGHuh%2BqwJiUmCkMMjo11FE5Na0jOyh-NHRQTAQWD0K2vq4nPPKGnomVg4uBKaBrHakJ1ugN%2Bq1niMxo5Ji43LNoAAmJYrPw2RTKQpQUrlSo1OqiBoJfjPaC5QakgBkaHIr1ojBY7E41H4nnMomWhxaAKBZJe1FpHwZXGgmRmc1wZCoguoSN8MnkaJUl2ut3ueIaChAuHgzK8YmgAB9oOLJV9qIToBqtSSYCzvBz-h0uhbrlaRWKJVKqDLekA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Y6RAM0Wls4CGAEwD2TeIXRRe0EdEjgwAXxBKgA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylAGYBDVCXTgwAXxCygA&tokens=false
Repro Code
ESLint Config
tsconfig
No response
Expected Result
I expected that
private notReadonlyFoo?: number;
would not report any errors.Actual Result
@typescript-eslint/prefer-readonly
error on the 4th line:Additional Info
No response
The text was updated successfully, but these errors were encountered: