|
| 1 | +tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(12,13): error TS2341: Property 'priv' is private and only accessible within class 'K'. |
| 2 | +tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(17,5): error TS2341: Property 'priv' is private and only accessible within class 'K'. |
| 3 | +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. |
| 4 | +tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(19,5): error TS2341: Property 'privateMethod' is private and only accessible within class 'K'. |
| 5 | +tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(20,5): error TS2341: Property 'priv' is private and only accessible within class 'K'. |
| 6 | +tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(20,5): error TS2341: Property 'privateMethod' is private and only accessible within class 'K'. |
| 7 | +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. |
| 8 | + |
| 9 | + |
| 10 | +==== tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts (7 errors) ==== |
| 11 | + class K { |
| 12 | + private priv; |
| 13 | + protected prot; |
| 14 | + private privateMethod() { } |
| 15 | + m() { |
| 16 | + let { priv: a, prot: b } = this; // ok |
| 17 | + let { priv, prot } = new K(); // ok |
| 18 | + } |
| 19 | + } |
| 20 | + class C extends K { |
| 21 | + m2() { |
| 22 | + let { priv: a } = this; // error |
| 23 | + ~~~~~~~~~~~ |
| 24 | +!!! error TS2341: Property 'priv' is private and only accessible within class 'K'. |
| 25 | + let { prot: b } = this; // ok |
| 26 | + } |
| 27 | + } |
| 28 | + let k = new K(); |
| 29 | + let { priv } = k; // error |
| 30 | + ~~~~~~~~ |
| 31 | +!!! error TS2341: Property 'priv' is private and only accessible within class 'K'. |
| 32 | + let { prot } = k; // error |
| 33 | + ~~~~~~~~ |
| 34 | +!!! error TS2445: Property 'prot' is protected and only accessible within class 'K' and its subclasses. |
| 35 | + let { privateMethod } = k; // error |
| 36 | + ~~~~~~~~~~~~~~~~~ |
| 37 | +!!! error TS2341: Property 'privateMethod' is private and only accessible within class 'K'. |
| 38 | + let { priv: a, prot: b, privateMethod: f } = k; // error |
| 39 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 40 | +!!! error TS2341: Property 'priv' is private and only accessible within class 'K'. |
| 41 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 42 | +!!! error TS2341: Property 'privateMethod' is private and only accessible within class 'K'. |
| 43 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 44 | +!!! error TS2445: Property 'prot' is protected and only accessible within class 'K' and its subclasses. |
| 45 | + |
0 commit comments