File: equalityWithIntersectionTypes01.errors.txt

package info (click to toggle)
node-typescript 2.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 203,952 kB
  • ctags: 52,987
  • sloc: sh: 11; makefile: 5
file content (51 lines) | stat: -rw-r--r-- 2,820 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
tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(17,5): error TS2365: Operator '===' cannot be applied to types 'I1 & I3' and 'I2'.
tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(17,16): error TS2365: Operator '===' cannot be applied to types 'I2' and 'I1 & I3'.
tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(19,10): error TS2365: Operator '!==' cannot be applied to types 'I1 & I3' and 'I2'.
tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(19,21): error TS2365: Operator '!==' cannot be applied to types 'I2' and 'I1 & I3'.
tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(21,10): error TS2365: Operator '==' cannot be applied to types 'I1 & I3' and 'I2'.
tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(21,20): error TS2365: Operator '==' cannot be applied to types 'I2' and 'I1 & I3'.
tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(23,10): error TS2365: Operator '!=' cannot be applied to types 'I1 & I3' and 'I2'.
tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(23,20): error TS2365: Operator '!=' cannot be applied to types 'I2' and 'I1 & I3'.


==== tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts (8 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;
    
    if (y === z || z === y) {
        ~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types 'I1 & I3' and 'I2'.
                   ~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types 'I2' and 'I1 & I3'.
    }
    else if (y !== z || z !== y) {
             ~~~~~~~
!!! error TS2365: Operator '!==' cannot be applied to types 'I1 & I3' and 'I2'.
                        ~~~~~~~
!!! error TS2365: Operator '!==' cannot be applied to types 'I2' and 'I1 & I3'.
    }
    else if (y == z || z == y) {
             ~~~~~~
!!! error TS2365: Operator '==' cannot be applied to types 'I1 & I3' and 'I2'.
                       ~~~~~~
!!! error TS2365: Operator '==' cannot be applied to types 'I2' and 'I1 & I3'.
    }
    else if (y != z || z != y) {
             ~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types 'I1 & I3' and 'I2'.
                       ~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types 'I2' and 'I1 & I3'.
    }