Skip to content

Wrong error message for this in function #26447

Closed

Description

TypeScript Version: 3.1.0-dev.20180810

Code

function f() {
    this.x;
}

Expected behavior:

Error that this is implicitly any.

Actual behavior:

src/a.ts:2:5 - error TS7041: The containing arrow function captures the global value of 'this' which implicitly has type 'any'.

...what arrow function?
(Ref: #25978)

Activity

  1. ghost added
    Bug
    on Aug 14, 2018
  2. ghost added
    Domain: Error Messages
    on Aug 14, 2018
  3. added
    Fixed
    on Aug 15, 2018
  4. nermin99 commented on Aug 5, 2020

    @nermin99

    How do you disable this rule?

  5. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDomain: Error MessagesFixed

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions