Skip to content

[scope analysis] true support for static class blocks #4120

Closed
@bradzacher

Description

@bradzacher

When we added syntax support for this with the TS4.4 support, we did not add proper support for scope analysis of this.

Currently scope analysis will "work" because the analyser will just traverse the block body - but it will create an incorrect scope tree because a new scope will not be created for the block scope created by the static block.

Repro

declare function someCondition(): boolean;

class Foo {
    static count = 0;

    static {
        if (someCondition()) {
            Foo.count++;
        }
    }
}

Reference implementation: eslint/eslint-scope#80

Metadata

Metadata

Assignees

Labels

accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinggood first issueGood for newcomerspackage: scope-managerIssues related to @typescript-eslint/scope-manager

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions