Skip to content

No error accessing private property with indexed access #26328

Closed
@ghost

Description

TypeScript Version: 3.1.0-dev.20180809

Code

class A { private n!: number; }
const a = new A();
const nameN = "n";
const n = a[nameN];

Expected behavior:

Error at a[nameN] just like for a.n.

Actual behavior:

No error.

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