Skip to content

Error when accessing private property in object destructuring assignment with computed name #26572

Closed
@ajafff

Description

@ajafff

TypeScript Version: 3.1.0-dev.20180818

Search Terms:

Code

class Foo {
    private prop = 1;
}
let prop: any;
({['prop']: prop} = new Foo());

Expected behavior:

No error on destructuring with computed property name.

Actual behavior:

Error on all statically known property names.

Playground Link:

Related Issues:
@Andy-MS this was introduced in #26381 while fixing #26355

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptWon'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