Skip to content

this is any type in class property assignment to function #17026

Open

Description

@mjbvz

From microsoft/vscode#30003

TypeScript Version: 2.4.1

Code

 class AppComponent {
    items = [ 'Angular 4', 'React', 'Underscore'];

    foo = function () {
        return this.items
    }
}

Expected behavior:
The type of this in foo should be AppComponent

Actual behavior:
The type of this in foo is any

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureDomain: JavaScriptThe issue relates to JavaScript specificallySuggestionAn idea for TypeScriptVS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions