Skip to content

Unused Error is misleading with side-effecting static properties #17624

Closed
@aozgaa

Description

@aozgaa

The following fragment, which uses the static initialization of s, marks D unused today:

function sideAffecting(): number {
    console.log("called");
    return 10;
}

function foo() {
    class D {
        static s: number = sideAffecting();
    }
}
foo();

Initially mentioned in #16078 but this is a separate issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Won't FixThe severity and priority of this issue do not warrant the time or complexity needed to fix it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions