File: privateProtectedMembersAreNotAccessibleDestructuring.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (57 lines) | stat: -rw-r--r-- 4,035 bytes parent folder | download | duplicates (3)
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
tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(12,15): error TS2341: Property 'priv' is private and only accessible within class 'K'.
tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(17,7): error TS2341: Property 'priv' is private and only accessible within class 'K'.
tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(18,7): error TS2445: Property 'prot' is protected and only accessible within class 'K' and its subclasses.
tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(19,7): error TS2341: Property 'privateMethod' is private and only accessible within class 'K'.
tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(20,7): error TS2341: Property 'priv' is private and only accessible within class 'K'.
tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(20,16): error TS2445: Property 'prot' is protected and only accessible within class 'K' and its subclasses.
tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(20,25): error TS2341: Property 'privateMethod' is private and only accessible within class 'K'.
tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(21,14): error TS2341: Property 'priv' is private and only accessible within class 'K'.
tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(21,20): error TS2445: Property 'prot' is protected and only accessible within class 'K' and its subclasses.
tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts(21,26): error TS2341: Property 'privateMethod' is private and only accessible within class 'K'.


==== tests/cases/conformance/classes/members/accessibility/privateProtectedMembersAreNotAccessibleDestructuring.ts (10 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: pm } = k; // error
          ~~~~
!!! error TS2341: Property 'priv' is private and only accessible within class 'K'.
                   ~~~~
!!! error TS2445: Property 'prot' is protected and only accessible within class 'K' and its subclasses.
                            ~~~~~~~~~~~~~
!!! error TS2341: Property 'privateMethod' is private and only accessible within class 'K'.
    function f({ priv, prot, privateMethod }: K) {
                 ~~~~
!!! error TS2341: Property 'priv' is private and only accessible within class 'K'.
                       ~~~~
!!! error TS2445: Property 'prot' is protected and only accessible within class 'K' and its subclasses.
                             ~~~~~~~~~~~~~
!!! error TS2341: Property 'privateMethod' is private and only accessible within class 'K'.
    
    }