Closed
Description
TypeScript Version: 3.1.0-dev.20180808
Search Terms: private string access
Code
class Foo {
private bar = 1;
}
let foo = new Foo();
foo.bar; // error as expected
foo['bar']; // no error as expected
let {bar} = foo; // error as expected
let {'bar': bar2} = foo; // error (expected?)
let {['bar']: bar3} = foo; // error (expected?)
Expected behavior:
#26328 states that accessing non-public properties via element access with string literal or late-bound name is intentionally allowed.
To be consistent that should also apply to destructuring with computed property name or quoted name.
Actual behavior:
Errors as described by the inline comments.