Skip to content

Commit 0179ed8

Browse files
committed
Add tests
1 parent c99b38c commit 0179ed8

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

tests/baselines/reference/promiseType.js

+6
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ const pc6 = p.then(() => Promise.reject("1"), () => {});
217217
const pc7 = p.then(() => Promise.reject("1"), () => {throw 1});
218218
const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1));
219219
const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1));
220+
221+
// #28427
222+
223+
Promise.all([undefined as Promise<string> | number]);
220224

221225

222226
//// [promiseType.js]
@@ -440,3 +444,5 @@ const pc6 = p.then(() => Promise.reject("1"), () => { });
440444
const pc7 = p.then(() => Promise.reject("1"), () => { throw 1; });
441445
const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1));
442446
const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1));
447+
// #28427
448+
Promise.all([undefined]);

tests/baselines/reference/promiseType.symbols

+9
Original file line numberDiff line numberDiff line change
@@ -1089,3 +1089,12 @@ const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1));
10891089
>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, --, --))
10901090
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
10911091

1092+
// #28427
1093+
1094+
Promise.all([undefined as Promise<string> | number]);
1095+
>Promise.all : Symbol(PromiseConstructor.all, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
1096+
>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, --, --))
1097+
>all : Symbol(PromiseConstructor.all, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
1098+
>undefined : Symbol(undefined)
1099+
>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, --, --))
1100+

tests/baselines/reference/promiseType.types

+11
Original file line numberDiff line numberDiff line change
@@ -1583,3 +1583,14 @@ const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1));
15831583
>reject : <T = never>(reason?: any) => Promise<T>
15841584
>1 : 1
15851585

1586+
// #28427
1587+
1588+
Promise.all([undefined as Promise<string> | number]);
1589+
>Promise.all([undefined as Promise<string> | number]) : Promise<(string | number)[]>
1590+
>Promise.all : { <TAll>(values: Iterable<TAll>): Promise<(TAll extends PromiseLike<infer UAll> ? UAll : TAll)[]>; <T extends readonly any[]>(values: T): Promise<{ -readonly [P in keyof T]: Awaited<T[P]>; }>; }
1591+
>Promise : PromiseConstructor
1592+
>all : { <TAll>(values: Iterable<TAll>): Promise<(TAll extends PromiseLike<infer UAll> ? UAll : TAll)[]>; <T extends readonly any[]>(values: T): Promise<{ -readonly [P in keyof T]: Awaited<T[P]>; }>; }
1593+
>[undefined as Promise<string> | number] : (number | Promise<string>)[]
1594+
>undefined as Promise<string> | number : number | Promise<string>
1595+
>undefined : undefined
1596+

tests/cases/compiler/promiseType.ts

+4
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,7 @@ const pc6 = p.then(() => Promise.reject("1"), () => {});
217217
const pc7 = p.then(() => Promise.reject("1"), () => {throw 1});
218218
const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1));
219219
const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1));
220+
221+
// #28427
222+
223+
Promise.all([undefined as Promise<string> | number]);

0 commit comments

Comments
 (0)