File: interfaceImplementation7.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 (27 lines) | stat: -rw-r--r-- 1,436 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
tests/cases/compiler/interfaceImplementation7.ts(4,11): error TS2320: Interface 'i3' cannot simultaneously extend types 'i1' and 'i2'.
  Named property 'name' of types 'i1' and 'i2' are not identical.
tests/cases/compiler/interfaceImplementation7.ts(7,7): error TS2420: Class 'C1' incorrectly implements interface 'i4'.
  Types of property 'name' are incompatible.
    Type '() => string' is not assignable to type '() => { s: string; n: number; }'.
      Type 'string' is not assignable to type '{ s: string; n: number; }'.


==== tests/cases/compiler/interfaceImplementation7.ts (2 errors) ====
    interface i1{ name(): { s: string; }; }
    interface i2{ name(): { n: number; }; }
    
    interface i3 extends i1, i2 { }
              ~~
!!! error TS2320: Interface 'i3' cannot simultaneously extend types 'i1' and 'i2'.
!!! error TS2320:   Named property 'name' of types 'i1' and 'i2' are not identical.
    interface i4 extends i1, i2 { name(): { s: string; n: number; }; }
    
    class C1 implements i4 {
          ~~
!!! error TS2420: Class 'C1' incorrectly implements interface 'i4'.
!!! error TS2420:   Types of property 'name' are incompatible.
!!! error TS2420:     Type '() => string' is not assignable to type '() => { s: string; n: number; }'.
!!! error TS2420:       Type 'string' is not assignable to type '{ s: string; n: number; }'.
        public name(): string { return ""; }
    }