Skip to content

typeof this => this throw "Cannot find name 'this'.(2304)" for no reasonΒ #54167

Closed
@Malix-Labs

Description

@Malix-Labs

Bug Report

πŸ”Ž Search Terms

this, typeof this, Cannot find name 'this', 2304

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

export class A {
	x = 1
	a(x: typeof this.x): void {}
//        ^         ^^^^ Cannot find name 'this'.(2304)
//        L_____________ `x` has proper type inference nevertheless

}

const a = new A().a(1)

πŸ™ Actual behavior

Throw a wrong error

πŸ™‚ Expected behavior

To not throw this error

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions