File: interfaceDeclaration4.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 (71 lines) | stat: -rw-r--r-- 2,800 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
tests/cases/compiler/interfaceDeclaration4.ts(18,11): error TS2430: Interface 'I3' incorrectly extends interface 'I1'.
  Types of property 'item' are incompatible.
    Type 'number' is not assignable to type 'string'.
tests/cases/compiler/interfaceDeclaration4.ts(27,7): error TS2420: Class 'C2' incorrectly implements interface 'I4'.
  Property 'item' is missing in type 'C2' but required in type 'I4'.
tests/cases/compiler/interfaceDeclaration4.ts(36,7): error TS2420: Class 'C3' incorrectly implements interface 'I1'.
  Property 'item' is missing in type 'C3' but required in type 'I1'.
tests/cases/compiler/interfaceDeclaration4.ts(39,14): error TS1005: '{' expected.
tests/cases/compiler/interfaceDeclaration4.ts(39,15): error TS1434: Unexpected keyword or identifier.
tests/cases/compiler/interfaceDeclaration4.ts(39,15): error TS2304: Cannot find name 'I1'.


==== tests/cases/compiler/interfaceDeclaration4.ts (6 errors) ====
    // Import this module when test harness supports external modules. Also remove the internal module below.
    // import Foo = require("interfaceDeclaration5")
    module Foo {
        export interface I1 { item: string; }
        export class C1 { }
    }
    
    class C1 implements Foo.I1 {
    	public item:string;
    }
    
    // Allowed
    interface I2 extends Foo.I1 {
    	item:string;
    }
    
    // Negative Case
    interface I3 extends Foo.I1 {
              ~~
!!! error TS2430: Interface 'I3' incorrectly extends interface 'I1'.
!!! error TS2430:   Types of property 'item' are incompatible.
!!! error TS2430:     Type 'number' is not assignable to type 'string'.
        item:number;
    }
    
    interface I4 extends Foo.I1 {
        token:string;
    }
    
    // Err - not implemented item
    class C2 implements I4 {
          ~~
!!! error TS2420: Class 'C2' incorrectly implements interface 'I4'.
!!! error TS2420:   Property 'item' is missing in type 'C2' but required in type 'I4'.
!!! related TS2728 tests/cases/compiler/interfaceDeclaration4.ts:4:27: 'item' is declared here.
        public token: string;
    }
    
    interface I5 extends Foo { }
    
    // Negative case
    interface I6 extends Foo.C1 { }
    
    class C3 implements Foo.I1 { }
          ~~
!!! error TS2420: Class 'C3' incorrectly implements interface 'I1'.
!!! error TS2420:   Property 'item' is missing in type 'C3' but required in type 'I1'.
!!! related TS2728 tests/cases/compiler/interfaceDeclaration4.ts:4:27: 'item' is declared here.
    
    // Negative case 
    interface Foo.I1 { }
                 ~
!!! error TS1005: '{' expected.
                  ~~
!!! error TS1434: Unexpected keyword or identifier.
                  ~~
!!! error TS2304: Cannot find name 'I1'.