File: classImplementsClass4.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 (29 lines) | stat: -rw-r--r-- 1,210 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
tests/cases/compiler/classImplementsClass4.ts(5,7): error TS2720: Class 'C' incorrectly implements class 'A'. Did you mean to extend 'A' and inherit its members as a subclass?
  Property 'x' is missing in type 'C' but required in type 'A'.
tests/cases/compiler/classImplementsClass4.ts(16,1): error TS2741: Property 'x' is missing in type 'C' but required in type 'A'.


==== tests/cases/compiler/classImplementsClass4.ts (2 errors) ====
    class A {
        private x = 1;
        foo(): number { return 1; }
    }
    class C implements A {
          ~
!!! error TS2720: Class 'C' incorrectly implements class 'A'. Did you mean to extend 'A' and inherit its members as a subclass?
!!! error TS2720:   Property 'x' is missing in type 'C' but required in type 'A'.
!!! related TS2728 tests/cases/compiler/classImplementsClass4.ts:2:13: 'x' is declared here.
        foo() {
            return 1;
        }
    }
    
    class C2 extends A {}
    
    var c: C;
    var c2: C2;
    c = c2;
    c2 = c;
    ~~
!!! error TS2741: Property 'x' is missing in type 'C' but required in type 'A'.
!!! related TS2728 tests/cases/compiler/classImplementsClass4.ts:2:13: 'x' is declared here.