Bug: [no-unnecessary-condition] false positive on indexed access of a generic type #7850
Closed
4 tasks done
Labels
accepting prs
Go ahead, send a pull request that resolves this issue
bug
Something isn't working
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=5.2.2&fileType=.ts&code=GYVwdgxgLglg9mABAUwB4EMC2AHANsgHgBUVUpkwATAZ0TgCMArZaAPgAoAoRRdAJwDmALkREANN0QBrZAE8RM2XGCienAJQiAbnBiVEAb0kQE1KInoBGRAF5eggNqKAuogCEdsCFy4A3MdNzegAmW3sBJzlXAH5oxAByYHQfenQIKXj-AF9OEzAzOhEDRGA4OBEzPhgwAQAfLx9ELLDi0vLEBtwm-zQsPGR2ODEEtvj1XyA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1tiacTJTIAhtEK0yHJgBNK%2BSpPRRE0aB2iRwYAL4gtQA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eFYDArugDTg10NM8AOXapUAYQAW6aAGsylDt160isAKpF2JdABMACgENMh%2BOjxYFYAGaHUOnjShrN2vQBlY0O1dv3lTpAuRNDScnoAkkS66AAeegCC0NDoJFZKvAC%2BIJlAA&tokens=false
Repro Code
ESLint Config
tsconfig
Expected Result
No error should be reported since it is possible to supply null values on properties of the incoming object in the example.
Actual Result
An error gets reported saying that null and the value of the type that it is compared with does not have any overlap:
Additional Info
No response
The text was updated successfully, but these errors were encountered: