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
|
tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(12,13): error TS2341: Property 'priv' is private and only accessible within class 'K'.
tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(17,5): error TS2341: Property 'priv' is private and only accessible within class 'K'.
tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(18,5): error TS2445: Property 'prot' is protected and only accessible within class 'K' and its subclasses.
tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(19,5): error TS2341: Property 'privateMethod' is private and only accessible within class 'K'.
tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(20,5): error TS2341: Property 'priv' is private and only accessible within class 'K'.
tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(20,5): error TS2341: Property 'privateMethod' is private and only accessible within class 'K'.
tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(20,5): error TS2445: Property 'prot' is protected and only accessible within class 'K' and its subclasses.
==== tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts (7 errors) ====
class K {
private priv;
protected prot;
private privateMethod() { }
m() {
let { priv: a, prot: b } = this; // ok
let { priv, prot } = new K(); // ok
}
}
class C extends K {
m2() {
let { priv: a } = this; // error
~~~~~~~~~~~
!!! error TS2341: Property 'priv' is private and only accessible within class 'K'.
let { prot: b } = this; // ok
}
}
let k = new K();
let { priv } = k; // error
~~~~~~~~
!!! error TS2341: Property 'priv' is private and only accessible within class 'K'.
let { prot } = k; // error
~~~~~~~~
!!! error TS2445: Property 'prot' is protected and only accessible within class 'K' and its subclasses.
let { privateMethod } = k; // error
~~~~~~~~~~~~~~~~~
!!! error TS2341: Property 'privateMethod' is private and only accessible within class 'K'.
let { priv: a, prot: b, privateMethod: f } = k; // error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2341: Property 'priv' is private and only accessible within class 'K'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2341: Property 'privateMethod' is private and only accessible within class 'K'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2445: Property 'prot' is protected and only accessible within class 'K' and its subclasses.
|