File: chainedAssignmentChecking.types

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 (58 lines) | stat: -rw-r--r-- 645 bytes parent folder | download | duplicates (5)
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
52
53
54
55
56
57
58
=== tests/cases/compiler/chainedAssignmentChecking.ts ===
class X {
>X : X

  constructor(public z) { }
>z : any

  a: number;
>a : number
}

class Y {
>Y : Y

  constructor(public z) { }
>z : any

  a: number;
>a : number

  b: string;
>b : string
}

class Z {
>Z : Z

  z: any;
>z : any

  c: string;
>c : string
}

var c1 = new X(3);
>c1 : X
>new X(3) : X
>X : typeof X
>3 : 3

var c2 = new Y(5);
>c2 : Y
>new Y(5) : Y
>Y : typeof Y
>5 : 5

var c3 = new Z();
>c3 : Z
>new Z() : Z
>Z : typeof Z

c1 = c2 = c3; // Should be error
>c1 = c2 = c3 : Z
>c1 : X
>c2 = c3 : Z
>c2 : Y
>c3 : Z