File: privateNamesUnique-3.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 (23 lines) | stat: -rw-r--r-- 1,146 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
tests/cases/conformance/classes/members/privateNames/privateNamesUnique-3.ts(3,12): error TS2804: Duplicate identifier '#foo'. Static and instance elements cannot share the same private name.
tests/cases/conformance/classes/members/privateNames/privateNamesUnique-3.ts(11,11): error TS2339: Property '#foo' does not exist on type 'B'.


==== tests/cases/conformance/classes/members/privateNames/privateNamesUnique-3.ts (2 errors) ====
    class A {
        #foo = 1;
        static #foo = true; // error (duplicate)
               ~~~~
!!! error TS2804: Duplicate identifier '#foo'. Static and instance elements cannot share the same private name.
                            // because static and instance private names
                            // share the same lexical scope
                            // https://tc39.es/proposal-class-fields/#prod-ClassBody
    }
    class B {
        static #foo = true;
        test(x: B) {
            x.#foo; // error (#foo is a static property on B, not an instance property)
              ~~~~
!!! error TS2339: Property '#foo' does not exist on type 'B'.
        }
    }