mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-20 19:45:07 -06:00
add Array.fromAsync to esnext (#57748)
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
This commit is contained in:
parent
a9460c8c93
commit
3282ff28e6
@ -233,6 +233,7 @@ const libEntries: [string, string][] = [
|
||||
["esnext.weakref", "lib.es2021.weakref.d.ts"],
|
||||
["esnext.decorators", "lib.esnext.decorators.d.ts"],
|
||||
["esnext.object", "lib.esnext.object.d.ts"],
|
||||
["esnext.array", "lib.esnext.array.d.ts"],
|
||||
["esnext.regexp", "lib.esnext.regexp.d.ts"],
|
||||
["decorators", "lib.decorators.d.ts"],
|
||||
["decorators.legacy", "lib.decorators.legacy.d.ts"],
|
||||
|
||||
@ -1338,6 +1338,9 @@ export const getScriptTargetFeatures = /* @__PURE__ */ memoize((): ScriptTargetF
|
||||
"from",
|
||||
"of",
|
||||
],
|
||||
esnext: [
|
||||
"fromAsync",
|
||||
],
|
||||
})),
|
||||
ObjectConstructor: new Map(Object.entries({
|
||||
es2015: [
|
||||
|
||||
17
src/lib/esnext.array.d.ts
vendored
Normal file
17
src/lib/esnext.array.d.ts
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
interface ArrayConstructor {
|
||||
/**
|
||||
* Creates an array from an async iterator or iterable object.
|
||||
* @param iterableOrArrayLike An async iterator or array-like object to convert to an array.
|
||||
*/
|
||||
fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates an array from an async iterator or iterable object.
|
||||
*
|
||||
* @param iterableOrArrayLike An async iterator or array-like object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of itarableOrArrayLike.
|
||||
* Each return value is awaited before being added to result array.
|
||||
* @param thisArg Value of 'this' used when executing mapfn.
|
||||
*/
|
||||
fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>) => U, thisArg?: any): Promise<Awaited<U>[]>;
|
||||
}
|
||||
1
src/lib/esnext.d.ts
vendored
1
src/lib/esnext.d.ts
vendored
@ -5,4 +5,5 @@
|
||||
/// <reference lib="esnext.promise" />
|
||||
/// <reference lib="esnext.object" />
|
||||
/// <reference lib="esnext.collection" />
|
||||
/// <reference lib="esnext.array" />
|
||||
/// <reference lib="esnext.regexp" />
|
||||
|
||||
@ -77,6 +77,7 @@
|
||||
"esnext.promise",
|
||||
"esnext.object",
|
||||
"esnext.collection",
|
||||
"esnext.array",
|
||||
"esnext.regexp",
|
||||
"decorators",
|
||||
"decorators.legacy",
|
||||
|
||||
82
tests/baselines/reference/arrayFromAsync.js
Normal file
82
tests/baselines/reference/arrayFromAsync.js
Normal file
@ -0,0 +1,82 @@
|
||||
//// [tests/cases/compiler/arrayFromAsync.ts] ////
|
||||
|
||||
//// [arrayFromAsync.ts]
|
||||
export { };
|
||||
async function * asyncGen (n) {
|
||||
for (let i = 0; i < n; i++)
|
||||
yield i * 2;
|
||||
}
|
||||
|
||||
function * genPromises (n) {
|
||||
for (let i = 0; i < n; i++) {
|
||||
yield Promise.resolve(i * 2);
|
||||
}
|
||||
}
|
||||
|
||||
const arrLike = {
|
||||
0: Promise.resolve(0),
|
||||
1: Promise.resolve(2),
|
||||
2: Promise.resolve(4),
|
||||
3: Promise.resolve(6),
|
||||
length: 4,
|
||||
}
|
||||
|
||||
const arr : number[] = [];
|
||||
for await (const v of asyncGen(4)) {
|
||||
arr.push(v);
|
||||
}
|
||||
|
||||
const sameArr1 = await Array.fromAsync(arrLike);
|
||||
const sameArr2 = await Array.fromAsync([Promise.resolve(0), Promise.resolve(2), Promise.resolve(4), Promise.resolve(6)]);
|
||||
const sameArr3 = await Array.fromAsync(genPromises(4));
|
||||
const sameArr4 = await Array.fromAsync(asyncGen(4));
|
||||
|
||||
function Data (n) {}
|
||||
Data.fromAsync = Array.fromAsync;
|
||||
const sameArr5 = await Data.fromAsync(asyncGen(4));
|
||||
|
||||
const mapArr1 = await Array.fromAsync(asyncGen(4), v => v ** 2);
|
||||
const mapArr2 = await Array.fromAsync([0,2,4,6], v => Promise.resolve(v ** 2));
|
||||
const mapArr3 = await Array.fromAsync([0,2,4,6], v => v ** 2);
|
||||
|
||||
const err = new Error;
|
||||
const badIterable = { [Symbol.iterator] () { throw err; } };
|
||||
// This returns a promise that will reject with `err`.
|
||||
const badArray = await Array.fromAsync(badIterable);
|
||||
|
||||
//// [arrayFromAsync.js]
|
||||
async function* asyncGen(n) {
|
||||
for (let i = 0; i < n; i++)
|
||||
yield i * 2;
|
||||
}
|
||||
function* genPromises(n) {
|
||||
for (let i = 0; i < n; i++) {
|
||||
yield Promise.resolve(i * 2);
|
||||
}
|
||||
}
|
||||
const arrLike = {
|
||||
0: Promise.resolve(0),
|
||||
1: Promise.resolve(2),
|
||||
2: Promise.resolve(4),
|
||||
3: Promise.resolve(6),
|
||||
length: 4,
|
||||
};
|
||||
const arr = [];
|
||||
for await (const v of asyncGen(4)) {
|
||||
arr.push(v);
|
||||
}
|
||||
const sameArr1 = await Array.fromAsync(arrLike);
|
||||
const sameArr2 = await Array.fromAsync([Promise.resolve(0), Promise.resolve(2), Promise.resolve(4), Promise.resolve(6)]);
|
||||
const sameArr3 = await Array.fromAsync(genPromises(4));
|
||||
const sameArr4 = await Array.fromAsync(asyncGen(4));
|
||||
function Data(n) { }
|
||||
Data.fromAsync = Array.fromAsync;
|
||||
const sameArr5 = await Data.fromAsync(asyncGen(4));
|
||||
const mapArr1 = await Array.fromAsync(asyncGen(4), v => v ** 2);
|
||||
const mapArr2 = await Array.fromAsync([0, 2, 4, 6], v => Promise.resolve(v ** 2));
|
||||
const mapArr3 = await Array.fromAsync([0, 2, 4, 6], v => v ** 2);
|
||||
const err = new Error;
|
||||
const badIterable = { [Symbol.iterator]() { throw err; } };
|
||||
// This returns a promise that will reject with `err`.
|
||||
const badArray = await Array.fromAsync(badIterable);
|
||||
export {};
|
||||
187
tests/baselines/reference/arrayFromAsync.symbols
Normal file
187
tests/baselines/reference/arrayFromAsync.symbols
Normal file
@ -0,0 +1,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 4 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 4 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 4 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 4 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 4 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 4 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 4 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 4 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 4 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))
|
||||
|
||||
272
tests/baselines/reference/arrayFromAsync.types
Normal file
272
tests/baselines/reference/arrayFromAsync.types
Normal file
@ -0,0 +1,272 @@
|
||||
//// [tests/cases/compiler/arrayFromAsync.ts] ////
|
||||
|
||||
=== arrayFromAsync.ts ===
|
||||
export { };
|
||||
async function * asyncGen (n) {
|
||||
>asyncGen : (n: any) => AsyncGenerator<number, void, unknown>
|
||||
>n : any
|
||||
|
||||
for (let i = 0; i < n; i++)
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < n : boolean
|
||||
>i : number
|
||||
>n : any
|
||||
>i++ : number
|
||||
>i : number
|
||||
|
||||
yield i * 2;
|
||||
>yield i * 2 : any
|
||||
>i * 2 : number
|
||||
>i : number
|
||||
>2 : 2
|
||||
}
|
||||
|
||||
function * genPromises (n) {
|
||||
>genPromises : (n: any) => Generator<Promise<number>, void, unknown>
|
||||
>n : any
|
||||
|
||||
for (let i = 0; i < n; i++) {
|
||||
>i : number
|
||||
>0 : 0
|
||||
>i < n : boolean
|
||||
>i : number
|
||||
>n : any
|
||||
>i++ : number
|
||||
>i : number
|
||||
|
||||
yield Promise.resolve(i * 2);
|
||||
>yield Promise.resolve(i * 2) : any
|
||||
>Promise.resolve(i * 2) : Promise<number>
|
||||
>Promise.resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>Promise : PromiseConstructor
|
||||
>resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>i * 2 : number
|
||||
>i : number
|
||||
>2 : 2
|
||||
}
|
||||
}
|
||||
|
||||
const arrLike = {
|
||||
>arrLike : { 0: Promise<number>; 1: Promise<number>; 2: Promise<number>; 3: Promise<number>; length: number; }
|
||||
>{ 0: Promise.resolve(0), 1: Promise.resolve(2), 2: Promise.resolve(4), 3: Promise.resolve(6), length: 4,} : { 0: Promise<number>; 1: Promise<number>; 2: Promise<number>; 3: Promise<number>; length: number; }
|
||||
|
||||
0: Promise.resolve(0),
|
||||
>0 : Promise<number>
|
||||
>Promise.resolve(0) : Promise<number>
|
||||
>Promise.resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>Promise : PromiseConstructor
|
||||
>resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>0 : 0
|
||||
|
||||
1: Promise.resolve(2),
|
||||
>1 : Promise<number>
|
||||
>Promise.resolve(2) : Promise<number>
|
||||
>Promise.resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>Promise : PromiseConstructor
|
||||
>resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>2 : 2
|
||||
|
||||
2: Promise.resolve(4),
|
||||
>2 : Promise<number>
|
||||
>Promise.resolve(4) : Promise<number>
|
||||
>Promise.resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>Promise : PromiseConstructor
|
||||
>resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>4 : 4
|
||||
|
||||
3: Promise.resolve(6),
|
||||
>3 : Promise<number>
|
||||
>Promise.resolve(6) : Promise<number>
|
||||
>Promise.resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>Promise : PromiseConstructor
|
||||
>resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>6 : 6
|
||||
|
||||
length: 4,
|
||||
>length : number
|
||||
>4 : 4
|
||||
}
|
||||
|
||||
const arr : number[] = [];
|
||||
>arr : number[]
|
||||
>[] : undefined[]
|
||||
|
||||
for await (const v of asyncGen(4)) {
|
||||
>v : number
|
||||
>asyncGen(4) : AsyncGenerator<number, void, unknown>
|
||||
>asyncGen : (n: any) => AsyncGenerator<number, void, unknown>
|
||||
>4 : 4
|
||||
|
||||
arr.push(v);
|
||||
>arr.push(v) : number
|
||||
>arr.push : (...items: number[]) => number
|
||||
>arr : number[]
|
||||
>push : (...items: number[]) => number
|
||||
>v : number
|
||||
}
|
||||
|
||||
const sameArr1 = await Array.fromAsync(arrLike);
|
||||
>sameArr1 : number[]
|
||||
>await Array.fromAsync(arrLike) : number[]
|
||||
>Array.fromAsync(arrLike) : Promise<number[]>
|
||||
>Array.fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>Array : ArrayConstructor
|
||||
>fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>arrLike : { 0: Promise<number>; 1: Promise<number>; 2: Promise<number>; 3: Promise<number>; length: number; }
|
||||
|
||||
const sameArr2 = await Array.fromAsync([Promise.resolve(0), Promise.resolve(2), Promise.resolve(4), Promise.resolve(6)]);
|
||||
>sameArr2 : number[]
|
||||
>await Array.fromAsync([Promise.resolve(0), Promise.resolve(2), Promise.resolve(4), Promise.resolve(6)]) : number[]
|
||||
>Array.fromAsync([Promise.resolve(0), Promise.resolve(2), Promise.resolve(4), Promise.resolve(6)]) : Promise<number[]>
|
||||
>Array.fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>Array : ArrayConstructor
|
||||
>fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>[Promise.resolve(0), Promise.resolve(2), Promise.resolve(4), Promise.resolve(6)] : Promise<number>[]
|
||||
>Promise.resolve(0) : Promise<number>
|
||||
>Promise.resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>Promise : PromiseConstructor
|
||||
>resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>0 : 0
|
||||
>Promise.resolve(2) : Promise<number>
|
||||
>Promise.resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>Promise : PromiseConstructor
|
||||
>resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>2 : 2
|
||||
>Promise.resolve(4) : Promise<number>
|
||||
>Promise.resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>Promise : PromiseConstructor
|
||||
>resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>4 : 4
|
||||
>Promise.resolve(6) : Promise<number>
|
||||
>Promise.resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>Promise : PromiseConstructor
|
||||
>resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>6 : 6
|
||||
|
||||
const sameArr3 = await Array.fromAsync(genPromises(4));
|
||||
>sameArr3 : number[]
|
||||
>await Array.fromAsync(genPromises(4)) : number[]
|
||||
>Array.fromAsync(genPromises(4)) : Promise<number[]>
|
||||
>Array.fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>Array : ArrayConstructor
|
||||
>fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>genPromises(4) : Generator<Promise<number>, void, unknown>
|
||||
>genPromises : (n: any) => Generator<Promise<number>, void, unknown>
|
||||
>4 : 4
|
||||
|
||||
const sameArr4 = await Array.fromAsync(asyncGen(4));
|
||||
>sameArr4 : number[]
|
||||
>await Array.fromAsync(asyncGen(4)) : number[]
|
||||
>Array.fromAsync(asyncGen(4)) : Promise<number[]>
|
||||
>Array.fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>Array : ArrayConstructor
|
||||
>fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>asyncGen(4) : AsyncGenerator<number, void, unknown>
|
||||
>asyncGen : (n: any) => AsyncGenerator<number, void, unknown>
|
||||
>4 : 4
|
||||
|
||||
function Data (n) {}
|
||||
>Data : typeof Data
|
||||
>n : any
|
||||
|
||||
Data.fromAsync = Array.fromAsync;
|
||||
>Data.fromAsync = Array.fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>Data.fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>Data : typeof Data
|
||||
>fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>Array.fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>Array : ArrayConstructor
|
||||
>fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
|
||||
const sameArr5 = await Data.fromAsync(asyncGen(4));
|
||||
>sameArr5 : number[]
|
||||
>await Data.fromAsync(asyncGen(4)) : number[]
|
||||
>Data.fromAsync(asyncGen(4)) : Promise<number[]>
|
||||
>Data.fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>Data : typeof Data
|
||||
>fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>asyncGen(4) : AsyncGenerator<number, void, unknown>
|
||||
>asyncGen : (n: any) => AsyncGenerator<number, void, unknown>
|
||||
>4 : 4
|
||||
|
||||
const mapArr1 = await Array.fromAsync(asyncGen(4), v => v ** 2);
|
||||
>mapArr1 : number[]
|
||||
>await Array.fromAsync(asyncGen(4), v => v ** 2) : number[]
|
||||
>Array.fromAsync(asyncGen(4), v => v ** 2) : Promise<number[]>
|
||||
>Array.fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>Array : ArrayConstructor
|
||||
>fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>asyncGen(4) : AsyncGenerator<number, void, unknown>
|
||||
>asyncGen : (n: any) => AsyncGenerator<number, void, unknown>
|
||||
>4 : 4
|
||||
>v => v ** 2 : (v: number) => number
|
||||
>v : number
|
||||
>v ** 2 : number
|
||||
>v : number
|
||||
>2 : 2
|
||||
|
||||
const mapArr2 = await Array.fromAsync([0,2,4,6], v => Promise.resolve(v ** 2));
|
||||
>mapArr2 : number[]
|
||||
>await Array.fromAsync([0,2,4,6], v => Promise.resolve(v ** 2)) : number[]
|
||||
>Array.fromAsync([0,2,4,6], v => Promise.resolve(v ** 2)) : Promise<number[]>
|
||||
>Array.fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>Array : ArrayConstructor
|
||||
>fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>[0,2,4,6] : number[]
|
||||
>0 : 0
|
||||
>2 : 2
|
||||
>4 : 4
|
||||
>6 : 6
|
||||
>v => Promise.resolve(v ** 2) : (v: number) => Promise<number>
|
||||
>v : number
|
||||
>Promise.resolve(v ** 2) : Promise<number>
|
||||
>Promise.resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>Promise : PromiseConstructor
|
||||
>resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T_1>(value: T_1 | PromiseLike<T_1>): Promise<Awaited<T_1>>; }
|
||||
>v ** 2 : number
|
||||
>v : number
|
||||
>2 : 2
|
||||
|
||||
const mapArr3 = await Array.fromAsync([0,2,4,6], v => v ** 2);
|
||||
>mapArr3 : number[]
|
||||
>await Array.fromAsync([0,2,4,6], v => v ** 2) : number[]
|
||||
>Array.fromAsync([0,2,4,6], v => v ** 2) : Promise<number[]>
|
||||
>Array.fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>Array : ArrayConstructor
|
||||
>fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>[0,2,4,6] : number[]
|
||||
>0 : 0
|
||||
>2 : 2
|
||||
>4 : 4
|
||||
>6 : 6
|
||||
>v => v ** 2 : (v: number) => number
|
||||
>v : number
|
||||
>v ** 2 : number
|
||||
>v : number
|
||||
>2 : 2
|
||||
|
||||
const err = new Error;
|
||||
>err : Error
|
||||
>new Error : Error
|
||||
>Error : ErrorConstructor
|
||||
|
||||
const badIterable = { [Symbol.iterator] () { throw err; } };
|
||||
>badIterable : { [Symbol.iterator](): never; }
|
||||
>{ [Symbol.iterator] () { throw err; } } : { [Symbol.iterator](): never; }
|
||||
>[Symbol.iterator] : () => never
|
||||
>Symbol.iterator : unique symbol
|
||||
>Symbol : SymbolConstructor
|
||||
>iterator : unique symbol
|
||||
>err : Error
|
||||
|
||||
// This returns a promise that will reject with `err`.
|
||||
const badArray = await Array.fromAsync(badIterable);
|
||||
>badArray : unknown[]
|
||||
>await Array.fromAsync(badIterable) : unknown[]
|
||||
>Array.fromAsync(badIterable) : Promise<unknown[]>
|
||||
>Array.fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>Array : ArrayConstructor
|
||||
>fromAsync : { <T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; <T_1, U>(iterableOrArrayLike: AsyncIterable<T_1> | Iterable<T_1> | ArrayLike<T_1>, mapFn: (value: Awaited<T_1>) => U, thisArg?: any): Promise<Awaited<U>[]>; }
|
||||
>badIterable : { [Symbol.iterator](): never; }
|
||||
|
||||
@ -902,6 +902,19 @@
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/collection' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/array' from '/.src/__lib_node_modules_lookup_lib.esnext.array.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: JavaScript.",
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/array' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/regexp' from '/.src/__lib_node_modules_lookup_lib.esnext.regexp.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
|
||||
@ -1044,6 +1044,21 @@
|
||||
"======== Module name '@typescript/lib-esnext/collection' was not resolved. ========",
|
||||
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
|
||||
"File '/package.json' does not exist according to earlier cached lookups.",
|
||||
"======== Resolving module '@typescript/lib-esnext/array' from '/.src/__lib_node_modules_lookup_lib.esnext.array.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: JavaScript.",
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/array' was not resolved. ========",
|
||||
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
|
||||
"File '/package.json' does not exist according to earlier cached lookups.",
|
||||
"======== Resolving module '@typescript/lib-esnext/regexp' from '/.src/__lib_node_modules_lookup_lib.esnext.regexp.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
|
||||
@ -851,6 +851,18 @@
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/collection' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/array' from '/.src/__lib_node_modules_lookup_lib.esnext.array.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: JavaScript.",
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/array' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/regexp' from '/.src/__lib_node_modules_lookup_lib.esnext.regexp.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
|
||||
@ -782,6 +782,17 @@
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/collection' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/array' from '/.src/__lib_node_modules_lookup_lib.esnext.array.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: JavaScript.",
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/array' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/regexp' from '/.src/__lib_node_modules_lookup_lib.esnext.regexp.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
|
||||
@ -1160,6 +1160,20 @@
|
||||
"======== Module name '@typescript/lib-esnext/collection' was not resolved. ========",
|
||||
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
|
||||
"File '/package.json' does not exist according to earlier cached lookups.",
|
||||
"======== Resolving module '@typescript/lib-esnext/array' from '/.src/__lib_node_modules_lookup_lib.esnext.array.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: JavaScript.",
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/array' was not resolved. ========",
|
||||
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
|
||||
"File '/package.json' does not exist according to earlier cached lookups.",
|
||||
"======== Resolving module '@typescript/lib-esnext/regexp' from '/.src/__lib_node_modules_lookup_lib.esnext.regexp.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
|
||||
@ -1103,6 +1103,21 @@
|
||||
"======== Module name '@typescript/lib-esnext/collection' was not resolved. ========",
|
||||
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
|
||||
"File '/package.json' does not exist according to earlier cached lookups.",
|
||||
"======== Resolving module '@typescript/lib-esnext/array' from '/.src/__lib_node_modules_lookup_lib.esnext.array.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: JavaScript.",
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/array' was not resolved. ========",
|
||||
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
|
||||
"File '/package.json' does not exist according to earlier cached lookups.",
|
||||
"======== Resolving module '@typescript/lib-esnext/regexp' from '/.src/__lib_node_modules_lookup_lib.esnext.regexp.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
|
||||
@ -1142,6 +1142,20 @@
|
||||
"======== Module name '@typescript/lib-esnext/collection' was not resolved. ========",
|
||||
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
|
||||
"File '/package.json' does not exist according to earlier cached lookups.",
|
||||
"======== Resolving module '@typescript/lib-esnext/array' from '/.src/__lib_node_modules_lookup_lib.esnext.array.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
|
||||
"Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: JavaScript.",
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/array' was not resolved. ========",
|
||||
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
|
||||
"File '/package.json' does not exist according to earlier cached lookups.",
|
||||
"======== Resolving module '@typescript/lib-esnext/regexp' from '/.src/__lib_node_modules_lookup_lib.esnext.regexp.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
|
||||
@ -937,6 +937,19 @@
|
||||
"======== Module name '@typescript/lib-esnext/collection' was not resolved. ========",
|
||||
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
|
||||
"File '/package.json' does not exist according to earlier cached lookups.",
|
||||
"======== Resolving module '@typescript/lib-esnext/array' from '/.src/__lib_node_modules_lookup_lib.esnext.array.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: JavaScript.",
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/array' was not resolved. ========",
|
||||
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
|
||||
"File '/package.json' does not exist according to earlier cached lookups.",
|
||||
"======== Resolving module '@typescript/lib-esnext/regexp' from '/.src/__lib_node_modules_lookup_lib.esnext.regexp.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
|
||||
@ -937,6 +937,19 @@
|
||||
"======== Module name '@typescript/lib-esnext/collection' was not resolved. ========",
|
||||
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
|
||||
"File '/package.json' does not exist according to earlier cached lookups.",
|
||||
"======== Resolving module '@typescript/lib-esnext/array' from '/.src/__lib_node_modules_lookup_lib.esnext.array.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: JavaScript.",
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/array' was not resolved. ========",
|
||||
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
|
||||
"File '/package.json' does not exist according to earlier cached lookups.",
|
||||
"======== Resolving module '@typescript/lib-esnext/regexp' from '/.src/__lib_node_modules_lookup_lib.esnext.regexp.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
|
||||
@ -111,7 +111,7 @@ default: undefined
|
||||
|
||||
--lib
|
||||
Specify a set of bundled library declaration files that describe the target runtime environment.
|
||||
one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, es2023.collection, es2023.intl, esnext.collection, esnext.intl, esnext.disposable, esnext.promise, esnext.decorators, esnext.object, esnext.regexp, decorators, decorators.legacy
|
||||
one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array, es2023.collection, es2023.intl, esnext.array, esnext.collection, esnext.intl, esnext.disposable, esnext.promise, esnext.decorators, esnext.object, esnext.regexp, decorators, decorators.legacy
|
||||
default: undefined
|
||||
|
||||
--allowJs
|
||||
|
||||
@ -111,7 +111,7 @@ default: undefined
|
||||
|
||||
[94m--lib[39m
|
||||
Specify a set of bundled library declaration files that describe the target runtime environment.
|
||||
one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, es2023.collection, es2023.intl, esnext.collection, esnext.intl, esnext.disposable, esnext.promise, esnext.decorators, esnext.object, esnext.regexp, decorators, decorators.legacy
|
||||
one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array, es2023.collection, es2023.intl, esnext.array, esnext.collection, esnext.intl, esnext.disposable, esnext.promise, esnext.decorators, esnext.object, esnext.regexp, decorators, decorators.legacy
|
||||
default: undefined
|
||||
|
||||
[94m--allowJs[39m
|
||||
|
||||
@ -111,7 +111,7 @@ default: undefined
|
||||
|
||||
[94m--lib[39m
|
||||
Specify a set of bundled library declaration files that describe the target runtime environment.
|
||||
one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, es2023.collection, es2023.intl, esnext.collection, esnext.intl, esnext.disposable, esnext.promise, esnext.decorators, esnext.object, esnext.regexp, decorators, decorators.legacy
|
||||
one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array, es2023.collection, es2023.intl, esnext.array, esnext.collection, esnext.intl, esnext.disposable, esnext.promise, esnext.decorators, esnext.object, esnext.regexp, decorators, decorators.legacy
|
||||
default: undefined
|
||||
|
||||
[94m--allowJs[39m
|
||||
|
||||
@ -887,6 +887,18 @@
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/collection' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/array' from '/.src/__lib_node_modules_lookup_lib.esnext.array.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
|
||||
"Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: JavaScript.",
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/array' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/regexp' from '/.src/__lib_node_modules_lookup_lib.esnext.regexp.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
|
||||
@ -904,6 +904,19 @@
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/collection' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/array' from '/.src/__lib_node_modules_lookup_lib.esnext.array.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: JavaScript.",
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/array' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/regexp' from '/.src/__lib_node_modules_lookup_lib.esnext.regexp.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
|
||||
@ -904,6 +904,19 @@
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/collection' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/array' from '/.src/__lib_node_modules_lookup_lib.esnext.array.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: JavaScript.",
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/array' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/regexp' from '/.src/__lib_node_modules_lookup_lib.esnext.regexp.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
|
||||
@ -848,6 +848,18 @@
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/collection' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/array' from '/.src/__lib_node_modules_lookup_lib.esnext.array.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
|
||||
"Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: JavaScript.",
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/array' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/regexp' from '/.src/__lib_node_modules_lookup_lib.esnext.regexp.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
|
||||
@ -887,6 +887,18 @@
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/collection' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/array' from '/.src/__lib_node_modules_lookup_lib.esnext.array.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
|
||||
"Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: JavaScript.",
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/array' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/regexp' from '/.src/__lib_node_modules_lookup_lib.esnext.regexp.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
|
||||
@ -848,6 +848,18 @@
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/collection' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/array' from '/.src/__lib_node_modules_lookup_lib.esnext.array.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
|
||||
"Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: JavaScript.",
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/array' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/regexp' from '/.src/__lib_node_modules_lookup_lib.esnext.regexp.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
|
||||
@ -870,6 +870,18 @@
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/collection' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/array' from '/.src/__lib_node_modules_lookup_lib.esnext.array.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
|
||||
"Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: JavaScript.",
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/array' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/regexp' from '/.src/__lib_node_modules_lookup_lib.esnext.regexp.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
|
||||
@ -854,6 +854,18 @@
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/collection' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/array' from '/.src/__lib_node_modules_lookup_lib.esnext.array.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
|
||||
"Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"Scoped package detected, looking in 'typescript__lib-esnext/array'",
|
||||
"Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: JavaScript.",
|
||||
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
|
||||
"Directory '/node_modules' does not exist, skipping all lookups in it.",
|
||||
"======== Module name '@typescript/lib-esnext/array' was not resolved. ========",
|
||||
"======== Resolving module '@typescript/lib-esnext/regexp' from '/.src/__lib_node_modules_lookup_lib.esnext.regexp.d.ts__.ts'. ========",
|
||||
"Explicitly specified module resolution kind: 'Node10'.",
|
||||
"Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.",
|
||||
|
||||
45
tests/cases/compiler/arrayFromAsync.ts
Normal file
45
tests/cases/compiler/arrayFromAsync.ts
Normal file
@ -0,0 +1,45 @@
|
||||
// @module: esnext
|
||||
// @target: esnext
|
||||
|
||||
export { };
|
||||
async function * asyncGen (n) {
|
||||
for (let i = 0; i < n; i++)
|
||||
yield i * 2;
|
||||
}
|
||||
|
||||
function * genPromises (n) {
|
||||
for (let i = 0; i < n; i++) {
|
||||
yield Promise.resolve(i * 2);
|
||||
}
|
||||
}
|
||||
|
||||
const arrLike = {
|
||||
0: Promise.resolve(0),
|
||||
1: Promise.resolve(2),
|
||||
2: Promise.resolve(4),
|
||||
3: Promise.resolve(6),
|
||||
length: 4,
|
||||
}
|
||||
|
||||
const arr : number[] = [];
|
||||
for await (const v of asyncGen(4)) {
|
||||
arr.push(v);
|
||||
}
|
||||
|
||||
const sameArr1 = await Array.fromAsync(arrLike);
|
||||
const sameArr2 = await Array.fromAsync([Promise.resolve(0), Promise.resolve(2), Promise.resolve(4), Promise.resolve(6)]);
|
||||
const sameArr3 = await Array.fromAsync(genPromises(4));
|
||||
const sameArr4 = await Array.fromAsync(asyncGen(4));
|
||||
|
||||
function Data (n) {}
|
||||
Data.fromAsync = Array.fromAsync;
|
||||
const sameArr5 = await Data.fromAsync(asyncGen(4));
|
||||
|
||||
const mapArr1 = await Array.fromAsync(asyncGen(4), v => v ** 2);
|
||||
const mapArr2 = await Array.fromAsync([0,2,4,6], v => Promise.resolve(v ** 2));
|
||||
const mapArr3 = await Array.fromAsync([0,2,4,6], v => v ** 2);
|
||||
|
||||
const err = new Error;
|
||||
const badIterable = { [Symbol.iterator] () { throw err; } };
|
||||
// This returns a promise that will reject with `err`.
|
||||
const badArray = await Array.fromAsync(badIterable);
|
||||
Loading…
x
Reference in New Issue
Block a user