Skip to content

Lazy getter for static property produce error #33493

@sirian

Description

@sirian

TypeScript Version: 3.6.3

Code

class A {
    static get callbacks(): any[] {
        delete this.callbacks;
        return this.callbacks = []
    }
}

Expected behavior:
No error should be shown
image

Actual behavior:
error TS2704: The operand of a delete operator cannot be a read-only property.

Playground Link: playground

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions