Skip to content

Commit e6f14d6

Browse files
committed
Add tests
1 parent 5f99deb commit e6f14d6

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

tests/baselines/reference/promiseType.js

+4
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ 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+
declare const x2: Promise<number> | string;
222+
Promise.resolve(x2);
220223

221224

222225
//// [promiseType.js]
@@ -440,3 +443,4 @@ const pc6 = p.then(() => Promise.reject("1"), () => { });
440443
const pc7 = p.then(() => Promise.reject("1"), () => { throw 1; });
441444
const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1));
442445
const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1));
446+
Promise.resolve(x2);

tests/baselines/reference/promiseType.symbols

+10
Original file line numberDiff line numberDiff line change
@@ -1089,3 +1089,13 @@ 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+
declare const x2: Promise<number> | string;
1093+
>x2 : Symbol(x2, Decl(promiseType.ts, 219, 13))
1094+
>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, --, --))
1095+
1096+
Promise.resolve(x2);
1097+
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
1098+
>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, --, --))
1099+
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
1100+
>x2 : Symbol(x2, Decl(promiseType.ts, 219, 13))
1101+

tests/baselines/reference/promiseType.types

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

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

tests/cases/compiler/promiseType.ts

+3
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,6 @@ 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+
declare const x2: Promise<number> | string;
222+
Promise.resolve(x2);

0 commit comments

Comments
 (0)