Skip to content

Commit 8607e69

Browse files
committedSep 25, 2019
Add tests
1 parent d82234d commit 8607e69

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed
 

‎tests/baselines/reference/promiseType.js

+6
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,11 @@ 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+
// #33074
222+
223+
declare const x2: Promise<number> | string;
224+
Promise.resolve(x2);
220225

221226

222227
//// [promiseType.js]
@@ -440,3 +445,4 @@ const pc6 = p.then(() => Promise.reject("1"), () => { });
440445
const pc7 = p.then(() => Promise.reject("1"), () => { throw 1; });
441446
const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1));
442447
const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1));
448+
Promise.resolve(x2);

‎tests/baselines/reference/promiseType.symbols

+12
Original file line numberDiff line numberDiff line change
@@ -1089,3 +1089,15 @@ 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+
// #33074
1093+
1094+
declare const x2: Promise<number> | string;
1095+
>x2 : Symbol(x2, Decl(promiseType.ts, 221, 13))
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+
1098+
Promise.resolve(x2);
1099+
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
1100+
>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, --, --))
1101+
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
1102+
>x2 : Symbol(x2, Decl(promiseType.ts, 221, 13))
1103+

‎tests/baselines/reference/promiseType.types

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

1586+
// #33074
1587+
1588+
declare const x2: Promise<number> | string;
1589+
>x2 : string | Promise<number>
1590+
1591+
Promise.resolve(x2);
1592+
>Promise.resolve(x2) : Promise<string | number>
1593+
>Promise.resolve : { <T>(value: T): Promise<T extends PromiseLike<infer U> ? U : T>; (): Promise<void>; }
1594+
>Promise : PromiseConstructor
1595+
>resolve : { <T>(value: T): Promise<T extends PromiseLike<infer U> ? U : T>; (): Promise<void>; }
1596+
>x2 : string | Promise<number>
1597+

‎tests/cases/compiler/promiseType.ts

+5
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,8 @@ 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+
// #33074
222+
223+
declare const x2: Promise<number> | string;
224+
Promise.resolve(x2);

0 commit comments

Comments
 (0)