1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
=== tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts ===
class K {
>K : K
private priv;
>priv : any
protected prot;
>prot : any
private privateMethod() { }
>privateMethod : () => void
m() {
>m : () => void
let { priv: a, prot: b } = this; // ok
>priv : any
>a : any
>prot : any
>b : any
>this : this
let { priv, prot } = new K(); // ok
>priv : any
>prot : any
>new K() : K
>K : typeof K
}
}
class C extends K {
>C : C
>K : K
m2() {
>m2 : () => void
let { priv: a } = this; // error
>priv : any
>a : any
>this : this
let { prot: b } = this; // ok
>prot : any
>b : any
>this : this
}
}
let k = new K();
>k : K
>new K() : K
>K : typeof K
let { priv } = k; // error
>priv : any
>k : K
let { prot } = k; // error
>prot : any
>k : K
let { privateMethod } = k; // error
>privateMethod : () => void
>k : K
let { priv: a, prot: b, privateMethod: pm } = k; // error
>priv : any
>a : any
>prot : any
>b : any
>privateMethod : any
>pm : () => void
>k : K
function f({ priv, prot, privateMethod }: K) {
>f : ({ priv, prot, privateMethod }: K) => void
>priv : any
>prot : any
>privateMethod : () => void
}
|