File: typeAssertionsWithIntersectionTypes01.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 (34 lines) | stat: -rw-r--r-- 1,204 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
tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithIntersectionTypes01.ts(17,9): error TS2352: Type 'I2' cannot be converted to type 'I1 & I3'.
  Type 'I2' is not comparable to type 'I3'.
    Property 'p3' is missing in type 'I2'.
tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithIntersectionTypes01.ts(18,9): error TS2352: Type 'I2' cannot be converted to type 'I3'.


==== tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithIntersectionTypes01.ts (2 errors) ====
    interface I1 {
        p1: number
    }
    
    interface I2 extends I1 {
        p2: number;
    }
    
    interface I3 {
        p3: number;
    }
    
    var x = { p1: 10, p2: 20, p3: 30 };
    var y: I1 & I3 = x;
    var z: I2 = x;
    
    var a = <I1 & I3>z;
            ~~~~~~~~~~
!!! error TS2352: Type 'I2' cannot be converted to type 'I1 & I3'.
!!! error TS2352:   Type 'I2' is not comparable to type 'I3'.
!!! error TS2352:     Property 'p3' is missing in type 'I2'.
    var b = <I3>z;
            ~~~~~
!!! error TS2352: Type 'I2' cannot be converted to type 'I3'.
    var c = <I2>z;
    var d = <I1>y;