Bug: [no-unsafe-return] Infinite recursion with thenable this return type #10868
Closed
4 tasks done
Labels
accepting prs
Go ahead, send a pull request that resolves this issue
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
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=5.7.2&fileType=.ts&code=MYGwhgzhAEBiD29oG8CwAoa0AOBXARiAJbDQDmApgC4CSVEFIAZgBQCUAXNFQBZExpMWaACdquEQDtufCAG4MWAL4ZFOEfCoVgWgCYyKklmIjwQANwpd20ALwA%2BaOfhFdnJy-2DhoiqYsU7ApCKuihQA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1tieQEMAZolrRE%2BWNCbooiaNA7RI4MAF8QKoA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false
Repro Code
ESLint Config
tsconfig
Expected Result
No error, nor ESLint crash.
Actual Result
ESLint will crash because of an infinite recursion of the
discriminateAnyType
function in type-utils/dist/predicates.jsAdditional Info
When a class has a method return
this
andthis
is also a Thenable,discriminateAnyType
tries tochecker.getAwaitedType
on it. I assume it results in the samethis
type, which is then recursively checked infinitely.The text was updated successfully, but these errors were encountered: