File: inOperatorWithValidOperands.types

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 (108 lines) | stat: -rw-r--r-- 1,608 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
=== tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithValidOperands.ts ===
var x: any;
>x : any

// valid left operands
// the left operand is required to be of type Any, the String primitive type, or the Number primitive type
var a1: string;
>a1 : string

var a2: number;
>a2 : number

var ra1 = x in x;
>ra1 : boolean
>x in x : boolean
>x : any
>x : any

var ra2 = a1 in x;
>ra2 : boolean
>a1 in x : boolean
>a1 : string
>x : any

var ra3 = a2 in x;
>ra3 : boolean
>a2 in x : boolean
>a2 : number
>x : any

var ra4 = '' in x;
>ra4 : boolean
>'' in x : boolean
>'' : ""
>x : any

var ra5 = 0 in x;
>ra5 : boolean
>0 in x : boolean
>0 : 0
>x : any

// valid right operands
// the right operand is required to be of type Any, an object type, or a type parameter type
var b1: {};
>b1 : {}

var rb1 = x in b1;
>rb1 : boolean
>x in b1 : boolean
>x : any
>b1 : {}

var rb2 = x in {};
>rb2 : boolean
>x in {} : boolean
>x : any
>{} : {}

function foo<T>(t: T) {
>foo : <T>(t: T) => void
>T : T
>t : T
>T : T

    var rb3 = x in t;
>rb3 : boolean
>x in t : boolean
>x : any
>t : T
}

interface X { x: number }
>X : X
>x : number

interface Y { y: number }
>Y : Y
>y : number

var c1: X | Y;
>c1 : X | Y
>X : X
>Y : Y

var c2: X;
>c2 : X
>X : X

var c3: Y;
>c3 : Y
>Y : Y

var rc1 = x in c1;
>rc1 : boolean
>x in c1 : boolean
>x : any
>c1 : X | Y

var rc2 = x in (c2 || c3);
>rc2 : boolean
>x in (c2 || c3) : boolean
>x : any
>(c2 || c3) : X | Y
>c2 || c3 : X | Y
>c2 : X
>c3 : Y