@@ -32,20 +32,25 @@ const inputALike: ArrayLike<A> = { length: 0 };
32
32
33
33
const inputARand = getEither(inputA, inputALike);
34
34
>inputARand : Symbol(inputARand, Decl(arrayFrom.ts, 14, 5))
35
- >getEither : Symbol(getEither, Decl(arrayFrom.ts, 24 , 70))
35
+ >getEither : Symbol(getEither, Decl(arrayFrom.ts, 27 , 70))
36
36
>inputA : Symbol(inputA, Decl(arrayFrom.ts, 11, 5))
37
37
>inputALike : Symbol(inputALike, Decl(arrayFrom.ts, 13, 5))
38
38
39
+ const inputASet = new Set<A>();
40
+ >inputASet : Symbol(inputASet, Decl(arrayFrom.ts, 15, 5))
41
+ >Set : Symbol(Set, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
42
+ >A : Symbol(A, Decl(arrayFrom.ts, 0, 0))
43
+
39
44
const result1: A[] = Array.from(inputA);
40
- >result1 : Symbol(result1, Decl(arrayFrom.ts, 16 , 5))
45
+ >result1 : Symbol(result1, Decl(arrayFrom.ts, 17 , 5))
41
46
>A : Symbol(A, Decl(arrayFrom.ts, 0, 0))
42
47
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
43
48
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
44
49
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
45
50
>inputA : Symbol(inputA, Decl(arrayFrom.ts, 11, 5))
46
51
47
52
const result2: A[] = Array.from(inputA.values());
48
- >result2 : Symbol(result2, Decl(arrayFrom.ts, 17 , 5))
53
+ >result2 : Symbol(result2, Decl(arrayFrom.ts, 18 , 5))
49
54
>A : Symbol(A, Decl(arrayFrom.ts, 0, 0))
50
55
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
51
56
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
@@ -55,7 +60,7 @@ const result2: A[] = Array.from(inputA.values());
55
60
>values : Symbol(Array.values, Decl(lib.es2015.iterable.d.ts, --, --))
56
61
57
62
const result3: B[] = Array.from(inputA.values()); // expect error
58
- >result3 : Symbol(result3, Decl(arrayFrom.ts, 18 , 5))
63
+ >result3 : Symbol(result3, Decl(arrayFrom.ts, 19 , 5))
59
64
>B : Symbol(B, Decl(arrayFrom.ts, 5, 1))
60
65
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
61
66
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
@@ -65,83 +70,104 @@ const result3: B[] = Array.from(inputA.values()); // expect error
65
70
>values : Symbol(Array.values, Decl(lib.es2015.iterable.d.ts, --, --))
66
71
67
72
const result4: A[] = Array.from(inputB, ({ b }): A => ({ a: b }));
68
- >result4 : Symbol(result4, Decl(arrayFrom.ts, 19 , 5))
73
+ >result4 : Symbol(result4, Decl(arrayFrom.ts, 20 , 5))
69
74
>A : Symbol(A, Decl(arrayFrom.ts, 0, 0))
70
75
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
71
76
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
72
77
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
73
78
>inputB : Symbol(inputB, Decl(arrayFrom.ts, 12, 5))
74
- >b : Symbol(b, Decl(arrayFrom.ts, 19 , 42))
79
+ >b : Symbol(b, Decl(arrayFrom.ts, 20 , 42))
75
80
>A : Symbol(A, Decl(arrayFrom.ts, 0, 0))
76
- >a : Symbol(a, Decl(arrayFrom.ts, 19 , 56))
77
- >b : Symbol(b, Decl(arrayFrom.ts, 19 , 42))
81
+ >a : Symbol(a, Decl(arrayFrom.ts, 20 , 56))
82
+ >b : Symbol(b, Decl(arrayFrom.ts, 20 , 42))
78
83
79
84
const result5: A[] = Array.from(inputALike);
80
- >result5 : Symbol(result5, Decl(arrayFrom.ts, 20 , 5))
85
+ >result5 : Symbol(result5, Decl(arrayFrom.ts, 21 , 5))
81
86
>A : Symbol(A, Decl(arrayFrom.ts, 0, 0))
82
87
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
83
88
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
84
89
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
85
90
>inputALike : Symbol(inputALike, Decl(arrayFrom.ts, 13, 5))
86
91
87
92
const result6: B[] = Array.from(inputALike); // expect error
88
- >result6 : Symbol(result6, Decl(arrayFrom.ts, 21 , 5))
93
+ >result6 : Symbol(result6, Decl(arrayFrom.ts, 22 , 5))
89
94
>B : Symbol(B, Decl(arrayFrom.ts, 5, 1))
90
95
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
91
96
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
92
97
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
93
98
>inputALike : Symbol(inputALike, Decl(arrayFrom.ts, 13, 5))
94
99
95
100
const result7: B[] = Array.from(inputALike, ({ a }): B => ({ b: a }));
96
- >result7 : Symbol(result7, Decl(arrayFrom.ts, 22 , 5))
101
+ >result7 : Symbol(result7, Decl(arrayFrom.ts, 23 , 5))
97
102
>B : Symbol(B, Decl(arrayFrom.ts, 5, 1))
98
103
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
99
104
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
100
105
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
101
106
>inputALike : Symbol(inputALike, Decl(arrayFrom.ts, 13, 5))
102
- >a : Symbol(a, Decl(arrayFrom.ts, 22 , 46))
107
+ >a : Symbol(a, Decl(arrayFrom.ts, 23 , 46))
103
108
>B : Symbol(B, Decl(arrayFrom.ts, 5, 1))
104
- >b : Symbol(b, Decl(arrayFrom.ts, 22 , 60))
105
- >a : Symbol(a, Decl(arrayFrom.ts, 22 , 46))
109
+ >b : Symbol(b, Decl(arrayFrom.ts, 23 , 60))
110
+ >a : Symbol(a, Decl(arrayFrom.ts, 23 , 46))
106
111
107
112
const result8: A[] = Array.from(inputARand);
108
- >result8 : Symbol(result8, Decl(arrayFrom.ts, 23 , 5))
113
+ >result8 : Symbol(result8, Decl(arrayFrom.ts, 24 , 5))
109
114
>A : Symbol(A, Decl(arrayFrom.ts, 0, 0))
110
115
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
111
116
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
112
117
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
113
118
>inputARand : Symbol(inputARand, Decl(arrayFrom.ts, 14, 5))
114
119
115
120
const result9: B[] = Array.from(inputARand, ({ a }): B => ({ b: a }));
116
- >result9 : Symbol(result9, Decl(arrayFrom.ts, 24 , 5))
121
+ >result9 : Symbol(result9, Decl(arrayFrom.ts, 25 , 5))
117
122
>B : Symbol(B, Decl(arrayFrom.ts, 5, 1))
118
123
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
119
124
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
120
125
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
121
126
>inputARand : Symbol(inputARand, Decl(arrayFrom.ts, 14, 5))
122
- >a : Symbol(a, Decl(arrayFrom.ts, 24, 46))
127
+ >a : Symbol(a, Decl(arrayFrom.ts, 25, 46))
128
+ >B : Symbol(B, Decl(arrayFrom.ts, 5, 1))
129
+ >b : Symbol(b, Decl(arrayFrom.ts, 25, 60))
130
+ >a : Symbol(a, Decl(arrayFrom.ts, 25, 46))
131
+
132
+ const result10: A[] = Array.from(new Set<A>());
133
+ >result10 : Symbol(result10, Decl(arrayFrom.ts, 26, 5))
134
+ >A : Symbol(A, Decl(arrayFrom.ts, 0, 0))
135
+ >Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
136
+ >Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
137
+ >from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
138
+ >Set : Symbol(Set, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
139
+ >A : Symbol(A, Decl(arrayFrom.ts, 0, 0))
140
+
141
+ const result11: B[] = Array.from(inputASet, ({ a }): B => ({ b: a }));
142
+ >result11 : Symbol(result11, Decl(arrayFrom.ts, 27, 5))
143
+ >B : Symbol(B, Decl(arrayFrom.ts, 5, 1))
144
+ >Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
145
+ >Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
146
+ >from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
147
+ >inputASet : Symbol(inputASet, Decl(arrayFrom.ts, 15, 5))
148
+ >a : Symbol(a, Decl(arrayFrom.ts, 27, 46))
123
149
>B : Symbol(B, Decl(arrayFrom.ts, 5, 1))
124
- >b : Symbol(b, Decl(arrayFrom.ts, 24 , 60))
125
- >a : Symbol(a, Decl(arrayFrom.ts, 24 , 46))
150
+ >b : Symbol(b, Decl(arrayFrom.ts, 27 , 60))
151
+ >a : Symbol(a, Decl(arrayFrom.ts, 27 , 46))
126
152
127
153
// if this is written inline, the compiler seems to infer
128
154
// the ?: as always taking the false branch, narrowing to ArrayLike<T>,
129
155
// even when the type is written as : Iterable<T>|ArrayLike<T>
130
156
function getEither<T> (in1: Iterable<T>, in2: ArrayLike<T>) {
131
- >getEither : Symbol(getEither, Decl(arrayFrom.ts, 24 , 70))
132
- >T : Symbol(T, Decl(arrayFrom.ts, 29 , 19))
133
- >in1 : Symbol(in1, Decl(arrayFrom.ts, 29 , 23))
157
+ >getEither : Symbol(getEither, Decl(arrayFrom.ts, 27 , 70))
158
+ >T : Symbol(T, Decl(arrayFrom.ts, 32 , 19))
159
+ >in1 : Symbol(in1, Decl(arrayFrom.ts, 32 , 23))
134
160
>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --))
135
- >T : Symbol(T, Decl(arrayFrom.ts, 29 , 19))
136
- >in2 : Symbol(in2, Decl(arrayFrom.ts, 29 , 40))
161
+ >T : Symbol(T, Decl(arrayFrom.ts, 32 , 19))
162
+ >in2 : Symbol(in2, Decl(arrayFrom.ts, 32 , 40))
137
163
>ArrayLike : Symbol(ArrayLike, Decl(lib.es5.d.ts, --, --))
138
- >T : Symbol(T, Decl(arrayFrom.ts, 29 , 19))
164
+ >T : Symbol(T, Decl(arrayFrom.ts, 32 , 19))
139
165
140
166
return Math.random() > 0.5 ? in1 : in2;
141
167
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
142
168
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
143
169
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
144
- >in1 : Symbol(in1, Decl(arrayFrom.ts, 29 , 23))
145
- >in2 : Symbol(in2, Decl(arrayFrom.ts, 29 , 40))
170
+ >in1 : Symbol(in1, Decl(arrayFrom.ts, 32 , 23))
171
+ >in2 : Symbol(in2, Decl(arrayFrom.ts, 32 , 40))
146
172
}
147
173
0 commit comments