-
Notifications
You must be signed in to change notification settings - Fork 12.3k
/
arrayFromAsync.symbols
187 lines (158 loc) · 14.8 KB
/
arrayFromAsync.symbols
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
//// [tests/cases/compiler/arrayFromAsync.ts] ////
=== arrayFromAsync.ts ===
export { };
async function * asyncGen (n) {
>asyncGen : Symbol(asyncGen, Decl(arrayFromAsync.ts, 0, 11))
>n : Symbol(n, Decl(arrayFromAsync.ts, 1, 27))
for (let i = 0; i < n; i++)
>i : Symbol(i, Decl(arrayFromAsync.ts, 2, 12))
>i : Symbol(i, Decl(arrayFromAsync.ts, 2, 12))
>n : Symbol(n, Decl(arrayFromAsync.ts, 1, 27))
>i : Symbol(i, Decl(arrayFromAsync.ts, 2, 12))
yield i * 2;
>i : Symbol(i, Decl(arrayFromAsync.ts, 2, 12))
}
function * genPromises (n) {
>genPromises : Symbol(genPromises, Decl(arrayFromAsync.ts, 4, 3))
>n : Symbol(n, Decl(arrayFromAsync.ts, 6, 24))
for (let i = 0; i < n; i++) {
>i : Symbol(i, Decl(arrayFromAsync.ts, 7, 12))
>i : Symbol(i, Decl(arrayFromAsync.ts, 7, 12))
>n : Symbol(n, Decl(arrayFromAsync.ts, 6, 24))
>i : Symbol(i, Decl(arrayFromAsync.ts, 7, 12))
yield Promise.resolve(i * 2);
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>i : Symbol(i, Decl(arrayFromAsync.ts, 7, 12))
}
}
const arrLike = {
>arrLike : Symbol(arrLike, Decl(arrayFromAsync.ts, 12, 5))
0: Promise.resolve(0),
>0 : Symbol(0, Decl(arrayFromAsync.ts, 12, 17))
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
1: Promise.resolve(2),
>1 : Symbol(1, Decl(arrayFromAsync.ts, 13, 26))
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
2: Promise.resolve(4),
>2 : Symbol(2, Decl(arrayFromAsync.ts, 14, 26))
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
3: Promise.resolve(6),
>3 : Symbol(3, Decl(arrayFromAsync.ts, 15, 26))
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
length: 4,
>length : Symbol(length, Decl(arrayFromAsync.ts, 16, 26))
}
const arr : number[] = [];
>arr : Symbol(arr, Decl(arrayFromAsync.ts, 20, 5))
for await (const v of asyncGen(4)) {
>v : Symbol(v, Decl(arrayFromAsync.ts, 21, 16))
>asyncGen : Symbol(asyncGen, Decl(arrayFromAsync.ts, 0, 11))
arr.push(v);
>arr.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>arr : Symbol(arr, Decl(arrayFromAsync.ts, 20, 5))
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>v : Symbol(v, Decl(arrayFromAsync.ts, 21, 16))
}
const sameArr1 = await Array.fromAsync(arrLike);
>sameArr1 : Symbol(sameArr1, Decl(arrayFromAsync.ts, 25, 5))
>Array.fromAsync : Symbol(ArrayConstructor.fromAsync, Decl(lib.esnext.array.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --))
>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, --, --) ... and 5 more)
>fromAsync : Symbol(ArrayConstructor.fromAsync, Decl(lib.esnext.array.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --))
>arrLike : Symbol(arrLike, Decl(arrayFromAsync.ts, 12, 5))
const sameArr2 = await Array.fromAsync([Promise.resolve(0), Promise.resolve(2), Promise.resolve(4), Promise.resolve(6)]);
>sameArr2 : Symbol(sameArr2, Decl(arrayFromAsync.ts, 26, 5))
>Array.fromAsync : Symbol(ArrayConstructor.fromAsync, Decl(lib.esnext.array.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --))
>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, --, --) ... and 5 more)
>fromAsync : Symbol(ArrayConstructor.fromAsync, Decl(lib.esnext.array.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --))
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
const sameArr3 = await Array.fromAsync(genPromises(4));
>sameArr3 : Symbol(sameArr3, Decl(arrayFromAsync.ts, 27, 5))
>Array.fromAsync : Symbol(ArrayConstructor.fromAsync, Decl(lib.esnext.array.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --))
>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, --, --) ... and 5 more)
>fromAsync : Symbol(ArrayConstructor.fromAsync, Decl(lib.esnext.array.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --))
>genPromises : Symbol(genPromises, Decl(arrayFromAsync.ts, 4, 3))
const sameArr4 = await Array.fromAsync(asyncGen(4));
>sameArr4 : Symbol(sameArr4, Decl(arrayFromAsync.ts, 28, 5))
>Array.fromAsync : Symbol(ArrayConstructor.fromAsync, Decl(lib.esnext.array.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --))
>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, --, --) ... and 5 more)
>fromAsync : Symbol(ArrayConstructor.fromAsync, Decl(lib.esnext.array.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --))
>asyncGen : Symbol(asyncGen, Decl(arrayFromAsync.ts, 0, 11))
function Data (n) {}
>Data : Symbol(Data, Decl(arrayFromAsync.ts, 28, 52), Decl(arrayFromAsync.ts, 30, 20))
>n : Symbol(n, Decl(arrayFromAsync.ts, 30, 15))
Data.fromAsync = Array.fromAsync;
>Data.fromAsync : Symbol(Data.fromAsync, Decl(arrayFromAsync.ts, 30, 20))
>Data : Symbol(Data, Decl(arrayFromAsync.ts, 28, 52), Decl(arrayFromAsync.ts, 30, 20))
>fromAsync : Symbol(Data.fromAsync, Decl(arrayFromAsync.ts, 30, 20))
>Array.fromAsync : Symbol(ArrayConstructor.fromAsync, Decl(lib.esnext.array.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --))
>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, --, --) ... and 5 more)
>fromAsync : Symbol(ArrayConstructor.fromAsync, Decl(lib.esnext.array.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --))
const sameArr5 = await Data.fromAsync(asyncGen(4));
>sameArr5 : Symbol(sameArr5, Decl(arrayFromAsync.ts, 32, 5))
>Data.fromAsync : Symbol(Data.fromAsync, Decl(arrayFromAsync.ts, 30, 20))
>Data : Symbol(Data, Decl(arrayFromAsync.ts, 28, 52), Decl(arrayFromAsync.ts, 30, 20))
>fromAsync : Symbol(Data.fromAsync, Decl(arrayFromAsync.ts, 30, 20))
>asyncGen : Symbol(asyncGen, Decl(arrayFromAsync.ts, 0, 11))
const mapArr1 = await Array.fromAsync(asyncGen(4), v => v ** 2);
>mapArr1 : Symbol(mapArr1, Decl(arrayFromAsync.ts, 34, 5))
>Array.fromAsync : Symbol(ArrayConstructor.fromAsync, Decl(lib.esnext.array.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --))
>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, --, --) ... and 5 more)
>fromAsync : Symbol(ArrayConstructor.fromAsync, Decl(lib.esnext.array.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --))
>asyncGen : Symbol(asyncGen, Decl(arrayFromAsync.ts, 0, 11))
>v : Symbol(v, Decl(arrayFromAsync.ts, 34, 50))
>v : Symbol(v, Decl(arrayFromAsync.ts, 34, 50))
const mapArr2 = await Array.fromAsync([0,2,4,6], v => Promise.resolve(v ** 2));
>mapArr2 : Symbol(mapArr2, Decl(arrayFromAsync.ts, 35, 5))
>Array.fromAsync : Symbol(ArrayConstructor.fromAsync, Decl(lib.esnext.array.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --))
>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, --, --) ... and 5 more)
>fromAsync : Symbol(ArrayConstructor.fromAsync, Decl(lib.esnext.array.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --))
>v : Symbol(v, Decl(arrayFromAsync.ts, 35, 48))
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>v : Symbol(v, Decl(arrayFromAsync.ts, 35, 48))
const mapArr3 = await Array.fromAsync([0,2,4,6], v => v ** 2);
>mapArr3 : Symbol(mapArr3, Decl(arrayFromAsync.ts, 36, 5))
>Array.fromAsync : Symbol(ArrayConstructor.fromAsync, Decl(lib.esnext.array.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --))
>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, --, --) ... and 5 more)
>fromAsync : Symbol(ArrayConstructor.fromAsync, Decl(lib.esnext.array.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --))
>v : Symbol(v, Decl(arrayFromAsync.ts, 36, 48))
>v : Symbol(v, Decl(arrayFromAsync.ts, 36, 48))
const err = new Error;
>err : Symbol(err, Decl(arrayFromAsync.ts, 38, 5))
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --))
const badIterable = { [Symbol.iterator] () { throw err; } };
>badIterable : Symbol(badIterable, Decl(arrayFromAsync.ts, 39, 5))
>[Symbol.iterator] : Symbol([Symbol.iterator], Decl(arrayFromAsync.ts, 39, 21))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --))
>err : Symbol(err, Decl(arrayFromAsync.ts, 38, 5))
// This returns a promise that will reject with `err`.
const badArray = await Array.fromAsync(badIterable);
>badArray : Symbol(badArray, Decl(arrayFromAsync.ts, 41, 5))
>Array.fromAsync : Symbol(ArrayConstructor.fromAsync, Decl(lib.esnext.array.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --))
>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, --, --) ... and 5 more)
>fromAsync : Symbol(ArrayConstructor.fromAsync, Decl(lib.esnext.array.d.ts, --, --), Decl(lib.esnext.array.d.ts, --, --))
>badIterable : Symbol(badIterable, Decl(arrayFromAsync.ts, 39, 5))