File: interfaceDeclaration3.errors.txt

package info (click to toggle)
node-typescript 2.1.5-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 203,960 kB
  • sloc: sh: 11; makefile: 5
file content (79 lines) | stat: -rw-r--r-- 2,715 bytes parent folder | download | duplicates (2)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
tests/cases/compiler/interfaceDeclaration3.ts(6,11): error TS2420: Class 'C1' incorrectly implements interface 'I1'.
  Types of property 'item' are incompatible.
    Type 'number' is not assignable to type 'string'.
tests/cases/compiler/interfaceDeclaration3.ts(31,11): error TS2420: Class 'C1' incorrectly implements interface 'I1'.
  Types of property 'item' are incompatible.
    Type 'number' is not assignable to type 'string'.
tests/cases/compiler/interfaceDeclaration3.ts(54,11): error TS2430: Interface 'I2' incorrectly extends interface 'I1'.
  Types of property 'item' are incompatible.
    Type 'string' is not assignable to type 'number'.


==== tests/cases/compiler/interfaceDeclaration3.ts (3 errors) ====
    interface I1 { item:number; }
    
    module M1 {
        interface I1 { item:string; }  
        interface I2 { item:number; }   
        class C1 implements I1 {
              ~~
!!! error TS2420: Class 'C1' incorrectly implements interface 'I1'.
!!! error TS2420:   Types of property 'item' are incompatible.
!!! error TS2420:     Type 'number' is not assignable to type 'string'.
            public item:number;
        }
        class C2 implements I1 {
            public item:string;
        }
        class C3 implements I2 {
            public item:number;
        }
        
        class C4 implements M2.I1 { 
            public item:string;
        }
    
        class C5 implements M2.M3.I1 {
            public item:string;
        }
    }
    
    export module M2 {
        export interface I1 { item:string; }
        export interface I2 { item:string; }
        export module M3 {
            export interface I1 { item:string; }
        }
        class C1 implements I1 {
              ~~
!!! error TS2420: Class 'C1' incorrectly implements interface 'I1'.
!!! error TS2420:   Types of property 'item' are incompatible.
!!! error TS2420:     Type 'number' is not assignable to type 'string'.
            public item:number;    
        }
        class C2 implements I1 {
            public item:string;    
        }
        class C3 implements I2 {
            public item:string;    
        }
    }
    
    class C1 implements I1 {
        public item:number;
    }
    
    class C2 implements M2.I1 { 
        public item:string;
    }
    
    class C3 implements M2.M3.I1 {
        public item:string;
    }
    
    interface I2 extends I1 { item:string; }
              ~~
!!! error TS2430: Interface 'I2' incorrectly extends interface 'I1'.
!!! error TS2430:   Types of property 'item' are incompatible.
!!! error TS2430:     Type 'string' is not assignable to type 'number'.