Skip to content

Compiler doesn't give appropriate suggestions for static members from instance methods #6491

@DanielRosenwasser

Description

@DanielRosenwasser

With #6469 in, we now give nice suggestions for the following

class C {
    static foo: string;

    static bar() {
        let k = foo;
    }
}

where we will report "Did you mean the static member 'C.foo'?".

A small snag is that it won't give you suggestions for a static member from an instance method.

class C {
    static foo: string;

    bar() {
        let k = foo;
    }
}

You'll just get "Cannot find name 'foo'." We should change this.

Note that the following should have no suggestions:

class C {
    foo: string;

    static bar() {
        let k = foo;
    }
}

Metadata

Metadata

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions