Closed
Description
Bug Report
🔎 Search Terms
- 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.
- I do not see the issue with TS 5.0.4.
- This changed between versions 5.0.4 and 5.1.3
⏯ Playground Link
Variant 1 (no return type annotations, 2x TS7024)
Variant 2 (I added one return type annotation, I get TS7024 + TS2577):
💻 Code
Variant 1
function f<T extends any[]>(v: ReadonlyArray<T>) { }
f([
[
undefined,
() => { },
],
[
1,
() => {
console.log('Hello')
},
],
])
Variant 2
function f<T extends any[]>(v: ReadonlyArray<T>) { }
f([
[
undefined,
(): void => { },
],
[
1,
() => {
console.log('Hello')
},
],
])
🙁 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 run tsc
on the whole project it produces errors.
🙂 Expected behavior
I expected the code to compile.