-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
Fix AvailableA PR has been opened for this issueA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.RescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
Milestone
Description
Bug Report
🔎 Search Terms
circular method this async implicitly has type any because it does not have a type annotation and is referenced directly or indirectly in its own initializer
🕗 Version & Regression Information
- This changed between versions 4.4.4 and 4.5.4 and is not fixed in Nightly
⏯ Playground Link
Playground link with relevant code
💻 Code
class X {
// This is ok in 4.4.4, but has 'any' type due to a circular reference in 4.5.4
bad = async (): Promise<this> => this;
// These all work in both versions (just to narrow down the breadth of the problem)
ok1 = (): this => this;
ok2 = (): this[] => [this];
ok3 = (): Promise<this> => Promise.resolve(this);
ok4 = (): Promise<this> => (async () => this)();
}🙁 Actual behavior
The async bad method triggers the error 'bad' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. Although the playground does display () => Promise<this> as the type on hover.
🙂 Expected behavior
There should be no error in the example. There was not in 4.4.4 and the method is not fundamentally different from some of the ok examples (especially ok3 and ok4.)
Drarig29whzx5byb, ryamakuchi and tonivj5
Metadata
Metadata
Assignees
Labels
Fix AvailableA PR has been opened for this issueA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.RescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone