File: equalityWithIntersectionTypes01.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 459,116 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (36 lines) | stat: -rw-r--r-- 1,607 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
tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(17,5): error TS2367: This comparison appears to be unintentional because the types 'I1 & I3' and 'I2' have no overlap.
tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(17,16): error TS2367: This comparison appears to be unintentional because the types 'I2' and 'I1 & I3' have no overlap.
tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(19,10): error TS2367: This comparison appears to be unintentional because the types 'I1 & I3' and 'I2' have no overlap.


==== tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts (3 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 TS2367: This comparison appears to be unintentional because the types 'I1 & I3' and 'I2' have no overlap.
                   ~~~~~~~
!!! error TS2367: This comparison appears to be unintentional because the types 'I2' and 'I1 & I3' have no overlap.
    }
    else if (y !== z || z !== y) {
             ~~~~~~~
!!! error TS2367: This comparison appears to be unintentional because the types 'I1 & I3' and 'I2' have no overlap.
    }
    else if (y == z || z == y) {
    }
    else if (y != z || z != y) {
    }