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
TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions
TS2577: Return type annotation circularly references itself
5.1.6 regression
🕗 Version & Regression Information
I see the issue with TS 5.1.3-5.1.6 and the latest nightly.
What's strange is from my tests it seems that if I run tsc filewithcode.ts it compiles fine but if I run tsc on the whole project it produces errors.
Most likely you're having a tsconfig.json with noImplicitAny enabled. When running tsc on individual files the compiler won't use your project configuration, and the default value for noImplicitAny is false.
For what it's worth, this circularity was introduced by this call that tries to choose between undefined and void based on the contextual return type. That leads to requesting the other signature's return type and it requests the first one again (here) because it is in its compositeSignatures.
Bug Report
🔎 Search Terms
🕗 Version & Regression Information
⏯ Playground Link
Variant 1 (no return type annotations, 2x TS7024)
https://www.typescriptlang.org/play?target=99#code/GYVwdgxgLglg9mABMAPAFUQUwB5U2AEwGdEBDMATwG0BdAPgAoA3ALkQCVNSCEAbCgIIAnIaQro6ASkQBvRAF8AUMuAMqixJsTqtuxOAKZgMMJgIAaDXs0NpAXjqyFl3TRdad1xAEZ3124gOslZeWhAIRHC8mAB0vHAA5gwA5AASmLzxyZIhevJ+iG6KNDlAA
Variant 2 (I added one return type annotation, I get TS7024 + TS2577):
https://www.typescriptlang.org/play?target=99#code/GYVwdgxgLglg9mABMAPAFUQUwB5U2AEwGdEBDMATwG0BdAPgAoA3ALkQCVNSCEAbCgIIAnIaQro6ASkQBvRAF8AUMuAMqixJsTqtuxOAKZgMMJgIAaDXs0NJbJnBgFEAXjqyFl3TS9ad1xABGX2tbV3cZKwCtCAQiOF5MADpeOABzBgByAAlMXlTMySi9eRDEH0UaIqA
💻 Code
Variant 1
Variant 2
🙁 Actual behavior
The code doesn't compile.
What's strange is from my tests it seems that if I run
tsc filewithcode.ts
it compiles fine but if I runtsc
on the whole project it produces errors.🙂 Expected behavior
I expected the code to compile.
The text was updated successfully, but these errors were encountered: