diff --git a/tests/baselines/reference/promiseType.js b/tests/baselines/reference/promiseType.js index 84d9d713b4810..c38f85e84c995 100644 --- a/tests/baselines/reference/promiseType.js +++ b/tests/baselines/reference/promiseType.js @@ -217,6 +217,11 @@ const pc6 = p.then(() => Promise.reject("1"), () => {}); const pc7 = p.then(() => Promise.reject("1"), () => {throw 1}); const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1)); const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); + +// #33062 + +declare function f(resolve: (value: Promise | string) => void); +new Promise(f); //// [promiseType.js] @@ -440,3 +445,4 @@ const pc6 = p.then(() => Promise.reject("1"), () => { }); const pc7 = p.then(() => Promise.reject("1"), () => { throw 1; }); const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1)); const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); +new Promise(f); diff --git a/tests/baselines/reference/promiseType.symbols b/tests/baselines/reference/promiseType.symbols index cec81cd7d8266..fff27c8429874 100644 --- a/tests/baselines/reference/promiseType.symbols +++ b/tests/baselines/reference/promiseType.symbols @@ -1089,3 +1089,15 @@ const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); >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, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --)) +// #33062 + +declare function f(resolve: (value: Promise | string) => void); +>f : Symbol(f, Decl(promiseType.ts, 217, 71)) +>resolve : Symbol(resolve, Decl(promiseType.ts, 221, 19)) +>value : Symbol(value, Decl(promiseType.ts, 221, 29)) +>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, --, --)) + +new Promise(f); +>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, --, --)) +>f : Symbol(f, Decl(promiseType.ts, 217, 71)) + diff --git a/tests/baselines/reference/promiseType.types b/tests/baselines/reference/promiseType.types index dd20fb656ea5a..4c1488ac79444 100644 --- a/tests/baselines/reference/promiseType.types +++ b/tests/baselines/reference/promiseType.types @@ -1583,3 +1583,15 @@ const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); >reject : (reason?: any) => Promise >1 : 1 +// #33062 + +declare function f(resolve: (value: Promise | string) => void); +>f : (resolve: (value: string | Promise) => void) => any +>resolve : (value: string | Promise) => void +>value : string | Promise + +new Promise(f); +>new Promise(f) : Promise +>Promise : PromiseConstructor +>f : (resolve: (value: string | Promise) => void) => any + diff --git a/tests/cases/compiler/promiseType.ts b/tests/cases/compiler/promiseType.ts index ba4a7f6041396..8ac69e04e02df 100644 --- a/tests/cases/compiler/promiseType.ts +++ b/tests/cases/compiler/promiseType.ts @@ -217,3 +217,8 @@ const pc6 = p.then(() => Promise.reject("1"), () => {}); const pc7 = p.then(() => Promise.reject("1"), () => {throw 1}); const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1)); const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); + +// #33062 + +declare function f(resolve: (value: Promise | string) => void); +new Promise(f);