Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ed55bc5

Browse files
committedAug 30, 2019
Add tests
1 parent 75c1de4 commit ed55bc5

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed
 

Diff for: ‎tests/baselines/reference/promiseType.js

+8
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+
// GH#33075
222+
223+
let x2: Promise<number> | string;
224+
Promise.resolve(x2);
220225

221226

222227
//// [promiseType.js]
@@ -440,3 +445,6 @@ 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+
// GH#33075
449+
let x2;
450+
Promise.resolve(x2);

Diff for: ‎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+
// GH#33075
1093+
1094+
let x2: Promise<number> | string;
1095+
>x2 : Symbol(x2, Decl(promiseType.ts, 221, 3))
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, 3))
1103+

Diff for: ‎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+
// GH#33075
1587+
1588+
let 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+

Diff for: ‎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+
// GH#33075
222+
223+
let x2: Promise<number> | string;
224+
Promise.resolve(x2);

0 commit comments

Comments
 (0)
Please sign in to comment.