File: typeMatch1.errors.txt

package info (click to toggle)
node-typescript 4.9.5%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 533,908 kB
  • sloc: javascript: 2,018,330; makefile: 7; sh: 1
file content (39 lines) | stat: -rw-r--r-- 1,551 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
tests/cases/compiler/typeMatch1.ts(18,1): error TS2322: Type 'D' is not assignable to type 'C'.
  Types have separate declarations of a private property 'x'.
tests/cases/compiler/typeMatch1.ts(19,4): error TS2741: Property 'x' is missing in type 'typeof C' but required in type 'C'.
tests/cases/compiler/typeMatch1.ts(20,1): error TS2367: This comparison appears to be unintentional because the types 'typeof C' and 'typeof D' have no overlap.


==== tests/cases/compiler/typeMatch1.ts (3 errors) ====
    interface I { z; }
    interface I2 { z; }
    
    var x1: { z: number; f(n: number): string; f(s: string): number; }
    var x2: { z:number;f:{(n:number):string;(s:string):number;}; } = x1;
    var i:I;
    var i2:I2;
    var x3:{ z; }= i;
    var x4:{ z; }= i2;
    var x5:I=i2;
    
    class C { private x; }
    class D { private x; }
    
    var x6=new C();
    var x7=new D();
    
    x6 = x7;
    ~~
!!! error TS2322: Type 'D' is not assignable to type 'C'.
!!! error TS2322:   Types have separate declarations of a private property 'x'.
    x6=C;
       ~
!!! error TS2741: Property 'x' is missing in type 'typeof C' but required in type 'C'.
!!! related TS2728 tests/cases/compiler/typeMatch1.ts:12:19: 'x' is declared here.
!!! related TS6213 tests/cases/compiler/typeMatch1.ts:19:4: Did you mean to use 'new' with this expression?
    C==D;
    ~~~~
!!! error TS2367: This comparison appears to be unintentional because the types 'typeof C' and 'typeof D' have no overlap.
    C==C;