File: privateNamesAndMethods.errors.txt

package info (click to toggle)
node-typescript 4.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 396,552 kB
  • sloc: javascript: 1,444,377; makefile: 7; sh: 3
file content (51 lines) | stat: -rw-r--r-- 2,257 bytes parent folder | download
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
tests/cases/conformance/classes/members/privateNames/privateNamesAndMethods.ts(2,5): error TS18022: A method cannot be named with a private identifier.
tests/cases/conformance/classes/members/privateNames/privateNamesAndMethods.ts(3,11): error TS18022: A method cannot be named with a private identifier.
tests/cases/conformance/classes/members/privateNames/privateNamesAndMethods.ts(4,12): error TS18022: A method cannot be named with a private identifier.
tests/cases/conformance/classes/members/privateNames/privateNamesAndMethods.ts(8,9): error TS18023: An accessor cannot be named with a private identifier.
tests/cases/conformance/classes/members/privateNames/privateNamesAndMethods.ts(11,9): error TS18023: An accessor cannot be named with a private identifier.
tests/cases/conformance/classes/members/privateNames/privateNamesAndMethods.ts(24,5): error TS18022: A method cannot be named with a private identifier.


==== tests/cases/conformance/classes/members/privateNames/privateNamesAndMethods.ts (6 errors) ====
    class A {
        #foo(a: number) {}
        ~~~~
!!! error TS18022: A method cannot be named with a private identifier.
        async #bar(a: number) {}
              ~~~~
!!! error TS18022: A method cannot be named with a private identifier.
        async *#baz(a: number) {
               ~~~~
!!! error TS18022: A method cannot be named with a private identifier.
            return 3;
        }
        #_quux: number;
        get #quux (): number {
            ~~~~~
!!! error TS18023: An accessor cannot be named with a private identifier.
            return this.#_quux;
        }
        set #quux (val: number) {
            ~~~~~
!!! error TS18023: An accessor cannot be named with a private identifier.
            this.#_quux = val; 
        }
        constructor () {
            this.#foo(30);
            this.#bar(30);
            this.#baz(30);
            this.#quux = this.#quux + 1;
            this.#quux++;
     }
    }
    
    class B extends A {
        #foo(a: string) {}
        ~~~~
!!! error TS18022: A method cannot be named with a private identifier.
        constructor () {
            super();
            this.#foo("str");
        }
    }