Bug: [no-for-in-array] rule does not detect complex non-array situation #10743
Labels
bug
Something isn't working
locked due to age
Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
working as intended
Issues that are closed as they are working as intended
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=5.7.3&fileType=.ts&code=MYGwhgzhAEBmD28A8ARaBTAHgF3QOwBMYJsAnASzwHMBtAXWgB9oAldYeUgpEi6gGmh4ArgFsARulIA%2BadADeAKGjQADqXiqAXNDTMRIEE2jDC6WJXQEA3Mui4S0ALzQAFAEpncpSpUc8jmCkpGAAns72ABbkEAB06pq2vtDksG4AgsFhsTGZIaGuQfnunj7J0AD0FULwALQIpLWUtUVh0KToqpzYMBzB7NggoXbJDW7%2BjuQpeNCtoaUj5RPwIOixIPBUhVmhNOR07knlfvAB2NAA%2BuS4ohFze3SLxypVAHoA-E-QAL6L3xggCDoBRfKo1eqcJp4Fo7aAEeDoGB4eDnDpdUjnPodYCDUKxaAAFWiMBiNVmOy%2BY1cE3OU0o5OKIOe0GWq3Wm22%2BQehy%2BJzOl2u6FuLnu%2B155Ten2Ov2SMp%2Bil%2BQA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1oDMPpbmtAIbRoQwuiiJRfSODABfEAqA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false
Repro Code
ESLint Config
tsconfig
Expected Result
We have a check
Array.isArray()
, but TS does not detect it is no array-like.Actual Result
Since #10535 ("report on any type which may be an array or array-like") this code get reported as an error.
I am totally fine to accept that this complex thing is failing the "may be an array" test.
I know Typescript is not perfect in flow analytics.
But perhaps you are interested in this.
Additional Info
No response
The text was updated successfully, but these errors were encountered: